diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-10-26 03:55:08 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-10-26 03:55:08 +0000 |
commit | 603b000dd034c0ce52e2f8afd0e43c4969e609a4 (patch) | |
tree | cf689f14792809b0d2c4aba7814cf497b2c57e67 /test/ripper | |
parent | 42a0bf55c77b9331e77a0e1d428c8fd39fa6e951 (diff) | |
download | ruby-603b000dd034c0ce52e2f8afd0e43c4969e609a4.tar.gz |
parse.y: call_op2
* parse.y (call_op2): separate from call_op and also allow "::",
while dot_or_colon should not allow ".?". [Feature #11537]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52282 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ripper')
-rw-r--r-- | test/ripper/test_parser_events.rb | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/test/ripper/test_parser_events.rb b/test/ripper/test_parser_events.rb index 5ed17b6924..107fb6192f 100644 --- a/test/ripper/test_parser_events.rb +++ b/test/ripper/test_parser_events.rb @@ -389,6 +389,16 @@ class TestRipper::ParserEvents < Test::Unit::TestCase } assert_equal true, thru_call assert_equal "[call(vcall(foo),::,call,[])]", tree + + thru_call = false + tree = parse("self.?foo", :on_call) {thru_call = true} + assert_equal true, thru_call + assert_equal "[call(ref(self),.?,foo)]", tree + + thru_call = false + tree = parse("self.?foo()", :on_call) {thru_call = true} + assert_equal true, thru_call + assert_equal "[call(ref(self),.?,foo,[])]", tree end def test_excessed_comma @@ -554,8 +564,13 @@ class TestRipper::ParserEvents < Test::Unit::TestCase def test_defs thru_defs = false - parse('def foo.bar; end', :on_defs) {thru_defs = true} + tree = parse('def foo.bar; end', :on_defs) {thru_defs = true} assert_equal true, thru_defs + assert_equal("[defs(vcall(foo),.,bar,[],bodystmt([void()]))]", tree) + + thru_parse_error = false + tree = parse('def foo.?bar; end', :on_parse_error) {thru_parse_error = true} + assert_equal(true, thru_parse_error) end def test_do_block |