Skip to content

Commit

Permalink
more Mojo::IOLoop tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Oct 30, 2011
1 parent 9a4cee9 commit 68a95fd
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
3 changes: 3 additions & 0 deletions Changes
@@ -1,5 +1,8 @@
This file documents the revision history for Perl extension Mojolicious.

2.19 2011-10-31 00:00:00
- Improved tests.

2.18 2011-10-30 00:00:00
- Improved documentation.
- Fixed small rendering bug.
Expand Down
2 changes: 1 addition & 1 deletion lib/Mojolicious.pm
Expand Up @@ -35,7 +35,7 @@ has static => sub { Mojolicious::Static->new };
has types => sub { Mojolicious::Types->new };

our $CODENAME = 'Leaf Fluttering In Wind';
our $VERSION = '2.18';
our $VERSION = '2.19';

# "These old doomsday devices are dangerously unstable.
# I'll rest easier not knowing where they are."
Expand Down
20 changes: 19 additions & 1 deletion t/mojo/ioloop.t
Expand Up @@ -7,13 +7,20 @@ BEGIN {
$ENV{MOJO_IOWATCHER} = 'Mojo::IOWatcher';
}

use Test::More tests => 22;
use Test::More tests => 32;

use IO::Socket::INET;

# "Marge, you being a cop makes you the man!
# Which makes me the woman, and I have no interest in that,
# besides occasionally wearing the underwear,
# which as we discussed, is strictly a comfort thing."
use_ok 'Mojo::IOLoop';
use_ok 'Mojo::IOLoop::Client';
use_ok 'Mojo::IOLoop::Delay';
use_ok 'Mojo::IOLoop::Resolver';
use_ok 'Mojo::IOLoop::Server';
use_ok 'Mojo::IOLoop::Stream';

# Custom watcher
package MyWatcher;
Expand Down Expand Up @@ -217,3 +224,14 @@ Mojo::IOLoop->timer('0.5' => sub { shift->stop });
Mojo::IOLoop->start;
is $server_close, 1, 'server emitted close event once';
is $client_close, 1, 'client emitted close event once';

# Defaults
is Mojo::IOLoop::Client->new->resolver->ioloop, Mojo::IOLoop->singleton,
'right default';
is Mojo::IOLoop::Delay->new->ioloop, Mojo::IOLoop->singleton, 'right default';
is Mojo::IOLoop::Resolver->new->ioloop, Mojo::IOLoop->singleton,
'right default';
is Mojo::IOLoop::Server->new->iowatcher,
Mojo::IOLoop->singleton->iowatcher, 'right default';
is Mojo::IOLoop::Stream->new->iowatcher, Mojo::IOLoop->singleton->iowatcher,
'right default';

0 comments on commit 68a95fd

Please sign in to comment.