From: Matt S Trout Date: Tue, 17 Jul 2012 23:23:12 +0000 (+0000) Subject: test without start X-Git-Tag: v0.002002~13 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=scpubgit%2FObject-Remote.git;a=commitdiff_plain;h=a711172670b40e3a6033791ef6a747031ec7464b;hp=11e7c8a508b90595385fe78e9036f8f8313d9dbd test without start --- diff --git a/t/start_core.t b/t/start_core.t index 31d5349..4c63f4b 100644 --- a/t/start_core.t +++ b/t/start_core.t @@ -1,5 +1,7 @@ use strictures 1; use Test::More; +use Object::Remote; +use File::Spec; { package S1S; @@ -22,7 +24,7 @@ use Test::More; sub get_s2 { future { my $f = shift; - $C = sub { $f->done(S2F->new); undef($f); }; + $C = sub { $f->done(S2F->new); undef($f); undef($C); }; $f; } } @@ -47,7 +49,7 @@ use Test::More; sub get_s3 { future { my $f = shift; - $C = sub { $f->done('S3'); undef($f); }; + $C = sub { $f->done('S3'); undef($f); undef($C); }; $f; } } @@ -75,4 +77,18 @@ $S2F::C->(); is($res, 'S3', 'Asynchronous code ok'); +is(S1S->get_s2->get_s3, 'S3', 'Sync without start'); + +open my $fh, '<', File::Spec->devnull; + +Object::Remote->current_loop->watch_io( + handle => $fh, + on_read_ready => sub { + $S1F::C->() if defined $S1F::C; + $S2F::C->() if defined $S2F::C; + } +); + +is(S1F->get_s2->get_s3, 'S3', 'Async without start'); + done_testing;