summaryrefslogtreecommitdiff
path: root/test/ripper/test_parser_events.rb
diff options
context:
space:
mode:
authorktsj <ktsj@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-04-17 06:48:03 +0000
committerktsj <ktsj@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-04-17 06:48:03 +0000
commit9738f96fcfe50b2a605e350bdd40bd7a85665f54 (patch)
treea8495fa0a315ef4015f01db4d158b74987d18277 /test/ripper/test_parser_events.rb
parentb077654a2c89485c086e77c337d30a11ff3781c3 (diff)
Introduce pattern matching [EXPERIMENTAL]
[ruby-core:87945] [Feature #14912] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67586 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ripper/test_parser_events.rb')
-rw-r--r--test/ripper/test_parser_events.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/ripper/test_parser_events.rb b/test/ripper/test_parser_events.rb
index be46ad917d..1d2c501c3b 100644
--- a/test/ripper/test_parser_events.rb
+++ b/test/ripper/test_parser_events.rb
@@ -1509,4 +1509,22 @@ class TestRipper::ParserEvents < Test::Unit::TestCase
assert_warn("") {fmt, = warn("\r;")}
assert_match(/encountered/, fmt)
end
+
+ def test_in
+ thru_in = false
+ parse('case 0; in 0; end', :on_in) {thru_in = true}
+ assert_equal true, thru_in
+ end
+
+ def test_aryptn
+ thru_aryptn = false
+ parse('case 0; in [0]; end', :on_aryptn) {thru_aryptn = true}
+ assert_equal true, thru_aryptn
+ end
+
+ def test_hshptn
+ thru_hshptn = false
+ parse('case 0; in {a:}; end', :on_hshptn) {thru_hshptn = true}
+ assert_equal true, thru_hshptn
+ end
end if ripper_test