diff --git a/test/test_error_highlight.rb b/test/test_error_highlight.rb index d31e394..a3cc7aa 100644 --- a/test/test_error_highlight.rb +++ b/test/test_error_highlight.rb @@ -1207,4 +1207,21 @@ def exc.backtrace_locations = [] end end + def test_spoofed_filename + Tempfile.create(["error_highlight_test", ".rb"], binmode: true) do |tmp| + tmp << "module Dummy\nend\n" + tmp.close + + assert_error_message(NameError, <<~END) do + undefined local variable or method `foo' for "dummy":String + END + + "dummy".instance_eval do + eval <<-END, nil, tmp.path + foo + END + end + end + end + end end