From 4bf84ede2013a69dba2b89080211e9aa59a533d5 Mon Sep 17 00:00:00 2001 From: nobu Date: Fri, 9 Nov 2018 13:39:36 +0000 Subject: Get rid of setting SCRIPT_LINES__ by AST.parse git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65647 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_ast.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'test/ruby') diff --git a/test/ruby/test_ast.rb b/test/ruby/test_ast.rb index e8b25fd7d6..05f4211cba 100644 --- a/test/ruby/test_ast.rb +++ b/test/ruby/test_ast.rb @@ -180,6 +180,20 @@ class TestAst < Test::Unit::TestCase assert_instance_of(RubyVM::AbstractSyntaxTree::Node, node_proc) assert_instance_of(RubyVM::AbstractSyntaxTree::Node, node_method) assert_raise(TypeError) { RubyVM::AbstractSyntaxTree.of("1 + 2") } + + Tempfile.create(%w"test_of .rb") do |tmp| + tmp.print "#{<<-"begin;"}\n#{<<-'end;'}" + begin; + SCRIPT_LINES__ = {} + assert_instance_of(RubyVM::AbstractSyntaxTree::Node, RubyVM::AbstractSyntaxTree.of(proc {|x| x})) + end; + tmp.close + assert_separately(["-", tmp.path], "#{<<~"begin;"}\n#{<<~'end;'}") + begin; + load ARGV[0] + assert_empty(SCRIPT_LINES__) + end; + end end def test_scope_local_variables -- cgit v1.2.3