summaryrefslogtreecommitdiff
path: root/sample/coverage.rb
diff options
context:
space:
mode:
Diffstat (limited to 'sample/coverage.rb')
-rw-r--r--sample/coverage.rb8
1 files changed, 5 insertions, 3 deletions
diff --git a/sample/coverage.rb b/sample/coverage.rb
index 3f45e9fc98..42ba89fd50 100644
--- a/sample/coverage.rb
+++ b/sample/coverage.rb
@@ -8,6 +8,7 @@ accum = !accum || accum == "" || !(%w(f n 0).include?(accum[0]))
pwd = Dir.pwd
at_exit do
+ exit_exc = $!
Dir.chdir(pwd) do
Coverage.result.each do |sfile, covs|
cfile = sfile + ext
@@ -16,7 +17,7 @@ at_exit do
File.writable?(f) || File.writable?(File.dirname(f))
end
unless writable[cfile]
- cfile = cfile.gsub(File.PATH_SEPARATOR, "#")
+ cfile = cfile.gsub(File::PATH_SEPARATOR, "#")
next unless writable[cfile]
end
@@ -37,7 +38,7 @@ at_exit do
end
cov
else
- p line
+ p line
warn("coverage file corrupted, ignoring: #{ cfile }")
break []
end
@@ -48,7 +49,7 @@ at_exit do
end
end
- open(cfile, "w") do |out|
+ File.open(cfile, "w") do |out|
covs.zip(sources, pcovs).each_with_index do |(cov, line, pcov), idx|
cov += pcov || 0 if cov
cov = (cov ? (cov == 0 ? "#####" : cov.to_s) : "-").rjust(9)
@@ -57,4 +58,5 @@ at_exit do
end
end
end
+ raise exit_exc if exit_exc
end