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 +4 -4
- data/lib/line.rb +9 -1
- data/lib/version.rb +1 -1
- data/spec/gcovtools/line_spec.rb +39 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 79704c773c2995234b02d73c6c212496072f11bd
|
4
|
+
data.tar.gz: 802a71bba4d7bcc7de02bf907ce982310b448ebb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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
data/spec/gcovtools/line_spec.rb
CHANGED
@@ -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
|