summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
-rw-r--r--test/ruby/test_backtrace.rb6
-rw-r--r--test/ruby/test_integer.rb23
-rw-r--r--test/ruby/test_settracefunc.rb18
3 files changed, 29 insertions, 18 deletions
@@ -215,15 +215,15 @@ class TestBacktrace < Test::Unit::TestCase
@res = caller_locations(2, 1).inspect
end
@line = __LINE__ + 1
- 1.times.map { 1.times.map { foo } }
- assert_equal("[\"#{__FILE__}:#{@line}:in `times'\"]", @res)
end
def test_caller_location_path_cfunc_iseq_no_pc
def self.foo
@res = caller_locations(2, 1)[0].path
end
- 1.times.map { 1.times.map { foo } }
assert_equal(__FILE__, @res)
end
@@ -321,23 +321,34 @@ class TestInteger < Test::Unit::TestCase
begin;
called = false
Integer.class_eval do
- alias old_plus +
- undef +
- define_method(:+){|x| called = true; 1}
alias old_lt <
undef <
define_method(:<){|x| called = true}
end
big = 2**65
big.times{break 0}
Integer.class_eval do
- undef +
- alias + old_plus
undef <
alias < old_lt
end
bug18377 = "[ruby-core:106361]"
- assert_equal(false, called, bug18377)
end;
end
@@ -504,7 +504,7 @@ class TestSetTraceFunc < Test::Unit::TestCase
1: trace = TracePoint.trace(*trace_events){|tp| next if !target_thread?
2: events << [tp.event, tp.lineno, tp.path, _defined_class.(tp), tp.method_id, tp.self, tp.binding&.eval("_local_var"), _get_data.(tp)] if tp.path == 'xyzzy'
3: }
- 4: 1.times{|;_local_var| _local_var = :inner
5: tap{}
6: }
7: class XYZZY
@@ -531,10 +531,10 @@ class TestSetTraceFunc < Test::Unit::TestCase
answer_events = [
#
[:line, 4, 'xyzzy', self.class, method, self, :outer, :nothing],
- [:c_call, 4, 'xyzzy', Integer, :times, 1, nil, :nothing],
[:line, 4, 'xyzzy', self.class, method, self, nil, :nothing],
[:line, 5, 'xyzzy', self.class, method, self, :inner, :nothing],
- [:c_return, 4, "xyzzy", Integer, :times, 1, nil, 1],
[:line, 7, 'xyzzy', self.class, method, self, :outer, :nothing],
[:c_call, 7, "xyzzy", Module, :const_added, TestSetTraceFunc, nil, :nothing],
[:c_return, 7, "xyzzy", Module, :const_added, TestSetTraceFunc, nil, nil],
@@ -639,7 +639,7 @@ CODE
1: set_trace_func(lambda{|event, file, line, id, binding, klass|
2: events << [event, line, file, klass, id, binding&.eval('self'), binding&.eval("_local_var")] if file == 'xyzzy'
3: })
- 4: 1.times{|;_local_var| _local_var = :inner
5: tap{}
6: }
7: class XYZZY
@@ -994,7 +994,7 @@ CODE
/return/ =~ tp.event ? tp.return_value : nil
]
}.enable{
- 1.times{
3
}
method_for_test_tracepoint_block{
@@ -1004,10 +1004,10 @@ CODE
# pp events
# expected_events =
[[:b_call, :test_tracepoint_block, TestSetTraceFunc, TestSetTraceFunc, nil],
- [:c_call, :times, Integer, Integer, nil],
[:b_call, :test_tracepoint_block, TestSetTraceFunc, TestSetTraceFunc, nil],
[:b_return, :test_tracepoint_block, TestSetTraceFunc, TestSetTraceFunc, 3],
- [:c_return, :times, Integer, Integer, 1],
[:call, :method_for_test_tracepoint_block, TestSetTraceFunc, TestSetTraceFunc, nil],
[:b_call, :test_tracepoint_block, TestSetTraceFunc, TestSetTraceFunc, nil],
[:b_return, :test_tracepoint_block, TestSetTraceFunc, TestSetTraceFunc, 4],
@@ -1310,7 +1310,7 @@ CODE
next if !target_thread?
events << tp.event
}.enable{
- 1.times{
3
}
method_for_test_tracepoint_block{
@@ -1332,7 +1332,7 @@ CODE
next if !target_thread?
events << tp.event
}.enable{
- 1.times{
3
}
method_for_test_tracepoint_block{