diff options
Diffstat (limited to 'test/ruby/test_eval.rb')
-rw-r--r-- | test/ruby/test_eval.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/ruby/test_eval.rb b/test/ruby/test_eval.rb index cba9ce42f8..abf65613b1 100644 --- a/test/ruby/test_eval.rb +++ b/test/ruby/test_eval.rb @@ -473,4 +473,16 @@ class TestEval < Test::Unit::TestCase fname = "\u{3042}".encode("euc-jp") assert_equal(fname, eval("__FILE__", nil, fname, 1)) end + + def test_eval_location_fstring + o = Object.new + o.instance_eval "def foo() end", "generated code" + o.instance_eval "def bar() end", "generated code" + + a, b = o.method(:foo).source_location[0], + o.method(:bar).source_location[0] + + assert_equal a.object_id, b.object_id, + "#{a.inspect}.object_id != #{b.inspect}.object_id" + end end |