1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/test/-ext-/test_threadswitch_hook.rb
nobu f5cbe886b6 * eval.c (rb_add_threadswitch_hook): wrapper for unofficial APIs
in Mac OS X port.  the use of them is strongly discouraged.

	* eval.c (rb_remove_threadswitch_hook): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@29326 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-09-23 18:00:46 +00:00

16 lines
449 B
Ruby

require 'test/unit'
require '-test-/threadswitch/event_hook'
require 'ruby/envutil'
class Test_ThreadSwitch < Test::Unit::TestCase
def test_threadswitch_init
threads = []
warning = EnvUtil.verbose_warning {
EventHook::ThreadSwitch.hook {|name, thread|
threads << thread if name == "thread-init"
}
}
assert_match(/not an official API/, warning)
assert_operator(threads, :include?, Thread.current)
end
end