Skip to content

Commit

Permalink
better Mojo::IOWatcher tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Feb 3, 2012
1 parent 427c8db commit 5dd09f8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion t/mojo/iowatcher.t
Expand Up @@ -6,7 +6,7 @@ BEGIN {
$ENV{MOJO_IOWATCHER} = 'Mojo::IOWatcher';
}

use Test::More tests => 53;
use Test::More tests => 55;

# "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 @@ -31,6 +31,7 @@ $watcher->timer(0 => sub { shift->stop });
$watcher->start;
is $readable, undef, 'handle is not readable';
is $writable, undef, 'handle is not writable';
ok !$watcher->is_readable($listen), 'handle is not readable';

# Connect
my $client =
Expand All @@ -39,6 +40,7 @@ $watcher->timer(1 => sub { shift->stop });
$watcher->start;
ok $readable, 'handle is readable';
ok !$writable, 'handle is not writable';
ok $watcher->is_readable($listen), 'handle is readable';

# Accept
my $server = $listen->accept;
Expand Down
4 changes: 3 additions & 1 deletion t/mojo/iowatcher_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 => 53;
plan tests => 55;

use IO::Socket::INET;
use Mojo::IOLoop;
Expand All @@ -32,6 +32,7 @@ $watcher->timer(0 => sub { shift->stop });
$watcher->start;
is $readable, undef, 'handle is not readable';
is $writable, undef, 'handle is not writable';
ok !$watcher->is_readable($listen), 'handle is not readable';

# Connect
my $client =
Expand All @@ -40,6 +41,7 @@ $watcher->timer(1 => sub { shift->stop });
$watcher->start;
ok $readable, 'handle is readable';
ok !$writable, 'handle is not writable';
ok $watcher->is_readable($listen), 'handle is readable';

# Accept
my $server = $listen->accept;
Expand Down

0 comments on commit 5dd09f8

Please sign in to comment.