diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-12-31 15:00:37 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-12-31 15:00:37 +0000 |
commit | 67c574736912003c377218153f9d3b9c0c96a17b (patch) | |
tree | 558aea841613b06f6913d1ab22942aecc531a317 /test/ruby/test_ast.rb | |
parent | 4a6f7633303f2d6eb5ec164dc656cf5d47531960 (diff) |
Method reference operator
Introduce the new operator for method reference, `.:`.
[Feature #12125] [Feature #13581]
[EXPERIMENTAL]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66667 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_ast.rb')
-rw-r--r-- | test/ruby/test_ast.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/test/ruby/test_ast.rb b/test/ruby/test_ast.rb index 055567d574..ed4bcb37c0 100644 --- a/test/ruby/test_ast.rb +++ b/test/ruby/test_ast.rb @@ -249,4 +249,13 @@ class TestAst < Test::Unit::TestCase assert_equal(:b, mid) assert_equal(:SCOPE, defn.type) end + + def test_methref + node = RubyVM::AbstractSyntaxTree.parse("obj.:foo") + _, _, body = *node.children + assert_equal(:METHREF, body.type) + recv, mid = body.children + assert_equal(:VCALL, recv.type) + assert_equal(:foo, mid) + end end |