From 0c61c3b67b548ab73b54e795efc4bb1b7d8e19b9 Mon Sep 17 00:00:00 2001 From: nobu Date: Wed, 16 Jan 2013 09:45:48 +0000 Subject: win32ole.rb: use TracePoint * ext/win32ole/lib/win32ole.rb: use TracePoint to hook all thread creation not only by Thread.new and to get rid of interference with svar scope. [Bug #7681] [ruby-core:51365] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38848 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/win32ole/test_thread.rb | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) (limited to 'test') diff --git a/test/win32ole/test_thread.rb b/test/win32ole/test_thread.rb index 947d85af9e..56a6357932 100644 --- a/test/win32ole/test_thread.rb +++ b/test/win32ole/test_thread.rb @@ -9,12 +9,25 @@ if defined?(WIN32OLE) # # test for Bug #2618(ruby-core:27634) # - def test_creating_win32ole_object_in_thread - t = Thread.new do - dict = WIN32OLE.new('Scripting.Dictionary') - assert(true) - end - t.join + def assert_creating_win32ole_object_in_thread(meth) + t = Thread.__send__(meth) { + WIN32OLE.new('Scripting.Dictionary') + } + assert_nothing_raised(WIN32OLERuntimeError, "[Bug #2618] Thread.#{meth}") { + t.join + } + end + + def test_creating_win32ole_object_in_thread_new + assert_creating_win32ole_object_in_thread(:new) + end + + def test_creating_win32ole_object_in_thread_start + assert_creating_win32ole_object_in_thread(:start) + end + + def test_creating_win32ole_object_in_thread_fork + assert_creating_win32ole_object_in_thread(:fork) end end end -- cgit v1.2.3