summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authornagachika <nagachika@ruby-lang.org>2024-08-18 11:18:49 +0900
committernagachika <nagachika@ruby-lang.org>2024-08-18 11:19:09 +0900
commit50399eebd96c76ce808ea4d84fe39693f585a531 (patch)
tree63e29994c4a473e2a1e97f441588ec5c7c967194 /test/ruby
parenta8a25291447e3630d455e82851ca58fc8ac372ec (diff)
merge revision(s) 1870505f478cc75993b296b7144a45137ace6937: [Backport #20651] [Backport #20571]
Fix wrong unreachable chunk remove when jump destination label is unremovable
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_iseq.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/ruby/test_iseq.rb b/test/ruby/test_iseq.rb
index 0b94bf993b..c1de8c96de 100644
--- a/test/ruby/test_iseq.rb
+++ b/test/ruby/test_iseq.rb
@@ -765,4 +765,20 @@ class TestISeq < Test::Unit::TestCase
assert_equal :new, r.take
RUBY
end
+
+ def test_unreachable_pattern_matching
+ assert_in_out_err([], "true or 1 in 1")
+ assert_in_out_err([], "true or (case 1; in 1; 1; in 2; 2; end)")
+ end
+
+ def test_unreachable_pattern_matching_in_if_condition
+ assert_in_out_err([], "#{<<~"begin;"}\n#{<<~'end;'}", %w[1])
+ begin;
+ if true or {a: 0} in {a:}
+ p 1
+ else
+ p a
+ end
+ end;
+ end
end