--- Coro/t/00_basic.t 2001/07/10 21:19:47 1.2 +++ Coro/t/00_basic.t 2007/10/03 16:03:17 1.10 @@ -1,23 +1,38 @@ -BEGIN { $| = 1; print "1..6\n"; } +BEGIN { $| = 1; print "1..9\n"; } END {print "not ok 1\n" unless $loaded;} -use Coro; +use Coro::State; $loaded = 1; print "ok 1\n"; -my $main = new Coro; -my $proc = new Coro \&a; +my $main = new Coro::State; +my $proca = new Coro::State \&a; +my $procb = new Coro::State \&b; sub a { - print "ok 3\n"; - $proc->transfer($main); - print "ok 5\n"; - $proc->transfer($main); + print $/ eq "\n" ? "" : "not ", "ok 3\n"; + $/ = 77; + print "ok 4\n"; + $proca->transfer ($main); + print $/ == 77 ? "" : "not ", "ok 6\n"; + $proca->transfer ($main); + print "not ok 7\n"; die; } +sub b { + print $/ ne "\n" ? "not " : "", "ok 8\n"; + $procb->transfer ($main); + print "not ok 9\n"; + die; +} + +$/ = 55; + print "ok 2\n"; -$main->transfer($proc); -print "ok 4\n"; -$main->transfer($proc); -print "ok 6\n"; +$main->transfer ($proca); +print $/ != 55 ? "not " : "ok 5\n"; +$main->transfer ($proca); +print $/ != 55 ? "not " : "ok 7\n"; +$main->transfer ($procb); +print $/ != 55 ? "not " : "ok 9\n";