summaryrefslogtreecommitdiff
path: root/test/ruby/test_ast.rb
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-01-17 22:03:14 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-01-17 22:03:14 +0000
commitfb70fc4af2b4bfe221c70608998c7e9661dd84f3 (patch)
treeb78b74ac756f006dc9ccab7180e5c6ea3b8cdfc9 /test/ruby/test_ast.rb
parentfea28863729f7a28b3a2bd0269d92d1d0c9ea348 (diff)
merge revision(s) 66819: [Backport #15532]
ast.c: fix missing head part in dynamic literal git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_6@66851 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_ast.rb')
-rw-r--r--test/ruby/test_ast.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/ruby/test_ast.rb b/test/ruby/test_ast.rb
index 23cd5618a0..1a897ef502 100644
--- a/test/ruby/test_ast.rb
+++ b/test/ruby/test_ast.rb
@@ -257,4 +257,16 @@ class TestAst < Test::Unit::TestCase
assert_equal(:b, mid)
assert_equal(:SCOPE, defn.type)
end
+
+ def test_dstr
+ node = RubyVM::AbstractSyntaxTree.parse('"foo#{1}bar"')
+ _, _, body = *node.children
+ assert_equal(:DSTR, body.type)
+ head, body = body.children
+ assert_equal("foo", head)
+ assert_equal(:EVSTR, body.type)
+ body, = body.children
+ assert_equal(:LIT, body.type)
+ assert_equal([1], body.children)
+ end
end