Allow omission of parentheses in one line pattern matching [Feature #16182]

This commit is contained in:
Kazuki Tsujimoto 2021-08-19 17:03:17 +09:00
parent 00d66f7ec2
commit ecb6d6a4ef
No known key found for this signature in database
GPG key ID: BCEA306C49B81CD7
4 changed files with 27 additions and 10 deletions

View file

@ -1519,13 +1519,13 @@ END
assert_raise(NoMatchingPatternError) do
{a: 1} => {a: 0}
end
assert_syntax_error("if {} => {a:}; end", /void value expression/)
assert_syntax_error(%q{
1 => a, b
}, /unexpected/, '[ruby-core:95098]')
assert_syntax_error(%q{
1 => a:
}, /unexpected/, '[ruby-core:95098]')
[1, 2] => a, b
assert_equal 1, a
assert_equal 2, b
{a: 1} => a:
assert_equal 1, a
assert_equal true, (1 in 1)
assert_equal false, (1 in 2)