Bug #4379 » test_eval_location.patch
| test/ruby/test_eval.rb | ||
|---|---|---|
|
result = foo.instance_eval(&foo_pr)
|
||
|
assert_equal(1, result, 'Bug #3786, Bug #3860, [ruby-core:32501]')
|
||
|
end
|
||
|
def test_eval_backtrace
|
||
|
begin
|
||
|
eval("raise", binding, "(eval)", 9999)
|
||
|
rescue => e
|
||
|
assert_match /:9999:/, e.backtrace[0]
|
||
|
end
|
||
|
end
|
||
|
def test_eval_source_location
|
||
|
expected = ["(eval)", 9999]
|
||
|
source =
|
||
|
"class << Object.new ;" <<
|
||
|
"def f ; end ;" <<
|
||
|
"instance_method(:f).source_location ; end"
|
||
|
assert_equal expected, eval(source, binding, *expected)
|
||
|
end
|
||
|
end
|
||