--- AnyEvent/t/03_child.t 2006/12/11 01:16:09 1.1 +++ AnyEvent/t/03_child.t 2008/04/22 05:12:19 1.8 @@ -1,7 +1,19 @@ $|=1; -BEGIN { print "1..4\n" } +BEGIN { + print "1..7\n" +} use AnyEvent; +use AnyEvent::Impl::Perl; + +print STDERR <timer (after => 2, cb => sub { }); +#my $timer = AnyEvent->timer (after => 2, cb => sub { }); my $cv = AnyEvent->condvar; @@ -20,13 +32,33 @@ } my $w = AnyEvent->child (pid => $pid, cb => sub { - print 3 == ($? >> 8) ? "" : "not ", "ok 3\n"; + print $pid == $_[0] ? "" : "not ", "ok 3\ # $pid == $_[0]\n"; + print 3 == ($_[1] >> 8) ? "" : "not ", "ok 4 # 3 == $_[1] >> 8 ($_[1])\n"; $cv->broadcast; }); $cv->wait; -print "ok 4\n"; +my $pid2 = fork || exit 7; + +my $cv2 = AnyEvent->condvar; + +my $w2 = AnyEvent->child (pid => 0, cb => sub { + print $pid2 == $_[0] ? "" : "not ", "ok 5 # $pid2 == $_[0]\n"; + print 7 == ($_[1] >> 8) ? "" : "not ", "ok 6 # 7 == $_[1] >> 8 ($_[1])\n"; + $cv2->broadcast; +}); + +my $error = AnyEvent->timer (after => 5, cb => sub { + print <wait; + +print "ok 7\n";