File: 00_basic.t

package info (click to toggle)
libcoro-perl 6.570-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,144 kB
  • sloc: ansic: 2,560; perl: 2,122; makefile: 14
file content (38 lines) | stat: -rw-r--r-- 766 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
BEGIN { $| = 1; print "1..9\n"; }
END {print "not ok 1\n" unless $loaded;}
use Coro::State;
$loaded = 1;
print "ok 1\n";

my $main  = new Coro::State;
my $proca = new Coro::State \&a;
my $procb = new Coro::State \&b;

sub a {
   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 ($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";