1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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
This commit is contained in:
nobu 2018-11-09 13:39:36 +00:00
parent 49c7c8ed85
commit 4bf84ede20
3 changed files with 33 additions and 6 deletions

View file

@ -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