diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2019-11-28 13:44:25 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2019-11-28 13:47:14 +0900 |
commit | 8b4ee5d6ba92a385eedc9235ce0a2d5618deecf0 (patch) | |
tree | cc994e8656fe3fbbdb828eb3d0ce8842731ea49e /test | |
parent | 18953416def52824c46a68370c4b34f5b720ee3f (diff) |
Raise `NoMatchingPatternError` when expr `in` pat doesn't match
* `expr in pattern` should raise `NoMatchingError` when unmatched
* `expr in pattern` should return `nil`. (this is unspecified, but
this feature is experimental, at all)
[Feature #16355]
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_pattern_matching.rb | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/test/ruby/test_pattern_matching.rb b/test/ruby/test_pattern_matching.rb index 889f8dd519..50bab51bfa 100644 --- a/test/ruby/test_pattern_matching.rb +++ b/test/ruby/test_pattern_matching.rb @@ -1261,8 +1261,11 @@ END ################################################################ def test_modifier_in - assert_equal true, (1 in a) + assert_nil (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(%q{ 1 in a, b |