summaryrefslogtreecommitdiff
path: root/test/coverage/test_coverage.rb
diff options
context:
space:
mode:
authorYusuke Endoh <mame@ruby-lang.org>2020-06-19 15:10:29 +0900
committerYusuke Endoh <mame@ruby-lang.org>2020-06-20 09:28:03 +0900
commita3c8ade1b34700f126abfea1480322ef36932d61 (patch)
tree1eede3676843bfb0a21b444365bf258a81c5aa09 /test/coverage/test_coverage.rb
parent50efa18c6cf102e070ba0f95edc01c72516495a3 (diff)
test/coverage/test_coverage.rb: Add a test for [Bug #16967]
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/3240
Diffstat (limited to 'test/coverage/test_coverage.rb')
-rw-r--r--test/coverage/test_coverage.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/coverage/test_coverage.rb b/test/coverage/test_coverage.rb
index 1de39bf..a80e333 100644
--- a/test/coverage/test_coverage.rb
+++ b/test/coverage/test_coverage.rb
@@ -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