summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2021-02-28 15:04:13 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2021-02-28 15:04:13 +0000
commitf279c3a37602f57426d144d32c464caf1bd05227 (patch)
treef5853eb2e8b21e69050d56473f0746ad8648de03 /test
parent4be089c0dd720324730230c1abfe0c200d125359 (diff)
merge revision(s) 01b3a380: [Backport #11143][Backport #15932]
Fix wrong "void value expression" error * parse.y (value_expr_check): if either of then or else statements is not a void value expression, the whole if is not also a void value expression. [Bug #15932] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_6@67903 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_syntax.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/ruby/test_syntax.rb b/test/ruby/test_syntax.rb
index 4e403a9ffd..3e77f44efe 100644
--- a/test/ruby/test_syntax.rb
+++ b/test/ruby/test_syntax.rb
@@ -1306,6 +1306,12 @@ eom
assert_valid_syntax('obj::foo (1) {}')
end
+ def test_value_expr_in_condition
+ mesg = /void value expression/
+ assert_syntax_error("tap {a = (true ? next : break)}", mesg)
+ assert_valid_syntax("tap {a = (true ? true : break)}")
+ end
+
private
def not_label(x) @result = x; @not_label ||= nil end