1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

test/coverage/test_coverage.rb: Add a test for [Bug #16967]

This commit is contained in:
Yusuke Endoh 2020-06-19 15:10:29 +09:00
parent 50efa18c6c
commit a3c8ade1b3
Notes: git 2020-06-20 09:28:28 +09:00

View file

@ -740,4 +740,24 @@ class TestCoverage < Test::Unit::TestCase
end
end;
end
def test_branch_coverage_in_ensure_clause
result = {
:branches => {
[:if, 0, 4, 2, 4, 11] => {
[:then, 1, 4, 2, 4, 5] => 1,
[:else, 2, 4, 2, 4, 11] => 1,
}
}
}
assert_coverage(<<~"end;", { branches: true }, result) # Bug #16967
def foo
yield
ensure
:ok if $!
end
foo {}
foo { raise } rescue nil
end;
end
end