diff options
author | Yusuke Endoh <mame@ruby-lang.org> | 2022-07-11 14:53:12 +0900 |
---|---|---|
committer | Yusuke Endoh <mame@ruby-lang.org> | 2022-07-11 23:38:37 +0900 |
commit | a871fc4d86e857b4c580604d2654877135484896 (patch) | |
tree | 1a56b2f6ff0f108f13867ac0877de071991c6c50 /test/coverage | |
parent | 2733c049674298cbc2130689a0a40013f3458755 (diff) | |
download | ruby-a871fc4d86e857b4c580604d2654877135484896.tar.gz |
Fix a regression of b2e58b02aec73f9c350bf109c021c180fc699ccc
At that commit, I fixed a wrong conditional expression that was always
true. However, that seemed to have caused a regression. [Bug #18906]
This change removes the condition to make the code always enabled.
It had been enabled until that commit, albeit unintentionally, and even
if it is enabled it only consumes a tiny bit of memory, so I believe it
is harmless. [Bug #18906]
Diffstat (limited to 'test/coverage')
-rw-r--r-- | test/coverage/test_coverage.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/coverage/test_coverage.rb b/test/coverage/test_coverage.rb index 882368363a..eefe7e7da6 100644 --- a/test/coverage/test_coverage.rb +++ b/test/coverage/test_coverage.rb @@ -181,6 +181,27 @@ class TestCoverage < Test::Unit::TestCase end; end + def test_coverage_ensure_if_return + result = { + :branches => { + [:if, 0, 3, 1, 6, 4] => { + [:then, 1, 3, 6, 3, 6] => 0, + [:else, 2, 5, 3, 5, 9] => 1, + }, + }, + } + assert_coverage(<<~"end;", { branches: true }, result) + def flush + ensure + if $! + else + return + end + end + flush + end; + end + def assert_coverage(code, opt, stdout) stdout = [stdout] unless stdout.is_a?(Array) stdout = stdout.map {|s| s.to_s } |