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
This commit is contained in:
yui-knk 2017-10-23 13:25:59 +00:00
Родитель 3ee8e906b8
Коммит 8bbdbf9e75
1 изменённых файлов: 8 добавлений и 2 удалений

Просмотреть файл

@ -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