summaryrefslogtreecommitdiff
path: root/test/ruby/test_ast.rb
diff options
context:
space:
mode:
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 974dfb77fb..7809be0994 100644
--- a/test/ruby/test_ast.rb
+++ b/test/ruby/test_ast.rb
@@ -278,4 +278,16 @@ class TestAst < Test::Unit::TestCase
assert_equal(:LIT, body.type)
assert_equal([1], body.children)
end
+
+ def test_while
+ node = RubyVM::AbstractSyntaxTree.parse('1 while 1')
+ _, _, body = *node.children
+ assert_equal(:WHILE, body.type)
+ type1 = body.children[2]
+ node = RubyVM::AbstractSyntaxTree.parse('begin 1 end while 1')
+ _, _, body = *node.children
+ assert_equal(:WHILE, body.type)
+ type2 = body.children[2]
+ assert_not_equal(type1, type2)
+ end
end