rcov 0.9.4 → 0.9.5
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.
- data/lib/rcov/file_statistics.rb +23 -2
- data/lib/rcov/version.rb +1 -1
- metadata +1 -1
data/lib/rcov/file_statistics.rb
CHANGED
@@ -126,8 +126,7 @@ module Rcov
|
|
126
126
|
end
|
127
127
|
end
|
128
128
|
end
|
129
|
-
@lines[lineno] && !@is_begin_comment[lineno] &&
|
130
|
-
@lines[lineno] !~ /^\s*(#|$)/
|
129
|
+
@lines[lineno] && !@is_begin_comment[lineno] && @lines[lineno] !~ /^\s*(#|$)/
|
131
130
|
end
|
132
131
|
|
133
132
|
private
|
@@ -163,6 +162,20 @@ module Rcov
|
|
163
162
|
end
|
164
163
|
end
|
165
164
|
end
|
165
|
+
|
166
|
+
def is_nocov?(line)
|
167
|
+
line =~ /#:nocov:/
|
168
|
+
end
|
169
|
+
|
170
|
+
def mark_nocov_regions(nocov_line_numbers, coverage)
|
171
|
+
while nocov_line_numbers.size > 0
|
172
|
+
begin_line, end_line = nocov_line_numbers.shift, nocov_line_numbers.shift
|
173
|
+
next unless begin_line && end_line
|
174
|
+
(begin_line..end_line).each do |line_num|
|
175
|
+
coverage[line_num] ||= :inferred
|
176
|
+
end
|
177
|
+
end
|
178
|
+
end
|
166
179
|
|
167
180
|
def precompute_coverage(comments_run_by_default = true)
|
168
181
|
changed = false
|
@@ -175,7 +188,11 @@ module Rcov
|
|
175
188
|
@coverage[i] ||= :inferred
|
176
189
|
end
|
177
190
|
end
|
191
|
+
nocov_line_numbers = []
|
192
|
+
|
178
193
|
(0...lines.size).each do |i|
|
194
|
+
nocov_line_numbers << i if is_nocov?(@lines[i])
|
195
|
+
|
179
196
|
next if @coverage[i]
|
180
197
|
line = @lines[i]
|
181
198
|
if /^\s*(begin|ensure|else|case)\s*(?:#.*)?$/ =~ line && next_expr_marked?(i) or
|
@@ -190,7 +207,11 @@ module Rcov
|
|
190
207
|
@coverage[i] ||= :inferred
|
191
208
|
changed = true
|
192
209
|
end
|
210
|
+
|
193
211
|
end
|
212
|
+
|
213
|
+
mark_nocov_regions(nocov_line_numbers, @coverage)
|
214
|
+
|
194
215
|
(@lines.size-1).downto(0) do |i|
|
195
216
|
next if @coverage[i]
|
196
217
|
if !is_code?(i) and @coverage[i+1]
|
data/lib/rcov/version.rb
CHANGED