diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/fiber/autoload.rb | 3 | ||||
| -rw-r--r-- | test/fiber/test_scheduler.rb | 19 |
2 files changed, 22 insertions, 0 deletions
diff --git a/test/fiber/autoload.rb b/test/fiber/autoload.rb new file mode 100644 index 0000000000..dcb27164a7 --- /dev/null +++ b/test/fiber/autoload.rb @@ -0,0 +1,3 @@ +sleep 0.01 +module TestFiberSchedulerAutoload +end diff --git a/test/fiber/test_scheduler.rb b/test/fiber/test_scheduler.rb index 1870ab1c33..08ac386c29 100644 --- a/test/fiber/test_scheduler.rb +++ b/test/fiber/test_scheduler.rb @@ -104,4 +104,23 @@ class TestFiberScheduler < Test::Unit::TestCase thread.join end + + def test_autoload + Object.autoload(:TestFiberSchedulerAutoload, File.expand_path("autoload.rb", __dir__)) + + thread = Thread.new do + scheduler = Scheduler.new + Fiber.set_scheduler scheduler + + 10.times do + Fiber.schedule do + Object.const_get(:TestFiberSchedulerAutoload) + end + end + end + + thread.join + ensure + Object.send(:remove_const, :TestFiberSchedulerAutoload) + end end |
