X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=scpubgit%2FObject-Remote.git;a=blobdiff_plain;f=t%2Fstart_core.t;h=4c63f4baedc1afe8af77d63211dae89c45b06d5d;hp=31d5349eecb6c7ab2f9385dc6e6636170b002b40;hb=a711172670b40e3a6033791ef6a747031ec7464b;hpb=11e7c8a508b90595385fe78e9036f8f8313d9dbd 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;