summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authoryui-knk <yui-knk@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-10-23 13:25:59 +0000
committeryui-knk <yui-knk@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-10-23 13:25:59 +0000
commit8bbdbf9e75ecdfbc8bfaac4c5c2637332c0aa0bf (patch)
tree62bb9a9988d53939c4443323cc1a37b793c5bb6a /test
parent3ee8e906b82dcac0fc984971f61b5adcfbfa9017 (diff)
Add test cases for branch coverage
* test/coverage/test_coverage.rb (test_branch_coverage_for_while_statement): Add test cases for modifier while/until. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60382 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/coverage/test_coverage.rb10
1 files changed, 8 insertions, 2 deletions
diff --git a/test/coverage/test_coverage.rb b/test/coverage/test_coverage.rb
index d78c8a0711..432089216b 100644
--- a/test/coverage/test_coverage.rb
+++ b/test/coverage/test_coverage.rb
@@ -243,8 +243,10 @@ class TestCoverage < Test::Unit::TestCase
def test_branch_coverage_for_while_statement
result = {
:branches => {
- [:while, 0, 2, 0] => {[:body, 1, 3, 2]=> 3},
- [:until, 2, 5, 0] => {[:body, 3, 6, 2]=>10},
+ [:while, 0, 2, 0] => {[:body, 1, 3, 2]=> 3},
+ [:until, 2, 5, 0] => {[:body, 3, 6, 2]=>10},
+ [:while, 4, 10, 0] => {[:body, 5, 10, 0]=> 3},
+ [:until, 6, 11, 0] => {[:body, 7, 11, 0]=>10},
}
}
assert_coverage(<<~"end;", { branches: true }, result)
@@ -255,6 +257,10 @@ class TestCoverage < Test::Unit::TestCase
until x == 10
x += 1
end
+
+ y = 3
+ y -= 1 while y > 0
+ y += 1 until y == 10
end;
end