зеркало из https://github.com/github/ruby.git
Wed Nov 17 23:47:30 2004 NAKAMURA, Hiroshi <nakahiro@sarion.co.jp>
* test/ruby/test_settracefunc.rb: added. [ruby-dev:24884] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7301 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
eabc1fc658
Коммит
e766a04a57
|
@ -1,3 +1,7 @@
|
|||
Wed Nov 17 23:47:30 2004 NAKAMURA, Hiroshi <nakahiro@sarion.co.jp>
|
||||
|
||||
* test/ruby/test_settracefunc.rb: added. [ruby-dev:24884]
|
||||
|
||||
Wed Nov 17 11:48:17 2004 Michael Neumann <mneumann@ruby-lang.org>
|
||||
|
||||
* lib/xmlrpc/parser.rb, test/xmlrpc/test_features.rb: fixed "assinging
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
require 'test/unit'
|
||||
|
||||
class TestSetTraceFunc < Test::Unit::TestCase
|
||||
def foo; end
|
||||
|
||||
def test_event
|
||||
events = []
|
||||
set_trace_func(Proc.new { |event, file, lineno|
|
||||
events << [event, lineno]
|
||||
})
|
||||
a = 1
|
||||
foo
|
||||
a
|
||||
set_trace_func nil
|
||||
|
||||
assert_equal(["line", 11], events.shift) # line "a = 1"
|
||||
assert_equal(["line", 12], events.shift) # line "foo"
|
||||
assert_equal(["call", 4], events.shift) # call foo
|
||||
event, lineno = events.shift # return
|
||||
assert_equal("return", event)
|
||||
assert_equal(4, lineno) # [history] it could not be expected in 1.8
|
||||
assert_equal(["line", 13], events.shift) # line "a"
|
||||
assert_equal(["line", 14], events.shift) # line "set_trace_func nil"
|
||||
assert_equal(["c-call", 14], events.shift) # c-call set_trace_func
|
||||
end
|
||||
end
|
Загрузка…
Ссылка в новой задаче