Skip to content

Commit

Permalink
made trigger.t more reliable
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Aug 3, 2011
1 parent 52d454f commit 71d2c9d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions Changes
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ This file documents the revision history for Perl extension Mojolicious.
1.70 2011-08-03 00:00:00
- Added extended callback support to Mojo::IOLoop::Trigger.
- Improved documentation.
- Improved tests.

1.69 2011-08-03 00:00:00
- Added EXPERIMENTAL module Mojo::IOLoop::Trigger.
Expand Down
12 changes: 6 additions & 6 deletions t/mojo/trigger.t
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,21 @@ is_deeply \@results, [0, 0], 'right results';
$t = Mojo::IOLoop::Trigger->new;
my $done;
$t->on(done => sub { shift; $done = [@_, 'works!'] });
for my $i (0, 1) {
for my $i (0, 0) {
$t->begin;
Mojo::IOLoop->timer($i => sub { $t->end($i) });
}
@results = $t->start;
is_deeply $done, [0, 1, 'works!'], 'right results';
is_deeply \@results, [0, 1], 'right results';
is_deeply $done, [0, 0, 'works!'], 'right results';
is_deeply \@results, [0, 0], 'right results';

# Mojo::IOLoop
$done = undef;
$t = Mojo::IOLoop->trigger(sub { shift; $done = [@_, 'too!'] });
for my $i (0, 1) {
for my $i ('0.5', '0.5') {
my $cb = $t->begin;
Mojo::IOLoop->timer($i => sub { $t->$cb($i) });
}
@results = $t->start;
is_deeply $done, [0, 1, 'too!'], 'right results';
is_deeply \@results, [0, 1], 'right results';
is_deeply $done, ['0.5', '0.5', 'too!'], 'right results';
is_deeply \@results, ['0.5', '0.5'], 'right results';

0 comments on commit 71d2c9d

Please sign in to comment.