gcovtools 1.1.1 → 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c23db08fd06b16c6c51a25767527a5477c79bbe2
4
- data.tar.gz: 473f253ed3f31443a38e48031c4c6b4e268065f7
3
+ metadata.gz: 79704c773c2995234b02d73c6c212496072f11bd
4
+ data.tar.gz: 802a71bba4d7bcc7de02bf907ce982310b448ebb
5
5
  SHA512:
6
- metadata.gz: 3dbf18325ed0c4daa8192d37b09621c5cf6c9481ca0eea193e49fd4ecd7fd94929d43bb938bb7084d8cbc20f08321f9a042681f3c83af97ebefcf6b99b521bd6
7
- data.tar.gz: b64383a654f12cbd33c013ce690eb12c8495da5919d119b5b52a8c670f5859d2dc25baad5622756143a8d62c2a277b9dcdcb5b8e5f04904be317f95717125867
6
+ metadata.gz: d73d680866da1d8733b8273cc2162491f03060e4d4413fc152d428a22b83f531f5ff32521c4f2797d427d7a186963498e336e1ea4c404b1ed682b862dcc54161
7
+ data.tar.gz: 010fa7a669e91646b9e8b9d073318eeb6ca4e9491cf011cf6356a1aba9757ab1ec39d75d42542de98f1d2f405a35d44cbac68a865eb9dfe793cc3dfa652c232e
data/lib/line.rb CHANGED
@@ -19,6 +19,13 @@ module GCOVTOOLS
19
19
  end
20
20
  end
21
21
 
22
+ def self.closing_brace_patterns
23
+ [
24
+ /^}[ ;]*$/, # brace followed by any number of spaces and semi-colons (methods/classes/closures)
25
+ /^}[ ;]*\/\/.*$/, # brace + [semicolon(s)] + inline comment (e.g. end of class/method)
26
+ ]
27
+ end
28
+
22
29
  def self.parse line
23
30
  match = /^[ ]*([0-9]+|-|#####):[ ]*([0-9]+):(.*)/.match(line)
24
31
  fail "Invalid line: #{line}" unless match.to_a.count == 4
@@ -29,7 +36,8 @@ module GCOVTOOLS
29
36
  when "#####" then :missed
30
37
  else count.to_i
31
38
  end
32
- count = :none if count == :missed and text.strip == "}"
39
+
40
+ count = :none if count == :missed and Line.closing_brace_patterns.select{|re| re.match(text.strip) }.count > 0
33
41
  GCOVTOOLS::Line.new number,count,text
34
42
  end
35
43
 
data/lib/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module GCOVTOOLS
2
- VERSION = '1.1.1'
2
+ VERSION = '1.1.2'
3
3
  end
@@ -63,6 +63,45 @@ describe GCOVTOOLS::Line do
63
63
  expect(line.text).to eq("} ")
64
64
  end
65
65
 
66
+ it "should ignore missed closing brace with semicolon" do
67
+ line = GCOVTOOLS::Line.parse " #####: 1:};"
68
+ expect(line.number).to eq(1)
69
+ expect(line.count).to eq(:none)
70
+ expect(line.text).to eq("};")
71
+ line = GCOVTOOLS::Line.parse " #####: 89: }; "
72
+ expect(line.number).to eq(89)
73
+ expect(line.count).to eq(:none)
74
+ expect(line.text).to eq(" }; ")
75
+ line = GCOVTOOLS::Line.parse " #####: 999: };"
76
+ expect(line.number).to eq(999)
77
+ expect(line.count).to eq(:none)
78
+ expect(line.text).to eq(" };")
79
+ line = GCOVTOOLS::Line.parse " #####: 5:}; "
80
+ expect(line.number).to eq(5)
81
+ expect(line.count).to eq(:none)
82
+ expect(line.text).to eq("}; ")
83
+ end
84
+
85
+
86
+ it "should ignore missed closing brace with semicolon and inline comment" do
87
+ line = GCOVTOOLS::Line.parse " #####: 1:}; // class Foo"
88
+ expect(line.number).to eq(1)
89
+ expect(line.count).to eq(:none)
90
+ expect(line.text).to eq("}; // class Foo")
91
+ line = GCOVTOOLS::Line.parse " #####: 89: }; //class Foo "
92
+ expect(line.number).to eq(89)
93
+ expect(line.count).to eq(:none)
94
+ expect(line.text).to eq(" }; //class Foo ")
95
+ line = GCOVTOOLS::Line.parse " #####: 999: }; // class Foo"
96
+ expect(line.number).to eq(999)
97
+ expect(line.count).to eq(:none)
98
+ expect(line.text).to eq(" }; // class Foo")
99
+ line = GCOVTOOLS::Line.parse " #####: 5:}; // class Foo "
100
+ expect(line.number).to eq(5)
101
+ expect(line.count).to eq(:none)
102
+ expect(line.text).to eq("}; // class Foo ")
103
+ end
104
+
66
105
  end
67
106
 
68
107
  describe "#state" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gcovtools
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mattias Bergbom