ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Coro/t/02_channel.t
(Generate patch)

Comparing Coro/t/02_channel.t (file contents):
Revision 1.3 by root, Sat Jul 14 22:14:21 2001 UTC vs.
Revision 1.4 by root, Sat Jul 21 18:21:45 2001 UTC

2print "1..19\n"; 2print "1..19\n";
3 3
4use Coro; 4use Coro;
5use Coro::Channel; 5use Coro::Channel;
6 6
7my $q = new Coro::Channel 0; 7my $q = new Coro::Channel 1;
8 8
9sub producer : Coro { 9sub producer : Coro {
10 for (1..9) { 10 for (1..9) {
11 print "ok ", $_*2, "\n"; 11 print "ok ", $_*2, "\n";
12 $q->put($_); 12 $q->put($_);
15 15
16print "ok 1\n"; 16print "ok 1\n";
17yield; 17yield;
18 18
19for (11..19) { 19for (11..19) {
20 my $x = do { local $_; $q->get }; 20 my $x = $q->get;
21 print $x == $_-10 ? "ok " : "not ok ", ($_-10)*2+1, "\n"; 21 print $x == $_-10 ? "ok " : "not ok ", ($_-10)*2+1, "\n";
22} 22}
23 23

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines