test/test_cancel_scope.rb in polyphony-0.24 vs test/test_cancel_scope.rb in polyphony-0.25
- old
+ new
@@ -12,14 +12,14 @@
buffer << 2
}
assert_equal [1], buffer
end
- def test_that_cancel_scope_can_cancel_multiple_coprocesses
+ def test_that_cancel_scope_can_cancel_multiple_fibers
buffer = []
scope = Polyphony::CancelScope.new
- coprocs = (1..3).map { |i|
+ fibers = (1..3).map { |i|
spin {
scope.call do
buffer << i
snooze
buffer << i * 10
@@ -50,24 +50,24 @@
assert_equal [1], buffer
assert Time.now - t0 < 1
assert_nil scope.instance_variable_get(:@timeout_waiter)
end
- def test_that_cancel_scope_can_cancel_multiple_coprocs_with_timeout
+ def test_that_cancel_scope_can_cancel_multiple_fibers_with_timeout
buffer = []
t0 = Time.now
scope = Polyphony::CancelScope.new(timeout: 0.02)
- coprocs = (1..3).map { |i|
+ fibers = (1..3).map { |i|
spin {
scope.call do
buffer << i
sleep i
buffer << i * 10
end
}
}
- Polyphony::Coprocess.await(*coprocs)
+ Fiber.await(*fibers)
assert Time.now - t0 < 0.05
assert_equal [1, 2, 3], buffer
end
def test_reset_timeout
@@ -75,10 +75,10 @@
scope = Polyphony::CancelScope.new(timeout: 0.01)
t0 = Time.now
scope.call {
sleep 0.005
scope.reset_timeout
- sleep 0.010
+ sleep 0.008
}
assert !scope.cancelled?
end
\ No newline at end of file