ruby-changes:48267
From: yui-knk <ko1@a...>
Date: Mon, 23 Oct 2017 22:26:05 +0900 (JST)
Subject: [ruby-changes:48267] yui-knk:r60382 (trunk): Add test cases for branch coverage
yui-knk 2017-10-23 22:25:59 +0900 (Mon, 23 Oct 2017) New Revision: 60382 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=60382 Log: Add test cases for branch coverage * test/coverage/test_coverage.rb (test_branch_coverage_for_while_statement): Add test cases for modifier while/until. Modified files: trunk/test/coverage/test_coverage.rb Index: test/coverage/test_coverage.rb =================================================================== --- test/coverage/test_coverage.rb (revision 60381) +++ test/coverage/test_coverage.rb (revision 60382) @@ -243,8 +243,10 @@ class TestCoverage < Test::Unit::TestCas https://github.com/ruby/ruby/blob/trunk/test/coverage/test_coverage.rb#L243 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::TestCas https://github.com/ruby/ruby/blob/trunk/test/coverage/test_coverage.rb#L257 until x == 10 x += 1 end + + y = 3 + y -= 1 while y > 0 + y += 1 until y == 10 end; end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/