From d1ef4fd08e60adcbcb4feeb55f767ff3d80b65a0 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Sat, 30 Nov 2019 00:15:29 +0900 Subject: Make single line pattern matching void expression Instead of returning `nil`, raise a syntax error if its value is used. [Feature #16355] --- test/ruby/test_pattern_matching.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test/ruby/test_pattern_matching.rb') diff --git a/test/ruby/test_pattern_matching.rb b/test/ruby/test_pattern_matching.rb index 50bab51bfa..5308ec3281 100644 --- a/test/ruby/test_pattern_matching.rb +++ b/test/ruby/test_pattern_matching.rb @@ -1261,12 +1261,12 @@ END ################################################################ def test_modifier_in - assert_nil (1 in a) + 1 in a assert_equal 1, a assert_raise(NoMatchingPatternError) do {a: 1} in {a: 0} end - assert_valid_syntax "p(({} in {a:}), a:\n 1)" + assert_syntax_error("if {} in {a:}; end", /void value expression/) assert_syntax_error(%q{ 1 in a, b }, /unexpected/, '[ruby-core:95098]') -- cgit v1.2.3