summaryrefslogtreecommitdiff
path: root/test/ruby/test_eval.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/ruby/test_eval.rb')
-rw-r--r--test/ruby/test_eval.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/ruby/test_eval.rb b/test/ruby/test_eval.rb
index 8900b4f165..9cb69ddc37 100644
--- a/test/ruby/test_eval.rb
+++ b/test/ruby/test_eval.rb
@@ -497,6 +497,17 @@ class TestEval < Test::Unit::TestCase
}, '[Bug #10368]'
end
+ def test_gced_eval_location
+ Dir.mktmpdir do |d|
+ File.write("#{d}/2.rb", "")
+ File.write("#{d}/1.rb", "require_relative '2'\n""__FILE__\n")
+ file = "1.rb"
+ path = File.expand_path(file, d)
+ assert_equal(path, eval(File.read(path), nil, File.expand_path(file, d)))
+ assert_equal(path, eval(File.read(path), nil, File.expand_path(file, d)))
+ end
+ end
+
def orphan_proc
proc {eval("return :ng")}
end