summaryrefslogtreecommitdiff
path: root/test/coverage/test_coverage.rb
diff options
context:
space:
mode:
authormame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-09-14 05:27:02 +0000
committermame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-09-14 05:27:02 +0000
commit3c8c17d30defb41399eed65f2cf0f30e5469fa07 (patch)
tree787002814cee9110d387332bca69770f62394e40 /test/coverage/test_coverage.rb
parent78cf46078e8de57c84807111938173afcb4bcf73 (diff)
Introduce NODE_UNLESS for branch coverage
`unless` statement was a syntactic sugar for `if` statement, which made the result of branch coverage hard to understand. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59889 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/coverage/test_coverage.rb')
-rw-r--r--test/coverage/test_coverage.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/test/coverage/test_coverage.rb b/test/coverage/test_coverage.rb
index 7f210c2..41a7e93 100644
--- a/test/coverage/test_coverage.rb
+++ b/test/coverage/test_coverage.rb
@@ -186,13 +186,19 @@ class TestCoverage < Test::Unit::TestCase
f.puts ' else'
f.puts ' 1'
f.puts ' end'
+ f.puts ''
+ f.puts ' unless x == 0'
+ f.puts ' 0'
+ f.puts ' else'
+ f.puts ' 1'
+ f.puts ' end'
f.puts 'end'
f.puts 'foo(0)'
f.puts 'foo(0)'
f.puts 'foo(1)'
end
- assert_in_out_err(%w[-W0 -rcoverage], <<-"end;", ["{:branches=>{[:if, 0, 2]=>{[:then, 1, 3]=>2, [:else, 2, 5]=>1}}}"], [])
+ assert_in_out_err(%w[-W0 -rcoverage], <<-"end;", ["{:branches=>{[:if, 0, 2]=>{[:then, 1, 3]=>2, [:else, 2, 5]=>1}, [:unless, 3, 8]=>{[:else, 4, 11]=>2, [:then, 5, 9]=>1}}}"], [])
ENV["COVERAGE_EXPERIMENTAL_MODE"] = "true"
Coverage.start(branches: true)
tmp = Dir.pwd