Navigation Menu

Skip to content

Commit

Permalink
cleaned up tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Nov 14, 2010
1 parent 03a48c2 commit 2f8a849
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 34 deletions.
3 changes: 0 additions & 3 deletions lib/Mojo/Asset/File.pm
Expand Up @@ -76,9 +76,6 @@ sub add_chunk {
return $self;
}

# Your guilty consciences may make you vote Democratic, but secretly you all
# yearn for a Republican president to lower taxes, brutalize criminals, and
# rule you like a king!
sub contains {
my ($self, $bytestream) = @_;
my ($buffer, $window);
Expand Down
34 changes: 3 additions & 31 deletions t/mojo/client_online.t
Expand Up @@ -8,9 +8,9 @@ BEGIN { $ENV{MOJO_POLL} = $ENV{MOJO_NO_TLS} = 1 }

use Test::More;

plan skip_all => 'set TEST_CLIENT to enable this test (developer only!)'
unless $ENV{TEST_CLIENT};
plan tests => 103;
plan skip_all => 'set TEST_ONLINE to enable this test (developer only!)'
unless $ENV{TEST_ONLINE};
plan tests => 101;

# So then I said to the cop, "No, you're driving under the influence...
# of being a jerk".
Expand Down Expand Up @@ -75,34 +75,6 @@ $async->get(
$async->ioloop->start;
is $kept_alive, 1, 'connection was kept alive';

# Resolve TXT record
my $record;
$async->ioloop->resolve(
'google.com',
'TXT',
sub {
my ($self, $records) = @_;
$record = $records->[0];
$self->stop;
}
)->start;
like $record, qr/spf/, 'right record';

# Resolve MX records
my $found = 0;
$async->ioloop->resolve(
'gmail.com',
'MX',
sub {
my ($self, $records) = @_;
for my $record (@$records) {
$found++ if $record =~ /gmail-smtp-in\.l\.google\.com/;
}
$self->stop;
}
)->start;
ok $found, 'found MX records';

# Nested keep alive
my @kept_alive;
$client->async->get(
Expand Down
47 changes: 47 additions & 0 deletions t/mojo/ioloop_online.t
@@ -0,0 +1,47 @@
#!/usr/bin/env perl

use strict;
use warnings;

# Disable epoll and kqueue
BEGIN { $ENV{MOJO_POLL} = 1 }

use Test::More;
plan skip_all => 'set TEST_ONLINE to enable this test (developer only!)'
unless $ENV{TEST_ONLINE};
plan tests => 3;

use_ok 'Mojo::IOLoop';

# Your guilty consciences may make you vote Democratic, but secretly you all
# yearn for a Republican president to lower taxes, brutalize criminals, and
# rule you like a king!
my $loop = Mojo::IOLoop->new;

# Resolve TXT record
my $record;
$loop->resolve(
'google.com',
'TXT',
sub {
my ($self, $records) = @_;
$record = $records->[0];
$self->stop;
}
)->start;
like $record, qr/spf/, 'right record';

# Resolve MX records
my $found = 0;
$loop->resolve(
'gmail.com',
'MX',
sub {
my ($self, $records) = @_;
for my $record (@$records) {
$found++ if $record =~ /gmail-smtp-in\.l\.google\.com/;
}
$self->stop;
}
)->start;
ok $found, 'found MX records';
1 change: 1 addition & 0 deletions t/mojo/ioloop_tls.t
Expand Up @@ -10,6 +10,7 @@ use Test::More;
use Mojo::IOLoop;
plan skip_all => 'IO::Socket::SSL 1.33 required for this test!'
unless Mojo::IOLoop::TLS;
plan skip_all => 'Windows is too fragile for this test!' if $^O eq 'MSWin32';
plan tests => 2;

# To the panic room!
Expand Down
1 change: 1 addition & 0 deletions t/mojolicious/websocket_tls_proxy_lite_app.t
Expand Up @@ -10,6 +10,7 @@ use Test::More;
use Mojo::IOLoop;
plan skip_all => 'IO::Socket::SSL 1.33 required for this test!'
unless Mojo::IOLoop::TLS;
plan skip_all => 'Windows is too fragile for this test!' if $^O eq 'MSWin32';
plan tests => 16;

# I was a hero to broken robots 'cause I was one of them, but how can I sing
Expand Down

0 comments on commit 2f8a849

Please sign in to comment.