Use assert_separately instead of invoke_ruby

This commit is contained in:
Nobuyoshi Nakada 2019-06-28 15:25:12 +09:00
parent e0c4cb2ea1
commit 11571b0e95
No known key found for this signature in database
GPG Key ID: 4BC7D6DF58D8DF60

View File

@ -1903,16 +1903,19 @@ class TestSetTraceFunc < Test::Unit::TestCase
end
def test_lineno_in_optimized_insn
actual, _, _ = EnvUtil.invoke_ruby %W[-W0], <<-EOF.gsub(/^.*?: */, ""), true
1: class String
2: def -@
3: puts caller_locations(1, 1)[0].lineno
4: end
5: end
6:
7: -""
EOF
assert_equal "7\n", actual, '[Bug #14809]'
assert_separately([], "#{<<~"begin;"}\n#{<<~'end;'}")
begin;
$loc = nil
class String
undef -@
def -@
$loc = caller_locations(1, 1)[0].lineno
end
end
assert_predicate(-"", :frozen?)
assert_equal(__LINE__-1, $loc, '[Bug #14809]')
end;
end
def method_for_enable_target1