summaryrefslogtreecommitdiff
path: root/test/ripper/test_parser_events.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-11-22 07:10:31 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-11-22 07:10:31 +0000
commitf5063b7ea7e774519602f7a112d9acf536a1da33 (patch)
treee8ae2d61cdb231f4b0f7590b8d66970f178806c5 /test/ripper/test_parser_events.rb
parentd551e813cacd693c4c47405c267f72211d450f57 (diff)
dummyparser.rb: on_rescue
* test/ripper/dummyparser.rb (on_rescue): add to turn exception class list into NodeList, to test exception class list. * test/ripper/test_parser_events.rb (test_rescue_class): add missing test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48537 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ripper/test_parser_events.rb')
-rw-r--r--test/ripper/test_parser_events.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/ripper/test_parser_events.rb b/test/ripper/test_parser_events.rb
index cab91b9..883684a 100644
--- a/test/ripper/test_parser_events.rb
+++ b/test/ripper/test_parser_events.rb
@@ -842,6 +842,14 @@ class TestRipper::ParserEvents < Test::Unit::TestCase
assert_match(/rescue\(,var_field\(e\),\[2\]\)/, parsed)
end
+ def test_rescue_class
+ thru_rescue = false
+ parsed = parse('begin; 1; rescue RuntimeError => e; 2; end', :on_rescue) {thru_rescue = true}
+ assert_equal true, thru_rescue
+ assert_match(/1.*rescue/, parsed)
+ assert_match(/rescue\(\[ref\(RuntimeError\)\],var_field\(e\),\[2\]\)/, parsed)
+ end
+
def test_rescue_mod
thru_rescue_mod = false
parsed = parse('1 rescue 2', :on_rescue_mod) {thru_rescue_mod = true}