aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2019-08-03 13:41:55 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2019-08-03 13:48:29 +0900
commit5931857281ce45c1c277aa86d1588119ab00a955 (patch)
tree3c2dc33435d53b602b7532e25e3ced7c0dde6dee /test
parent688a59f8ac984a2f1d4d53005dbe0679dcd59ac3 (diff)
downloadruby-5931857281ce45c1c277aa86d1588119ab00a955.tar.gz
Fix dangling path name from fstring
* parse.y (yycompile): make sure in advance that the `__FILE__` object shares a fstring, to get rid of dangling path name. Fixed up 53e9908d8afc7f03109b0aafd1698ab35f512b05. [Bug #16041] * vm_eval.c (eval_make_iseq): ditto.
Diffstat (limited to 'test')
-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 49bb3305e4..3d6116edbc 100644
--- a/test/ruby/test_eval.rb
+++ b/test/ruby/test_eval.rb
@@ -498,6 +498,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