diff --git a/test/test_timeout.rb b/test/test_timeout.rb index 236883a..0a8dc45 100644 --- a/test/test_timeout.rb +++ b/test/test_timeout.rb @@ -4,6 +4,15 @@ class TestTimeout < Test::Unit::TestCase + def test_work_is_done_in_same_thread_as_caller + assert_equal Thread.current, Timeout.timeout(10){ Thread.current } + end + + def test_work_is_done_in_same_fiber_as_caller + require 'fiber' # needed for ruby 3.0 and lower + assert_equal Fiber.current, Timeout.timeout(10){ Fiber.current } + end + def test_non_timing_out_code_is_successful assert_nothing_raised do assert_equal :ok, Timeout.timeout(1){ :ok }