summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_syntax.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/ruby/test_syntax.rb b/test/ruby/test_syntax.rb
index 5065a1db33..79e373ea66 100644
--- a/test/ruby/test_syntax.rb
+++ b/test/ruby/test_syntax.rb
@@ -2013,6 +2013,8 @@ eom
assert_equal(1, b.new.foo(1), bug21256)
end
+ BUG_21669 = '[Bug #21669]'
+
def test_value_expr_in_condition
mesg = /void value expression/
assert_syntax_error("tap {a = (true ? next : break)}", mesg)
@@ -2026,6 +2028,20 @@ eom
assert_syntax_error("class << (return); end", mesg)
end
+ def test_value_expr_in_rescue
+ assert_valid_syntax("#{<<~"{#"}\n#{<<~'};'}", "#{BUG_21669} 1.1")
+ {#
+ x = begin
+ raise
+ return
+ rescue
+ "OK"
+ else
+ return
+ end
+ };
+ end
+
def test_tautological_condition
assert_valid_syntax("def f() return if false and invalid; nil end")
assert_valid_syntax("def f() return unless true or invalid; nil end")