Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
52 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters