summaryrefslogtreecommitdiff
path: root/test/-ext-/test_threadswitch_hook.rb
blob: 66eadd4f96e5756d2a7c9658ca3b9915f8ce5ac2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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