1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

add tests for script_compiled TP event.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66251 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
ko1 2018-12-06 13:53:48 +00:00
parent a352ee8961
commit 69914cd80f

View file

@ -2084,4 +2084,35 @@ class TestSetTraceFunc < Test::Unit::TestCase
end
assert_equal 'target_line is specified, but line event is not specified', e.message
end
def test_script_compiled
events = []
tp = TracePoint.new(:script_compiled){|tp|
next unless target_thread?
events << [tp.compiled_instruction_sequence.path,
tp.compiled_eval_script]
}
eval_script = 'a = 1'
tp.enable{
eval(eval_script, nil, __FILE__+"/eval")
nil.instance_eval(eval_script, __FILE__+"/instance_eval")
Object.class_eval(eval_script, __FILE__+"/class_eval")
}
assert_equal [[__FILE__+"/eval", eval_script],
[__FILE__+"/instance_eval", eval_script],
[__FILE__+"/class_eval", eval_script],
], events
events.clear
# TODO: test for requires
return
tp.enable{
require ''
require_relative ''
load ''
}
assert_equal [], events
end
end