[rubygems/rubygems] Use a constant empty tar header to avoid extra allocations
[ruby.git] / test / win32ole / test_thread.rb
blobb30b2349c5f8aaef809903ccde5d3e26c1defcd4
1 # frozen_string_literal: false
2 begin
3   require 'win32ole'
4 rescue LoadError
5 end
6 require 'test/unit'
8 if defined?(WIN32OLE)
9   class TestWIN32OLE_THREAD < Test::Unit::TestCase
10     #
11     # test for Bug #2618(ruby-core:27634)
12     #
13     def assert_creating_win32ole_object_in_thread(meth)
14       t = Thread.__send__(meth) {
15         WIN32OLE.new('Scripting.Dictionary')
16       }
17       assert_nothing_raised(WIN32OLE::RuntimeError, "[Bug #2618] Thread.#{meth}") {
18         t.join
19       }
20     end
22     def test_creating_win32ole_object_in_thread_new
23       assert_creating_win32ole_object_in_thread(:new)
24     end
26     def test_creating_win32ole_object_in_thread_start
27       assert_creating_win32ole_object_in_thread(:start)
28     end
30     def test_creating_win32ole_object_in_thread_fork
31       assert_creating_win32ole_object_in_thread(:fork)
32     end
33   end
34 end