summaryrefslogtreecommitdiff
path: root/test/test_pp.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-12-03 00:24:38 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-12-03 00:24:38 +0000
commit87e1dd2982dd472de557f62468d77211c8a71bff (patch)
tree1eb0da500430c977a9d0f8222c641faa41c5d80d /test/test_pp.rb
parentb56e266d6450e21575edf3af355c9723faa0ba97 (diff)
Add RubyVM::AST#pretty_print
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66140 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/test_pp.rb')
-rw-r--r--test/test_pp.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/test_pp.rb b/test/test_pp.rb
index 5f8216d..01a5a40 100644
--- a/test/test_pp.rb
+++ b/test/test_pp.rb
@@ -194,4 +194,13 @@ class PPFileStatTest < Test::Unit::TestCase
end
end
+class PPAbstractSyntaxTree < Test::Unit::TestCase
+ AST = RubyVM::AbstractSyntaxTree
+ def test_literal
+ ast = AST.parse("1")
+ expected = "(SCOPE@1:0-1:1 tbl: [] args: nil body: (LIT@1:0-1:1 1))"
+ assert_equal(expected, PP.singleline_pp(ast, ''.dup))
+ end
+end
+
end