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=cb2ed875a91d18366b588262ce5e6d7f40b2c345;hp=3b5aeae0b29d819759867cf4687e0b28b343ed21;hb=dd6e1327e96d5488e34f7519d9d3290627c9bbe8;hpb=9822fc762d19741060b1e731c405395938d810af diff --git a/t/start_core.t b/t/start_core.t index 3b5aeae..cb2ed87 100644 --- a/t/start_core.t +++ b/t/start_core.t @@ -3,6 +3,8 @@ use Test::More; use Object::Remote; use File::Spec; +$ENV{OBJECT_REMOTE_TEST_LOGGER} = 1; + { package S1S; @@ -61,13 +63,17 @@ use File::Spec; my $res; -S1S->start::get_s2->then::get_s3->on_ready(sub { ($res) = $_[0]->get }); +my @keep; + +push @keep, + S1S->start::get_s2->then::get_s3->on_ready(sub { ($res) = $_[0]->get }); is($res, 'S3', 'Synchronous code ok'); undef($res); -S1F->start::get_s2->then::get_s3->on_ready(sub { ($res) = $_[0]->get }); +push @keep, + S1F->start::get_s2->then::get_s3->on_ready(sub { ($res) = $_[0]->get }); ok(!$S2F::C, 'Second future not yet constructed'); @@ -83,13 +89,14 @@ 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; +Object::Remote->current_loop->watch_time( + after => 0.1, + code => sub { + $S1F::C->(); + Object::Remote->current_loop->watch_time( + after => 0.1, + code => sub { $S2F::C->() } + ); } );