slather 2.6.0 → 2.7.0

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
  SHA256:
3
- metadata.gz: eeaf99ed5212bdc90e8098dfde877452af7f074ecfd41fc577d46f90b1ee65eb
4
- data.tar.gz: 5dbd0db5223f26990c2bfd3ab02f4ed36a15d8088a0b5c393f522a785a0176cd
3
+ metadata.gz: d6388d4f62571f927f845978e5383f2508b98e7e3ba0205aaf546b5a54d465f5
4
+ data.tar.gz: 837f82512416a6f57cb9c4510dcc7bd9524a4aeeaa05f42bdd841f18cf4fa1d9
5
5
  SHA512:
6
- metadata.gz: 6802b4ef28cfb856bf68d214416d6a455de715723327dc7167600bc9cae705dacbdbffb0b8d154b2027dde6d5b2f6baec719f69a81e5293a437da1e260461e73
7
- data.tar.gz: c6b95c762eaa1d5260da5de5910e7f429a79e45556a3b32568ba8c7c9f3ed173ed514330793c39babc767e4f021dda7fc83971750d16407d0149050286495b95
6
+ metadata.gz: 2b1af2387a7475860aeb3666883c5fd8d2e2b9be020680452140e71fa5bbb3ff057eb3b23b0ddb1c02d6fd55478aafceda18f5527ed2bd086b49d0d89a06e75b
7
+ data.tar.gz: 0b464fbffa5722ed27fa157e429427387889e9e5c641ed2d2d2663a90ccc6f815163e19687a21fac2078dbb6c9c8c8baf9745ff1b55266e38f220aed6258c66f
data/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## v2.7.0
4
+
5
+ * Add Branch Coverage data for ProfData coverage files
6
+ [hborawski](https://github.com/hborawski)
7
+ [#477](https://github.com/SlatherOrg/slather/pull/477)
8
+
9
+ * Fixed 'Argument list too long' when running 'xcrun llvm-cov'
10
+ [samuelsainz](https://github.com/samuelsainz)
11
+ [#476](https://github.com/SlatherOrg/slather/pull/476)
12
+
13
+ ## v2.6.1
14
+
15
+ * Update nokogiri to 1.11
16
+ [ashin-omg](https://github.com/ashin-omg)
17
+ [#473](https://github.com/SlatherOrg/slather/pull/473)
18
+
3
19
  ## v2.6.0
4
20
 
5
21
  * Added GitHub actions support
data/assets/slather.css CHANGED
@@ -74,6 +74,7 @@ table.source_code {
74
74
  table.source_code td {
75
75
  padding-bottom: 0.3em;
76
76
  }
77
+ code.missed { background-color: rgba(255, 73, 76, 0.3); }
77
78
  table.source_code tr.missed td { background-color: rgba(248, 103, 105, 0.2); }
78
79
  table.source_code tr.covered td { background-color: rgba(103, 207, 124, 0.2); }
79
80
  table.source_code td.num {
@@ -124,7 +125,7 @@ footer p, footer a {
124
125
  Syntax Highlighting using highlight.js (https://highlightjs.org)
125
126
  ------------------------------------------------------------- */
126
127
  .hljs {
127
- display: block;
128
+ display: inline-block;
128
129
  overflow-x: auto;
129
130
  -webkit-text-size-adjust: none;
130
131
  }
@@ -70,9 +70,14 @@ module Slather
70
70
 
71
71
  total_relevant_lines = 0
72
72
  total_tested_lines = 0
73
+ total_relevant_branches = 0
74
+ total_branches_tested = 0
73
75
  coverage_files.each { |coverage_file|
74
76
  total_tested_lines += coverage_file.num_lines_tested
75
77
  total_relevant_lines += coverage_file.num_lines_testable
78
+
79
+ total_relevant_branches += coverage_file.num_branches_testable
80
+ total_branches_tested += coverage_file.num_branches_tested
76
81
  }
77
82
 
78
83
  builder = Nokogiri::HTML::Builder.with(template.at('#reports')) { |cov|
@@ -84,6 +89,12 @@ module Slather
84
89
  cov.span decimal_f(percentage) + '%', :class => class_for_coverage_percentage(percentage), :id => "total_coverage"
85
90
  }
86
91
 
92
+ cov.h4 {
93
+ percentage = (total_branches_tested / total_relevant_branches.to_f) * 100.0
94
+ cov.span "Total Branch Coverage : "
95
+ cov.span decimal_f(percentage) + '%', :class => class_for_coverage_percentage(percentage), :id => "total_coverage"
96
+ }
97
+
87
98
  cov.input(:class => "search", :placeholder => "Search")
88
99
 
89
100
  cov.table(:class => "coverage_list", :cellspacing => 0, :cellpadding => 0) {
@@ -133,6 +144,7 @@ module Slather
133
144
  filepath = coverage_file.source_file_pathname_relative_to_repo_root
134
145
  filename = File.basename(filepath)
135
146
  percentage = coverage_file.percentage_lines_tested
147
+ branch_percentage = coverage_file.rate_branches_tested * 100
136
148
 
137
149
  cleaned_gcov_lines = coverage_file.cleaned_gcov_data.split("\n")
138
150
  is_file_empty = (cleaned_gcov_lines.count <= 0)
@@ -142,7 +154,10 @@ module Slather
142
154
  builder = Nokogiri::HTML::Builder.with(template.at('#reports')) { |cov|
143
155
  cov.h2(:class => "cov_title") {
144
156
  cov.span("Coverage for \"#{filename}\"" + (!is_file_empty ? " : " : ""))
157
+ cov.span("Lines: ") unless is_file_empty
145
158
  cov.span("#{decimal_f(percentage)}%", :class => class_for_coverage_percentage(percentage)) unless is_file_empty
159
+ cov.span(" Branches: ") unless is_file_empty
160
+ cov.span("#{decimal_f(branch_percentage)}%", :class => class_for_coverage_percentage(branch_percentage)) unless is_file_empty
146
161
  }
147
162
 
148
163
  cov.h4("(#{coverage_file.num_lines_tested} of #{coverage_file.num_lines_testable} relevant lines covered)", :class => "cov_subtitle")
@@ -157,8 +172,9 @@ module Slather
157
172
 
158
173
  cov.table(:class => "source_code") {
159
174
  cleaned_gcov_lines.each do |line|
160
-
161
175
  line_number = coverage_file.line_number_in_line(line)
176
+ missed_regions = coverage_file.branch_region_data[line_number]
177
+ hits = coverage_file.coverage_for_line(line)
162
178
  next unless line_number > 0
163
179
 
164
180
  line_source = line.split(line_number_separator, 3)[2]
@@ -171,7 +187,30 @@ module Slather
171
187
  cov.td(line, :class => classes[idx])
172
188
  else
173
189
  cov.td(:class => classes[idx]) {
174
- cov.pre { cov.code(line, :class => "objc") }
190
+ cov.pre {
191
+ # If the line has coverage and missed regions, split up
192
+ # the line to show regions that weren't covered
193
+ if missed_regions != nil && hits != nil && hits > 0
194
+ regions = missed_regions.map do |region|
195
+ region_start, region_length = region
196
+ if region_length != nil
197
+ line[region_start, region_length]
198
+ else
199
+ line[region_start, line.length - region_start]
200
+ end
201
+ end
202
+ current_line = line
203
+ regions.each do |region|
204
+ covered, remainder = current_line.split(region)
205
+ cov.code(covered, :class => "objc")
206
+ cov.code(region, :class => "objc missed")
207
+ current_line = remainder
208
+ end
209
+ cov.code(current_line, :class => "objc")
210
+ else
211
+ cov.code(line, :class => "objc")
212
+ end
213
+ }
175
214
  }
176
215
  end
177
216
  }
@@ -8,7 +8,7 @@ module Slather
8
8
  include CoverageInfo
9
9
  include CoverallsCoverage
10
10
 
11
- attr_accessor :project, :source, :line_numbers_first, :line_data
11
+ attr_accessor :project, :source, :segments, :line_numbers_first, :line_data
12
12
 
13
13
  def initialize(project, source, line_numbers_first)
14
14
  self.project = project
@@ -188,7 +188,47 @@ module Slather
188
188
 
189
189
  def branch_coverage_data
190
190
  @branch_coverage_data ||= begin
191
- Hash.new
191
+ branch_coverage_data = Hash.new
192
+
193
+ self.segments.each do |segment|
194
+ line, col, hits, has_count, *rest = segment
195
+ next if !has_count
196
+ if branch_coverage_data.key?(line)
197
+ branch_coverage_data[line] = branch_coverage_data[line] + [hits]
198
+ else
199
+ branch_coverage_data[line] = [hits]
200
+ end
201
+ end
202
+
203
+ branch_coverage_data
204
+ end
205
+ end
206
+
207
+ def branch_region_data
208
+ @branch_region_data ||= begin
209
+ branch_region_data = Hash.new
210
+ region_start = nil
211
+ current_line = 0
212
+ @segments ||= []
213
+ @segments.each do |segment|
214
+ line, col, hits, has_count, *rest = segment
215
+ # Make column 0 based index
216
+ col = col - 1
217
+ if hits == 0 && has_count
218
+ current_line = line
219
+ region_start = col
220
+ elsif region_start != nil && hits > 0 && has_count
221
+ # if the region wrapped to a new line before ending, put nil to indicate it didnt end on this line
222
+ region_end = line == current_line ? col - region_start : nil
223
+ if branch_region_data.key?(current_line)
224
+ branch_region_data[current_line] = branch_region_data[current_line] + [region_start, region_end]
225
+ else
226
+ branch_region_data[current_line] = [[region_start, region_end]]
227
+ end
228
+ region_start = nil
229
+ end
230
+ end
231
+ branch_region_data
192
232
  end
193
233
  end
194
234
 
@@ -135,7 +135,7 @@ module Slather
135
135
  coverage_json = JSON.parse(coverage_json_string)
136
136
  coverage_json["data"].reduce([]) do |result, chunk|
137
137
  result.concat(chunk["files"].map do |file|
138
- Pathname(file["filename"]).realpath
138
+ {"filename" => Pathname(file["filename"]).realpath, "segments" => file["segments"]}
139
139
  end)
140
140
  end
141
141
  end
@@ -162,13 +162,24 @@ module Slather
162
162
  end
163
163
  private :create_coverage_files_for_binary
164
164
 
165
- def create_coverage_files(binary_path, pathnames)
165
+ def create_coverage_files(binary_path, path_objects)
166
166
  line_numbers_first = Gem::Version.new(self.llvm_version) >= Gem::Version.new('8.1.0')
167
+ # get just file names from the path objects
168
+ pathnames = path_objects.map { |path_obj| path_obj["filename"] }.compact
169
+ # Map of path name => segment array
170
+ paths_to_segments = path_objects.reduce(Hash.new) do |hash, path_obj|
171
+ hash[path_obj["filename"]] = path_obj["segments"]
172
+ hash
173
+ end
167
174
  files = create_profdata(binary_path, pathnames)
168
175
  files.map do |source|
169
176
  coverage_file = coverage_file_class.new(self, source, line_numbers_first)
170
177
  # If a single source file is used, the resulting output does not contain the file name.
171
178
  coverage_file.source_file_pathname = pathnames.first if pathnames.count == 1
179
+ # if there is segment data for the given path, add it to the coverage_file
180
+ if paths_to_segments.key?(coverage_file.source_file_pathname)
181
+ coverage_file.segments = paths_to_segments[coverage_file.source_file_pathname]
182
+ end
172
183
  !coverage_file.ignored? ? coverage_file : nil
173
184
  end.compact
174
185
  end
@@ -277,7 +288,10 @@ module Slather
277
288
  if self.arch
278
289
  llvm_cov_args << "--arch" << self.arch
279
290
  end
280
- `xcrun llvm-cov #{llvm_cov_args.shelljoin} #{source_files.shelljoin}`
291
+
292
+ # POSIX systems have an ARG_MAX for the maximum total length of the command line, so the command may fail with an error message of "Argument list too long".
293
+ # Using the xargs command we can break the list of source_files into sublists small enough to be acceptable.
294
+ `printf '%s\\0' #{source_files.shelljoin} | xargs -0 xcrun llvm-cov #{llvm_cov_args.shelljoin}`
281
295
  end
282
296
  private :unsafe_profdata_llvm_cov_output
283
297
 
@@ -1,3 +1,3 @@
1
1
  module Slather
2
- VERSION = '2.6.0' unless defined?(Slather::VERSION)
2
+ VERSION = '2.7.0' unless defined?(Slather::VERSION)
3
3
  end
data/slather.gemspec CHANGED
@@ -29,7 +29,7 @@ Gem::Specification.new do |spec|
29
29
 
30
30
  spec.add_dependency 'clamp', '~> 1.3'
31
31
  spec.add_dependency 'xcodeproj', '~> 1.7'
32
- spec.add_dependency 'nokogiri', '~> 1.8'
32
+ spec.add_dependency 'nokogiri', '~> 1.11'
33
33
  spec.add_dependency 'CFPropertyList', '>= 2.2', '< 4'
34
34
 
35
35
  spec.add_runtime_dependency 'activesupport'
@@ -1,58 +1,134 @@
1
1
  <?xml version="1.0"?>
2
2
  <!DOCTYPE coverage SYSTEM "http://cobertura.sourceforge.net/xml/coverage-04.dtd">
3
- <coverage line-rate="0.7500000000000000" branch-rate="1.0000000000000000" lines-covered="60" lines-valid="80" branches-covered="0" branches-valid="0" complexity="0.0" timestamp="1460926354" version="Slather 2.1.0">
3
+ <coverage line-rate="0.7500000000000000" branch-rate="0.6410256410256411" lines-covered="60" lines-valid="80" branches-covered="25" branches-valid="39" complexity="0.0" timestamp="1614041230" version="Slather 2.6.1">
4
4
  <sources>
5
- <source>/Users/civetta/Works/Personal/slather/viteinfinite-slather</source>
5
+ <source>/Users/hborawski/sandbox/slather</source>
6
6
  </sources>
7
7
  <packages>
8
- <package name="spec.fixtures.fixtures" line-rate="0.5000000000000000" branch-rate="1.0000000000000000" complexity="0.0">
8
+ <package name="spec.fixtures.fixtures" line-rate="0.5000000000000000" branch-rate="0.5000000000000000" complexity="0.0">
9
9
  <classes>
10
- <class name="fixtures.m" filename="spec/fixtures/fixtures/fixtures.m" line-rate="0.5000000000000000" branch-rate="1.0000000000000000" complexity="0.0">
10
+ <class name="fixtures.m" filename="spec/fixtures/fixtures/fixtures.m" line-rate="0.5000000000000000" branch-rate="0.5000000000000000" complexity="0.0">
11
11
  <methods/>
12
12
  <lines>
13
- <line number="14" branch="false" hits="1"/>
13
+ <line number="14" branch="true" hits="1" condition-coverage="100% (1/1)">
14
+ <conditions>
15
+ <condition number="0" type="jump" coverage="100%"/>
16
+ </conditions>
17
+ </line>
14
18
  <line number="15" branch="false" hits="1"/>
15
19
  <line number="16" branch="false" hits="1"/>
16
- <line number="19" branch="false" hits="0"/>
20
+ <line number="19" branch="true" hits="0" condition-coverage="0% (0/1)">
21
+ <conditions>
22
+ <condition number="0" type="jump" coverage="0%"/>
23
+ </conditions>
24
+ </line>
17
25
  <line number="20" branch="false" hits="0"/>
18
26
  <line number="21" branch="false" hits="0"/>
19
27
  </lines>
20
28
  </class>
21
29
  </classes>
22
30
  </package>
23
- <package name="spec.fixtures.fixtures.more_files" line-rate="0.4333333333333333" branch-rate="1.0000000000000000" complexity="0.0">
31
+ <package name="spec.fixtures.fixtures.more_files" line-rate="0.4333333333333333" branch-rate="0.5000000000000000" complexity="0.0">
24
32
  <classes>
25
- <class name="Branches.m" filename="spec/fixtures/fixtures/more_files/Branches.m" line-rate="0.4333333333333333" branch-rate="1.0000000000000000" complexity="0.0">
33
+ <class name="Branches.m" filename="spec/fixtures/fixtures/more_files/Branches.m" line-rate="0.4333333333333333" branch-rate="0.5000000000000000" complexity="0.0">
26
34
  <methods/>
27
35
  <lines>
28
- <line number="14" branch="false" hits="2"/>
29
- <line number="15" branch="false" hits="2"/>
36
+ <line number="14" branch="true" hits="2" condition-coverage="100% (1/1)">
37
+ <conditions>
38
+ <condition number="0" type="jump" coverage="100%"/>
39
+ </conditions>
40
+ </line>
41
+ <line number="15" branch="true" hits="2" condition-coverage="100% (4/4)">
42
+ <conditions>
43
+ <condition number="0" type="jump" coverage="100%"/>
44
+ </conditions>
45
+ </line>
30
46
  <line number="16" branch="false" hits="1"/>
31
47
  <line number="17" branch="false" hits="1"/>
32
- <line number="18" branch="false" hits="1"/>
48
+ <line number="18" branch="true" hits="1" condition-coverage="50% (2/4)">
49
+ <conditions>
50
+ <condition number="0" type="jump" coverage="50%"/>
51
+ </conditions>
52
+ </line>
33
53
  <line number="19" branch="false" hits="0"/>
34
- <line number="20" branch="false" hits="0"/>
35
- <line number="21" branch="false" hits="1"/>
54
+ <line number="20" branch="true" hits="0" condition-coverage="100% (1/1)">
55
+ <conditions>
56
+ <condition number="0" type="jump" coverage="100%"/>
57
+ </conditions>
58
+ </line>
59
+ <line number="21" branch="true" hits="1" condition-coverage="100% (1/1)">
60
+ <conditions>
61
+ <condition number="0" type="jump" coverage="100%"/>
62
+ </conditions>
63
+ </line>
36
64
  <line number="22" branch="false" hits="1"/>
37
- <line number="23" branch="false" hits="1"/>
65
+ <line number="23" branch="true" hits="1" condition-coverage="100% (1/1)">
66
+ <conditions>
67
+ <condition number="0" type="jump" coverage="100%"/>
68
+ </conditions>
69
+ </line>
38
70
  <line number="24" branch="false" hits="2"/>
39
71
  <line number="25" branch="false" hits="2"/>
40
- <line number="26" branch="false" hits="2"/>
72
+ <line number="26" branch="true" hits="2" condition-coverage="100% (3/3)">
73
+ <conditions>
74
+ <condition number="0" type="jump" coverage="100%"/>
75
+ </conditions>
76
+ </line>
41
77
  <line number="27" branch="false" hits="2"/>
42
- <line number="28" branch="false" hits="2"/>
43
- <line number="29" branch="false" hits="0"/>
44
- <line number="30" branch="false" hits="0"/>
78
+ <line number="28" branch="true" hits="2" condition-coverage="0% (0/1)">
79
+ <conditions>
80
+ <condition number="0" type="jump" coverage="0%"/>
81
+ </conditions>
82
+ </line>
83
+ <line number="29" branch="true" hits="0" condition-coverage="0% (0/2)">
84
+ <conditions>
85
+ <condition number="0" type="jump" coverage="0%"/>
86
+ </conditions>
87
+ </line>
88
+ <line number="30" branch="true" hits="0" condition-coverage="0% (0/1)">
89
+ <conditions>
90
+ <condition number="0" type="jump" coverage="0%"/>
91
+ </conditions>
92
+ </line>
45
93
  <line number="31" branch="false" hits="0"/>
46
- <line number="32" branch="false" hits="0"/>
94
+ <line number="32" branch="true" hits="0" condition-coverage="0% (0/1)">
95
+ <conditions>
96
+ <condition number="0" type="jump" coverage="0%"/>
97
+ </conditions>
98
+ </line>
47
99
  <line number="33" branch="false" hits="0"/>
48
- <line number="34" branch="false" hits="0"/>
100
+ <line number="34" branch="true" hits="0" condition-coverage="0% (0/1)">
101
+ <conditions>
102
+ <condition number="0" type="jump" coverage="0%"/>
103
+ </conditions>
104
+ </line>
49
105
  <line number="35" branch="false" hits="0"/>
50
- <line number="36" branch="false" hits="0"/>
51
- <line number="37" branch="false" hits="0"/>
106
+ <line number="36" branch="true" hits="0" condition-coverage="0% (0/1)">
107
+ <conditions>
108
+ <condition number="0" type="jump" coverage="0%"/>
109
+ </conditions>
110
+ </line>
111
+ <line number="37" branch="true" hits="0" condition-coverage="0% (0/1)">
112
+ <conditions>
113
+ <condition number="0" type="jump" coverage="0%"/>
114
+ </conditions>
115
+ </line>
52
116
  <line number="38" branch="false" hits="0"/>
53
- <line number="39" branch="false" hits="0"/>
54
- <line number="40" branch="false" hits="0"/>
55
- <line number="41" branch="false" hits="0"/>
117
+ <line number="39" branch="true" hits="0" condition-coverage="0% (0/1)">
118
+ <conditions>
119
+ <condition number="0" type="jump" coverage="0%"/>
120
+ </conditions>
121
+ </line>
122
+ <line number="40" branch="true" hits="0" condition-coverage="0% (0/1)">
123
+ <conditions>
124
+ <condition number="0" type="jump" coverage="0%"/>
125
+ </conditions>
126
+ </line>
127
+ <line number="41" branch="true" hits="0" condition-coverage="0% (0/1)">
128
+ <conditions>
129
+ <condition number="0" type="jump" coverage="0%"/>
130
+ </conditions>
131
+ </line>
56
132
  <line number="42" branch="false" hits="0"/>
57
133
  <line number="43" branch="false" hits="0"/>
58
134
  </lines>
@@ -64,19 +140,35 @@
64
140
  <class name="BranchesTests.m" filename="spec/fixtures/fixturesTests/BranchesTests.m" line-rate="1.0000000000000000" branch-rate="1.0000000000000000" complexity="0.0">
65
141
  <methods/>
66
142
  <lines>
67
- <line number="18" branch="false" hits="2"/>
143
+ <line number="18" branch="true" hits="2" condition-coverage="100% (1/1)">
144
+ <conditions>
145
+ <condition number="0" type="jump" coverage="100%"/>
146
+ </conditions>
147
+ </line>
68
148
  <line number="19" branch="false" hits="2"/>
69
149
  <line number="20" branch="false" hits="2"/>
70
150
  <line number="21" branch="false" hits="2"/>
71
- <line number="23" branch="false" hits="2"/>
151
+ <line number="23" branch="true" hits="2" condition-coverage="100% (1/1)">
152
+ <conditions>
153
+ <condition number="0" type="jump" coverage="100%"/>
154
+ </conditions>
155
+ </line>
72
156
  <line number="24" branch="false" hits="2"/>
73
157
  <line number="25" branch="false" hits="2"/>
74
158
  <line number="26" branch="false" hits="2"/>
75
- <line number="28" branch="false" hits="1"/>
159
+ <line number="28" branch="true" hits="1" condition-coverage="100% (1/1)">
160
+ <conditions>
161
+ <condition number="0" type="jump" coverage="100%"/>
162
+ </conditions>
163
+ </line>
76
164
  <line number="29" branch="false" hits="1"/>
77
165
  <line number="30" branch="false" hits="1"/>
78
166
  <line number="31" branch="false" hits="1"/>
79
- <line number="33" branch="false" hits="1"/>
167
+ <line number="33" branch="true" hits="1" condition-coverage="100% (1/1)">
168
+ <conditions>
169
+ <condition number="0" type="jump" coverage="100%"/>
170
+ </conditions>
171
+ </line>
80
172
  <line number="34" branch="false" hits="1"/>
81
173
  <line number="35" branch="false" hits="1"/>
82
174
  <line number="36" branch="false" hits="1"/>
@@ -85,37 +177,65 @@
85
177
  <class name="fixturesTests.m" filename="spec/fixtures/fixturesTests/fixturesTests.m" line-rate="1.0000000000000000" branch-rate="1.0000000000000000" complexity="0.0">
86
178
  <methods/>
87
179
  <lines>
88
- <line number="20" branch="false" hits="2"/>
180
+ <line number="20" branch="true" hits="2" condition-coverage="100% (1/1)">
181
+ <conditions>
182
+ <condition number="0" type="jump" coverage="100%"/>
183
+ </conditions>
184
+ </line>
89
185
  <line number="21" branch="false" hits="2"/>
90
186
  <line number="22" branch="false" hits="2"/>
91
187
  <line number="23" branch="false" hits="2"/>
92
- <line number="26" branch="false" hits="2"/>
188
+ <line number="26" branch="true" hits="2" condition-coverage="100% (1/1)">
189
+ <conditions>
190
+ <condition number="0" type="jump" coverage="100%"/>
191
+ </conditions>
192
+ </line>
93
193
  <line number="27" branch="false" hits="2"/>
94
194
  <line number="28" branch="false" hits="2"/>
95
195
  <line number="29" branch="false" hits="2"/>
96
- <line number="32" branch="false" hits="1"/>
196
+ <line number="32" branch="true" hits="1" condition-coverage="100% (1/1)">
197
+ <conditions>
198
+ <condition number="0" type="jump" coverage="100%"/>
199
+ </conditions>
200
+ </line>
97
201
  <line number="33" branch="false" hits="1"/>
98
202
  <line number="34" branch="false" hits="1"/>
99
203
  <line number="35" branch="false" hits="1"/>
100
- <line number="38" branch="false" hits="1"/>
204
+ <line number="38" branch="true" hits="1" condition-coverage="100% (1/1)">
205
+ <conditions>
206
+ <condition number="0" type="jump" coverage="100%"/>
207
+ </conditions>
208
+ </line>
101
209
  <line number="39" branch="false" hits="1"/>
102
210
  <line number="40" branch="false" hits="1"/>
103
211
  <line number="41" branch="false" hits="1"/>
104
212
  <line number="42" branch="false" hits="1"/>
105
213
  </lines>
106
214
  </class>
107
- <class name="peekaviewTests💣.m" filename="spec/fixtures/fixturesTests/peekaviewTests💣.m" line-rate="1.0000000000000000" branch-rate="1.0000000000000000" complexity="0.0">
215
+ <class name="peekaviewTests&#x1F4A3;.m" filename="spec/fixtures/fixturesTests/peekaviewTests&#x1F4A3;.m" line-rate="1.0000000000000000" branch-rate="1.0000000000000000" complexity="0.0">
108
216
  <methods/>
109
217
  <lines>
110
- <line number="18" branch="false" hits="1"/>
218
+ <line number="18" branch="true" hits="1" condition-coverage="100% (1/1)">
219
+ <conditions>
220
+ <condition number="0" type="jump" coverage="100%"/>
221
+ </conditions>
222
+ </line>
111
223
  <line number="19" branch="false" hits="1"/>
112
224
  <line number="20" branch="false" hits="1"/>
113
225
  <line number="21" branch="false" hits="1"/>
114
- <line number="24" branch="false" hits="1"/>
226
+ <line number="24" branch="true" hits="1" condition-coverage="100% (1/1)">
227
+ <conditions>
228
+ <condition number="0" type="jump" coverage="100%"/>
229
+ </conditions>
230
+ </line>
115
231
  <line number="25" branch="false" hits="1"/>
116
232
  <line number="26" branch="false" hits="1"/>
117
233
  <line number="27" branch="false" hits="1"/>
118
- <line number="30" branch="false" hits="1"/>
234
+ <line number="30" branch="true" hits="1" condition-coverage="100% (1/1)">
235
+ <conditions>
236
+ <condition number="0" type="jump" coverage="100%"/>
237
+ </conditions>
238
+ </line>
119
239
  <line number="31" branch="false" hits="1"/>
120
240
  <line number="32" branch="false" hits="1"/>
121
241
  </lines>
@@ -185,8 +185,8 @@ describe Slather::CoverageService::HtmlOutput do
185
185
  end
186
186
 
187
187
  allow(fixtures_project).to receive(:input_format).and_return("profdata")
188
- allow(fixtures_project).to receive(:profdata_llvm_cov_output).and_return("./spec/fixtures/fixtures/other_fixtures.m:
189
- 1| |//
188
+ allow(fixtures_project).to receive(:pathnames_per_binary).and_return([{"filename" => Pathname.new("./spec/fixtures/fixtures/other_fixtures.m"), "segments" => []}])
189
+ allow(fixtures_project).to receive(:profdata_llvm_cov_output).and_return("1| |//
190
190
  2| |// other_fixtures.m
191
191
  3| |// fixtures
192
192
  4| |//
@@ -157,6 +157,18 @@ describe Slather::ProfdataCoverageFile do
157
157
  end
158
158
  end
159
159
 
160
+ describe "#branch_coverage_data" do
161
+ it "should have branch data for line 19" do
162
+ # these segments correspond to the only statement on line 19
163
+ profdata_coverage_file.segments = [[19, 9, 0, true, false], [19, 20, 1, true, false]]
164
+ expect(profdata_coverage_file.branch_coverage_data[19]).to eq([0,1])
165
+ end
166
+ it "should have missing region data for line 19" do
167
+ profdata_coverage_file.segments = [[19, 9, 0, true, false], [19, 20, 1, true, false]]
168
+ expect(profdata_coverage_file.branch_region_data[19]).to eq([[8,11]])
169
+ end
170
+ end
171
+
160
172
  describe "#ignored" do
161
173
 
162
174
  before(:each) {
@@ -664,10 +664,12 @@ describe Slather::Project do
664
664
  {
665
665
  "files":[
666
666
  {
667
- "filename":"spec/fixtures/fixtures/fixtures.m"
667
+ "filename":"spec/fixtures/fixtures/fixtures.m",
668
+ "segments": []
668
669
  },
669
670
  {
670
- "filename":"spec/fixtures/fixturesTwo/fixturesTwo.m"
671
+ "filename":"spec/fixtures/fixturesTwo/fixturesTwo.m",
672
+ "segments": []
671
673
  }
672
674
  ]
673
675
  }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slather
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.6.0
4
+ version: 2.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Larsen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-12-04 00:00:00.000000000 Z
11
+ date: 2021-03-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -170,14 +170,14 @@ dependencies:
170
170
  requirements:
171
171
  - - "~>"
172
172
  - !ruby/object:Gem::Version
173
- version: '1.8'
173
+ version: '1.11'
174
174
  type: :runtime
175
175
  prerelease: false
176
176
  version_requirements: !ruby/object:Gem::Requirement
177
177
  requirements:
178
178
  - - "~>"
179
179
  - !ruby/object:Gem::Version
180
- version: '1.8'
180
+ version: '1.11'
181
181
  - !ruby/object:Gem::Dependency
182
182
  name: CFPropertyList
183
183
  requirement: !ruby/object:Gem::Requirement