Skip to content

Commit

Permalink
fix Mojo::Promise arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Feb 13, 2018
1 parent c9e76b8 commit 45ad9fc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/Mojo/Promise.pm
Expand Up @@ -28,7 +28,7 @@ sub all {
);
}

return @promises ? $all : $all->resolve([]);
return @promises ? $all : $all->resolve;
}

sub catch { shift->then(undef, shift) }
Expand Down
5 changes: 3 additions & 2 deletions t/mojo/promise.t
Expand Up @@ -187,9 +187,10 @@ is_deeply \@errors, ['third'], 'promise rejected';

# Empty all
(@results, @errors) = ();
Mojo::Promise->all()->then(sub { @results = @_ }, sub { @errors = @_ });
Mojo::Promise->all()
->then(sub { @results = 'pass', @_ }, sub { @errors = 'fail', @_ });
Mojo::IOLoop->one_tick;
is_deeply \@results, [[]], 'promise resolved';
is_deeply \@results, ['pass'], 'promise resolved';
is_deeply \@errors, [], 'promise not rejected';

# Settle with promise
Expand Down

0 comments on commit 45ad9fc

Please sign in to comment.