Hello community, here is the log from the commit of package perl-Future for openSUSE:Factory checked in at 2020-04-23 18:34:36 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/perl-Future (Old) and /work/SRC/openSUSE:Factory/.perl-Future.new.2738 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-Future" Thu Apr 23 18:34:36 2020 rev:13 rq:796463 version:0.45 Changes: -------- --- /work/SRC/openSUSE:Factory/perl-Future/perl-Future.changes 2020-03-25 23:48:02.596056354 +0100 +++ /work/SRC/openSUSE:Factory/.perl-Future.new.2738/perl-Future.changes 2020-04-23 18:35:05.068621127 +0200 @@ -1,0 +2,21 @@ +Thu Apr 23 03:10:19 UTC 2020 - <timueller+p...@suse.de> + +- updated to 0.45 + see /usr/share/doc/packages/perl-Future/Changes + + 0.45 2020-04-22 + [CHANGES] + * API changes to make duck-typing closer to Promises/A+ et.al: + + Allow sequencing methods to yield non-Future results; upgrade + them to being Future-wrapped + + Add ->resolve and ->reject as aliases of ->done and ->fail + * Recognise PERL_FUTURE_STRICT environment variable to restore + previous sequencing method behaviour + + [BUGFIXES] + * ->without_cancel still needs to cancel result if caller is + cancelled + * Ensure all Future::AsyncAwait interop methods properly respect + subclassing + +------------------------------------------------------------------- Old: ---- Future-0.44.tar.gz New: ---- Future-0.45.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ perl-Future.spec ++++++ --- /var/tmp/diff_new_pack.cjnnJH/_old 2020-04-23 18:35:05.900622719 +0200 +++ /var/tmp/diff_new_pack.cjnnJH/_new 2020-04-23 18:35:05.904622726 +0200 @@ -17,7 +17,7 @@ Name: perl-Future -Version: 0.44 +Version: 0.45 Release: 0 %define cpan_name Future Summary: Represent an operation awaiting completion ++++++ Future-0.44.tar.gz -> Future-0.45.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Future-0.44/Changes new/Future-0.45/Changes --- old/Future-0.44/Changes 2020-03-25 01:14:48.000000000 +0100 +++ new/Future-0.45/Changes 2020-04-22 16:05:34.000000000 +0200 @@ -1,5 +1,20 @@ Revision history for Future +0.45 2020-04-22 + [CHANGES] + * API changes to make duck-typing closer to Promises/A+ et.al: + + Allow sequencing methods to yield non-Future results; upgrade + them to being Future-wrapped + + Add ->resolve and ->reject as aliases of ->done and ->fail + * Recognise PERL_FUTURE_STRICT environment variable to restore + previous sequencing method behaviour + + [BUGFIXES] + * ->without_cancel still needs to cancel result if caller is + cancelled + * Ensure all Future::AsyncAwait interop methods properly respect + subclassing + 0.44 2020-03-25 [CHANGES] * Added ->result; use that in unit tests and docs where appropriate diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Future-0.44/META.json new/Future-0.45/META.json --- old/Future-0.44/META.json 2020-03-25 01:14:48.000000000 +0100 +++ new/Future-0.45/META.json 2020-04-22 16:05:34.000000000 +0200 @@ -39,31 +39,31 @@ "provides" : { "Future" : { "file" : "lib/Future.pm", - "version" : "0.44" + "version" : "0.45" }, "Future::Exception" : { "file" : "lib/Future/Exception.pm", - "version" : "0.44" + "version" : "0.45" }, "Future::Mutex" : { "file" : "lib/Future/Mutex.pm", - "version" : "0.44" + "version" : "0.45" }, "Future::Queue" : { "file" : "lib/Future/Queue.pm", - "version" : "0.44" + "version" : "0.45" }, "Future::Utils" : { "file" : "lib/Future/Utils.pm", - "version" : "0.44" + "version" : "0.45" }, "Test::Future" : { "file" : "lib/Test/Future.pm", - "version" : "0.44" + "version" : "0.45" }, "Test::Future::Deferred" : { "file" : "lib/Test/Future/Deferred.pm", - "version" : "0.44" + "version" : "0.45" } }, "release_status" : "stable", @@ -73,6 +73,6 @@ ], "x_IRC" : "irc://irc.perl.org/#io-async" }, - "version" : "0.44", + "version" : "0.45", "x_serialization_backend" : "JSON::PP version 4.04" } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Future-0.44/META.yml new/Future-0.45/META.yml --- old/Future-0.44/META.yml 2020-03-25 01:14:48.000000000 +0100 +++ new/Future-0.45/META.yml 2020-04-22 16:05:34.000000000 +0200 @@ -19,25 +19,25 @@ provides: Future: file: lib/Future.pm - version: '0.44' + version: '0.45' Future::Exception: file: lib/Future/Exception.pm - version: '0.44' + version: '0.45' Future::Mutex: file: lib/Future/Mutex.pm - version: '0.44' + version: '0.45' Future::Queue: file: lib/Future/Queue.pm - version: '0.44' + version: '0.45' Future::Utils: file: lib/Future/Utils.pm - version: '0.44' + version: '0.45' Test::Future: file: lib/Test/Future.pm - version: '0.44' + version: '0.45' Test::Future::Deferred: file: lib/Test/Future/Deferred.pm - version: '0.44' + version: '0.45' requires: Carp: '1.25' Test::Builder::Module: '0' @@ -46,5 +46,5 @@ resources: IRC: irc://irc.perl.org/#io-async license: http://dev.perl.org/licenses/ -version: '0.44' +version: '0.45' x_serialization_backend: 'CPAN::Meta::YAML version 0.018' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Future-0.44/README new/Future-0.45/README --- old/Future-0.44/README 2020-03-25 01:14:48.000000000 +0100 +++ new/Future-0.45/README 2020-04-22 16:05:34.000000000 +0200 @@ -292,6 +292,9 @@ future is already complete with a result or a failure, an exception is thrown. + Since version 0.45: this method is also available under the name + resolve. + fail $future->fail( $exception, $category, @details ) @@ -317,6 +320,9 @@ return Future->fail($@); } + Since version 0.45: this method is also available under the name + reject. + die $future->die( $message, $category, @details ) @@ -404,8 +410,8 @@ If the future is ready, returns the result or throws the failure exception as per "result". - If it is not yet ready then "block_until_ready" is invoked to wait for - a ready state, and the result returned as above. + If it is not yet ready then "await" is invoked to wait for a ready + state, and the result returned as above. await @@ -544,13 +550,30 @@ the first, or may run it regardless. The returned sequence future represents the entire combination of activity. - In some cases the code should return a future; in some it should return - an immediate result. If a future is returned, the combined future will - then wait for the result of this second one. If the combinined future - is cancelled, it will cancel either the first future or the second, - depending whether the first had completed. If the code block throws an - exception instead of returning a value, the sequence future will fail - with that exception as its message and no further values. + The invoked code could return a future, or a result directly. + + Since version 0.45: if a non-future result is returned it will be + wrapped in a new immediate Future instance. This behaviour can be + disabled by setting the PERL_FUTURE_STRICT environment variable to a + true value at compiletime: + + $ PERL_FUTURE_STRICT=1 perl ... + + The combined future will then wait for the result of this second one. + If the combinined future is cancelled, it will cancel either the first + future or the second, depending whether the first had completed. If the + code block throws an exception instead of returning a value, the + sequence future will fail with that exception as its message and no + further values. + + Note that since the code is invoked in scalar context, you cannot + directly return a list of values this way. Any list-valued results must + be done by returning a Future instance. + + sub { + ... + return Future->done( @results ); + } As it is always a mistake to call these sequencing methods in void context and lose the reference to the returned future (because @@ -596,8 +619,8 @@ The then method can also be passed the $fail_code block as well, giving a combination of then and else behaviour. - This operation is designed to be compatible with the semantics of other - future systems, such as Javascript's Q or Promises/A libraries. + This operation is similar to those provided by other future systems, + such as Javascript's Q or Promises/A libraries. catch @@ -765,6 +788,10 @@ operation that is being shared among multiple sequences; cancelling one should not prevent the others from running too. + Note that this only prevents cancel propagating from $future to $f1; if + the original $f1 instance is cancelled then the returned $future will + have to be cancelled too. + retain $f = $f->retain diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Future-0.44/lib/Future/Exception.pm new/Future-0.45/lib/Future/Exception.pm --- old/Future-0.44/lib/Future/Exception.pm 2020-03-25 01:14:48.000000000 +0100 +++ new/Future-0.45/lib/Future/Exception.pm 2020-04-22 16:05:34.000000000 +0200 @@ -8,7 +8,7 @@ use strict; use warnings; -our $VERSION = '0.44'; +our $VERSION = '0.45'; =head1 NAME diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Future-0.44/lib/Future/Mutex.pm new/Future-0.45/lib/Future/Mutex.pm --- old/Future-0.44/lib/Future/Mutex.pm 2020-03-25 01:14:48.000000000 +0100 +++ new/Future-0.45/lib/Future/Mutex.pm 2020-04-22 16:05:34.000000000 +0200 @@ -9,7 +9,7 @@ use warnings; use 5.010; -our $VERSION = '0.44'; +our $VERSION = '0.45'; use Future; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Future-0.44/lib/Future/Queue.pm new/Future-0.45/lib/Future/Queue.pm --- old/Future-0.44/lib/Future/Queue.pm 2020-03-25 01:14:48.000000000 +0100 +++ new/Future-0.45/lib/Future/Queue.pm 2020-04-22 16:05:34.000000000 +0200 @@ -8,7 +8,7 @@ use strict; use warnings; -our $VERSION = '0.44'; +our $VERSION = '0.45'; =head1 NAME diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Future-0.44/lib/Future/Utils.pm new/Future-0.45/lib/Future/Utils.pm --- old/Future-0.44/lib/Future/Utils.pm 2020-03-25 01:14:48.000000000 +0100 +++ new/Future-0.45/lib/Future/Utils.pm 2020-04-22 16:05:34.000000000 +0200 @@ -8,7 +8,7 @@ use strict; use warnings; -our $VERSION = '0.44'; +our $VERSION = '0.45'; use Exporter 'import'; # Can't import the one from Exporter as it relies on package inheritance diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Future-0.44/lib/Future.pm new/Future-0.45/lib/Future.pm --- old/Future-0.44/lib/Future.pm 2020-03-25 01:14:48.000000000 +0100 +++ new/Future-0.45/lib/Future.pm 2020-04-22 16:05:34.000000000 +0200 @@ -9,7 +9,7 @@ use warnings; no warnings 'recursion'; # Disable the "deep recursion" warning -our $VERSION = '0.44'; +our $VERSION = '0.45'; use Carp qw(); # don't import croak use Scalar::Util qw( weaken blessed reftype ); @@ -25,6 +25,8 @@ use constant DEBUG => !!$ENV{PERL_FUTURE_DEBUG}; +use constant STRICT => !!$ENV{PERL_FUTURE_STRICT}; + our $TIMES = DEBUG || $ENV{PERL_FUTURE_TIMES}; =head1 NAME @@ -224,6 +226,8 @@ CB_SEQ_IMDONE => 1<<7, # $code is in fact immediate ->done result CB_SEQ_IMFAIL => 1<<8, # $code is in fact immediate ->fail result + + CB_SEQ_STRICT => 1<<9, # Complain if $code didn't return a Future }; use constant CB_ALWAYS => CB_DONE|CB_FAIL|CB_CANCEL; @@ -270,7 +274,7 @@ }, ( ref $proto || $proto ); } -*AWAIT_CLONE = sub { shift->new }; # We need to respect subclassing +*AWAIT_CLONE = sub { shift->new }; my $GLOBAL_END; END { $GLOBAL_END = 1; } @@ -449,8 +453,12 @@ } unless( blessed $f2 and $f2->isa( "Future" ) ) { - $fseq->fail( "Expected " . CvNAME_FILE_LINE($code) . " to return a Future" ); - next; + # Upgrade a non-Future result, or complain in strict mode + if( $flags & CB_SEQ_STRICT ) { + $fseq->fail( "Expected " . CvNAME_FILE_LINE($code) . " to return a Future" ); + next; + } + $f2 = Future->done( $f2 ); } $fseq->on_cancel( $f2 ); @@ -509,7 +517,7 @@ return $self->{ready}; } -*AWAIT_IS_READY = \&is_ready; +*AWAIT_IS_READY = sub { shift->is_ready }; =head2 is_done @@ -557,7 +565,7 @@ return $self->{cancelled}; } -*AWAIT_IS_CANCELLED = \&is_cancelled; +*AWAIT_IS_CANCELLED = sub { shift->is_cancelled }; =head2 state @@ -599,6 +607,9 @@ If the future is already cancelled, this request is ignored. If the future is already complete with a result or a failure, an exception is thrown. +I<Since version 0.45:> this method is also available under the name +C<resolve>. + =cut sub done @@ -622,9 +633,11 @@ return $self; } +*resolve = sub { shift->done( @_ ) }; + # TODO: For efficiency we can implement better versions of these as individual # methods know which case is being invoked -*AWAIT_NEW_DONE = *AWAIT_DONE = \&done; +*AWAIT_NEW_DONE = *AWAIT_DONE = sub { shift->done( @_ ) }; =head2 fail @@ -649,6 +662,8 @@ return Future->fail($@); } +I<Since version 0.45:> this method is also available under the name C<reject>. + =cut sub fail @@ -680,9 +695,11 @@ return $self; } +*reject = sub { shift->fail( @_ ) }; + # TODO: For efficiency we can implement better versions of these as individual # methods know which case is being invoked -*AWAIT_NEW_FAIL = *AWAIT_FAIL = \&fail; +*AWAIT_NEW_FAIL = *AWAIT_FAIL = sub { shift->fail( @_ ) }; =head2 die @@ -886,8 +903,7 @@ return @{ $self->{result} }; } -# TODO do we want to rename this AWAIT_RESULT ? -*AWAIT_GET = \&result; +*AWAIT_RESULT = *AWAIT_GET = sub { shift->result }; =head2 get @@ -898,8 +914,8 @@ If the future is ready, returns the result or throws the failure exception as per L</result>. -If it is not yet ready then L</block_until_ready> is invoked to wait for a -ready state, and the result returned as above. +If it is not yet ready then L</await> is invoked to wait for a ready state, and +the result returned as above. =cut @@ -1160,13 +1176,28 @@ regardless. The returned sequence future represents the entire combination of activity. -In some cases the code should return a future; in some it should return an -immediate result. If a future is returned, the combined future will then wait -for the result of this second one. If the combinined future is cancelled, it -will cancel either the first future or the second, depending whether the first -had completed. If the code block throws an exception instead of returning a -value, the sequence future will fail with that exception as its message and no -further values. +The invoked code could return a future, or a result directly. + +I<Since version 0.45:> if a non-future result is returned it will be wrapped +in a new immediate Future instance. This behaviour can be disabled by setting +the C<PERL_FUTURE_STRICT> environment variable to a true value at compiletime: + + $ PERL_FUTURE_STRICT=1 perl ... + +The combined future will then wait for the result of this second one. If the +combinined future is cancelled, it will cancel either the first future or the +second, depending whether the first had completed. If the code block throws an +exception instead of returning a value, the sequence future will fail with +that exception as its message and no further values. + +Note that since the code is invoked in scalar context, you cannot directly +return a list of values this way. Any list-valued results must be done by +returning a C<Future> instance. + + sub { + ... + return Future->done( @results ); + } As it is always a mistake to call these sequencing methods in void context and lose the reference to the returned future (because exception/error handling would be @@ -1179,6 +1210,8 @@ my $f1 = shift; my ( $code, $flags ) = @_; + $flags |= CB_SEQ_STRICT if STRICT; + # For later, we might want to know where we were called from my $func = (caller 1)[3]; $func =~ s/^.*:://; @@ -1215,7 +1248,11 @@ } unless( blessed $fseq and $fseq->isa( "Future" ) ) { - return Future->fail( "Expected " . CvNAME_FILE_LINE($code) . " to return a Future" ); + # Upgrade a non-Future result, or complain in strict mode + $flags & CB_SEQ_STRICT and + return Future->fail( "Expected " . CvNAME_FILE_LINE($code) . " to return a Future" ); + + $fseq = $f1->new->done( $fseq ); } return $fseq; @@ -1271,8 +1308,8 @@ The C<then> method can also be passed the C<$fail_code> block as well, giving a combination of C<then> and C<else> behaviour. -This operation is designed to be compatible with the semantics of other future -systems, such as Javascript's Q or Promises/A libraries. +This operation is similar to those provided by other future systems, such as +Javascript's Q or Promises/A libraries. =cut @@ -1626,6 +1663,10 @@ that is being shared among multiple sequences; cancelling one should not prevent the others from running too. +Note that this only prevents cancel propagating from C<$future> to C<$f1>; if +the original C<$f1> instance is cancelled then the returned C<$future> will +have to be cancelled too. + =cut sub without_cancel @@ -1635,7 +1676,10 @@ $self->on_ready( sub { my $self = shift; - if( $self->{failure} ) { + if( $self->{cancelled} ) { + $new->cancel; + } + elsif( $self->{failure} ) { $new->fail( @{ $self->{failure} } ); } else { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Future-0.44/lib/Test/Future/Deferred.pm new/Future-0.45/lib/Test/Future/Deferred.pm --- old/Future-0.44/lib/Test/Future/Deferred.pm 2020-03-25 01:14:48.000000000 +0100 +++ new/Future-0.45/lib/Test/Future/Deferred.pm 2020-04-22 16:05:34.000000000 +0200 @@ -9,7 +9,7 @@ use warnings; use base qw( Future ); -our $VERSION = '0.44'; +our $VERSION = '0.45'; =head1 NAME diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Future-0.44/lib/Test/Future.pm new/Future-0.45/lib/Test/Future.pm --- old/Future-0.44/lib/Test/Future.pm 2020-03-25 01:14:48.000000000 +0100 +++ new/Future-0.45/lib/Test/Future.pm 2020-04-22 16:05:34.000000000 +0200 @@ -9,7 +9,7 @@ use warnings; use base qw( Test::Builder::Module ); -our $VERSION = '0.44'; +our $VERSION = '0.45'; our @EXPORT = qw( no_pending_futures diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Future-0.44/t/01future.t new/Future-0.45/t/01future.t --- old/Future-0.44/t/01future.t 2020-03-25 01:14:48.000000000 +0100 +++ new/Future-0.45/t/01future.t 2020-04-22 16:05:34.000000000 +0200 @@ -293,4 +293,13 @@ '->result while pending raises exception' ); } +# resolve and reject aliases +{ + my $fdone = Future->resolve( "abc" ); + ok( $fdone->is_done, 'Future->resolve' ); + + my $ffail = Future->reject( "def\n" ); + ok( $ffail->is_failed, 'Future->reject' ); +} + done_testing; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Future-0.44/t/02cancel.t new/Future-0.45/t/02cancel.t --- old/Future-0.44/t/02cancel.t 2020-03-25 01:14:48.000000000 +0100 +++ new/Future-0.45/t/02cancel.t 2020-04-22 16:05:34.000000000 +0200 @@ -160,6 +160,12 @@ ok( $f3->is_ready, '$f3 ready when $f1 is' ); is_deeply( [ $f3->result ], [ "result" ], 'result of $f3' ); is_oneref( $f1, '$f1 has one reference after done' ); + + $f1 = Future->new; + $f2 = $f1->without_cancel; + + $f1->cancel; + ok( $f2->is_cancelled, '$f1 cancelled still cancels $f2' ); } done_testing; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Future-0.44/t/03then.t new/Future-0.45/t/03then.t --- old/Future-0.44/t/03then.t 2020-03-25 01:14:48.000000000 +0100 +++ new/Future-0.45/t/03then.t 2020-04-22 16:05:34.000000000 +0200 @@ -189,31 +189,27 @@ 'Warning in void context' ); } -# Non-Future return raises exception +# Non-Future return is upgraded { my $f1 = Future->new; - my $file = __FILE__; - my $line = __LINE__+1; - my $fseq = $f1->then( sub { undef } ); + my $fseq = $f1->then( sub { "result" } ); my $fseq2 = $f1->then( sub { Future->done } ); is( exception { $f1->done }, undef, '->done with non-Future return from ->then does not die' ); - like( $fseq->failure, - qr/^Expected __ANON__\(\Q$file\E line $line\) to return a Future/, - 'Failure from non-Future return from ->then' ); + is( scalar $fseq->result, "result", + 'non-Future return from ->then is upgraded' ); ok( $fseq2->is_ready, '$fseq2 is ready after failure of $fseq' ); my $fseq3; - is( exception { $fseq3 = $f1->then( sub { undef } ) }, undef, + is( exception { $fseq3 = $f1->then( sub { "result" } ) }, undef, 'non-Future return from ->then on immediate does not die' ); - like( $fseq3->failure, - qr/^Expected __ANON__\(.*\) to return a Future/, - 'Failure from non-Future return from ->then on immediate' ); + is( scalar $fseq3->result, "result", + 'non-Future return from ->then on immediate is upgraded' ); } # then_with_f diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Future-0.44/t/04else.t new/Future-0.45/t/04else.t --- old/Future-0.44/t/04else.t 2020-03-25 01:14:48.000000000 +0100 +++ new/Future-0.45/t/04else.t 2020-04-22 16:05:34.000000000 +0200 @@ -158,31 +158,27 @@ 'Warning in void context' ); } -# Non-Future return raises exception +# Non-Future return is upgraded { my $f1 = Future->new; - my $file = __FILE__; - my $line = __LINE__+1; - my $fseq = $f1->else( sub { undef } ); + my $fseq = $f1->else( sub { "result" } ); my $fseq2 = $f1->else( sub { Future->done } ); is( exception { $f1->fail( "failed\n" ) }, undef, '->fail with non-Future return from ->else does not die' ); - like( $fseq->failure, - qr/^Expected __ANON__\(\Q$file\E line $line\) to return a Future/, - 'Failure from non-Future return from ->else' ); + is( scalar $fseq->result, "result", + 'non-Future return from ->else is upgraded' ); ok( $fseq2->is_ready, '$fseq2 is ready after failure of $fseq' ); my $fseq3; - is( exception { $fseq3 = $f1->else( sub { undef } ) }, undef, + is( exception { $fseq3 = $f1->else( sub { "result" } ) }, undef, 'non-Future return from ->else on immediate does not die' ); - like( $fseq3->failure, - qr/^Expected __ANON__\(.*\) to return a Future/, - 'Failure from non-Future return from ->else on immediate' ); + is( scalar $fseq3->result, "result", + 'non-Future return from ->else on immediate is upgraded' ); } # else_with_f diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Future-0.44/t/06followed_by.t new/Future-0.45/t/06followed_by.t --- old/Future-0.44/t/06followed_by.t 2020-03-25 01:14:48.000000000 +0100 +++ new/Future-0.45/t/06followed_by.t 2020-04-22 16:05:34.000000000 +0200 @@ -167,31 +167,27 @@ 'Warning in void context' ); } -# Non-Future return raises exception +# Non-Future return is upgraded { my $f1 = Future->new; - my $file = __FILE__; - my $line = __LINE__+1; - my $fseq = $f1->followed_by( sub { undef } ); + my $fseq = $f1->followed_by( sub { "result" } ); my $fseq2 = $f1->followed_by( sub { Future->done } ); is( exception { $f1->done }, undef, '->done with non-Future return from ->followed_by does not die' ); - like( $fseq->failure, - qr/^Expected __ANON__\(\Q$file\E line $line\) to return a Future/, - 'Failure from non-Future return from ->followed_by' ); + is( scalar $fseq->result, "result", + 'non-Future return from ->followed_by is upgraded' ); ok( $fseq2->is_ready, '$fseq2 is ready after failure of $fseq' ); my $fseq3; - is( exception { $fseq3 = $f1->followed_by( sub { undef } ) }, undef, + is( exception { $fseq3 = $f1->followed_by( sub { "result" } ) }, undef, 'non-Future return from ->followed_by on immediate does not die' ); - like( $fseq3->failure, - qr/^Expected __ANON__\(.*\) to return a Future/, - 'Failure from non-Future return from ->followed_by on immediate' ); + is( scalar $fseq3->result, "result", + 'non-Future return from ->followed_by on immediate is upgraded' ); } done_testing; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Future-0.44/t/20subclass.t new/Future-0.45/t/20subclass.t --- old/Future-0.44/t/20subclass.t 2020-03-25 01:14:48.000000000 +0100 +++ new/Future-0.45/t/20subclass.t 2020-04-22 16:05:34.000000000 +0200 @@ -38,6 +38,32 @@ $_->cancel for @seq; } +# immediate subclass->... +{ + my $fdone = t::Future::Subclass->new->done; + my $ffail = t::Future::Subclass->new->fail( "Oop\n" ); + + isa_ok( $fdone->then( sub { 1 } ), + "t::Future::Subclass", + 'immediate $f->then' ); + + isa_ok( $ffail->else( sub { 1 } ), + "t::Future::Subclass", + 'immediate $f->else' ); + + isa_ok( $fdone->then_with_f( sub {} ), + "t::Future::Subclass", + 'immediate $f->then_with_f' ); + + isa_ok( $ffail->else_with_f( sub {} ), + "t::Future::Subclass", + 'immediate $f->else_with_f' ); + + isa_ok( $fdone->followed_by( sub {} ), + "t::Future::Subclass", + '$f->followed_by' ); +} + # immediate->followed_by( sub { subclass } ) { my $f = t::Future::Subclass->new; @@ -109,7 +135,7 @@ $f->failure; } -# ->get calls the correct block_until_ready +# ->get calls the correct await { my $f = t::Future::Subclass->new;