--- Coro/t/09_timer.t 2001/11/25 20:04:06 1.1 +++ Coro/t/09_timer.t 2006/11/24 15:34:33 1.4 @@ -1,27 +1,21 @@ $|=1; -print "1..6\n"; +print "1..4\n"; use Coro; +use Coro::Signal; use Coro::Timer; print "ok 1\n"; -new Coro::Timer after => 0, cb => sub { - print "ok 2\n"; -}; -new Coro::Timer after => 1, cb => sub { - print "ok 4\n"; -}; -new Coro::Timer after => 0, cb => sub { - print "ok 3\n"; -}; -(new Coro::Timer after => 0, cb => sub { - print "not ok 4\n"; -})->cancel; -new Coro::Timer at => time + 2, cb => sub { - print "ok 5\n"; - $Coro::main->ready; -}; +my $signal = new Coro::Signal; + +my $timeout = Coro::Timer::timeout 3; + +print $signal->timed_wait(1) ? "not ok" : "ok", " 2\n"; + +print $timeout ? "not ok" : "ok", " 3\n"; + +Coro::Timer::sleep 2; + +print $timeout ? "ok" : "not ok", " 4\n"; -schedule; -print "ok 6\n";