Skip to content

Commit

Permalink
make sure one_tick semantics are tested
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Mar 23, 2012
1 parent d328b04 commit 39ac334
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
3 changes: 3 additions & 0 deletions Changes
@@ -1,5 +1,8 @@
This file documents the revision history for Perl extension Mojolicious.

2.67 2012-03-24
- Improved tests.

2.66 2012-03-23
- Reformatted "Changes".
- Improved Mojo::Reactor::Poll performance.
Expand Down
2 changes: 1 addition & 1 deletion lib/Mojolicious.pm
Expand Up @@ -33,7 +33,7 @@ has static => sub { Mojolicious::Static->new };
has types => sub { Mojolicious::Types->new };

our $CODENAME = 'Leaf Fluttering In Wind';
our $VERSION = '2.66';
our $VERSION = '2.67';

# "These old doomsday devices are dangerously unstable.
# I'll rest easier not knowing where they are."
Expand Down
7 changes: 6 additions & 1 deletion t/mojo/reactor_ev.t
Expand Up @@ -8,7 +8,7 @@ use Test::More;
plan skip_all => 'set TEST_EV to enable this test (developer only!)'
unless $ENV{TEST_EV};
plan skip_all => 'EV 4.0 required for this test!' unless eval 'use EV 4.0; 1';
plan tests => 67;
plan tests => 68;

# "Oh well. At least we'll die doing what we love: inhaling molten rock."
use IO::Socket::INET;
Expand All @@ -25,6 +25,11 @@ $reactor = Mojo::IOLoop->singleton->reactor;
is ref $reactor, 'Mojo::Reactor::EV', 'right object';

# Make sure it stops automatically when not watching for events
Mojo::IOLoop->one_tick;
my $triggered;
Mojo::IOLoop->timer(0.25 => sub { $triggered++ });
Mojo::IOLoop->one_tick;
ok $triggered, 'reactor waited for one event';
Mojo::IOLoop->start;

# Listen
Expand Down
7 changes: 6 additions & 1 deletion t/mojo/reactor_poll.t
Expand Up @@ -6,7 +6,7 @@ BEGIN {
$ENV{MOJO_REACTOR} = 'Mojo::Reactor::Poll';
}

use Test::More tests => 66;
use Test::More tests => 67;

# "I don't mind being called a liar when I'm lying, or about to lie,
# or just finished lying, but NOT WHEN I'M TELLING THE TRUTH."
Expand All @@ -24,6 +24,11 @@ $reactor = Mojo::IOLoop->singleton->reactor;
is ref $reactor, 'Mojo::Reactor::Poll', 'right object';

# Make sure it stops automatically when not watching for events
Mojo::IOLoop->one_tick;
my $triggered;
Mojo::IOLoop->timer(0.25 => sub { $triggered++ });
Mojo::IOLoop->one_tick;
ok $triggered, 'reactor waited for one event';
Mojo::IOLoop->start;

# Listen
Expand Down

0 comments on commit 39ac334

Please sign in to comment.