--- Coro/t/09_timer.t 2002/02/18 21:25:02 1.3 +++ Coro/t/09_timer.t 2006/11/24 15:34:33 1.4 @@ -1,5 +1,5 @@ $|=1; -print "1..8\n"; +print "1..4\n"; use Coro; use Coro::Signal; @@ -9,27 +9,13 @@ my $signal = new Coro::Signal; -new Coro::Timer after => 0, cb => sub { - print "ok 2\n"; -}; -new Coro::Timer at => time + 1, cb => sub { - print "ok 4\n"; -}; -new Coro::Timer after => 3, cb => sub { - $signal->send; -}; -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 + 5, cb => sub { - print "ok 7\n"; - $Coro::main->ready; -}; - -print $signal->timed_wait(2) ? "not ok" : "ok", " 5\n"; -print $signal->timed_wait(2) ? "ok" : "not ok", " 6\n"; -schedule; -print "ok 8\n"; +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"; +