Sha256: c3557e75bba2c241ca4a760fc7ab79788ec192b32355ae95ded64606dcb75c4b
Contents?: true
Size: 697 Bytes
Versions: 6
Compression:
Stored size: 697 Bytes
Contents
# frozen_string_literal: true require_relative 'helper' class AsyncTest < MiniTest::Test def test_that_async_watcher_receives_signal_across_threads count = 0 a = Gyro::Async.new spin { a.await count += 1 } snooze Thread.new do orig_sleep 0.001 a.signal! end suspend assert_equal 1, count end def test_that_async_watcher_coalesces_signals count = 0 a = Gyro::Async.new coproc = spin { loop { a.await count += 1 spin { coproc.stop } } } snooze Thread.new do orig_sleep 0.001 3.times { a.signal! } end coproc.await assert_equal 1, count end end
Version data entries
6 entries across 6 versions & 1 rubygems