forked from zoffixznet/WWW-FreeProxyListsCom
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- added t/05-timeout tests (renders #4 as invalid) - reduced timeout in t/04-filter, and wrapped in eval (#5) - added tests for _set_error() (#6)
- Loading branch information
Showing
6 changed files
with
112 additions
and
32 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
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,33 @@ | ||
#!/usr/bin/perl | ||
use warnings; | ||
use strict; | ||
|
||
use Data::Dumper; | ||
use Test::More; | ||
use WWW::FreeProxyListsCom; | ||
|
||
{ | ||
eval { | ||
my $p = WWW::FreeProxyListsCom->new(timeout => '0.0000001'); | ||
my $elite = $p->get_list(); | ||
}; | ||
if ($@){ | ||
like ($@, qr/Error GETing/, "timeout ok"); | ||
} | ||
} | ||
{ | ||
my $ca; | ||
|
||
eval { | ||
my $p = WWW::FreeProxyListsCom->new(timeout => 10); | ||
$ca = $p->get_list(type => 'ca'); | ||
}; | ||
if ($@){ | ||
like ($@, qr/Error Geting/, "timeout broken, but we've skipped"); | ||
} | ||
else { | ||
is (ref $ca->[1], 'HASH', "timeout ok, we got success"); | ||
} | ||
} | ||
|
||
done_testing(); |
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,36 @@ | ||
#!/usr/bin/perl | ||
use warnings; | ||
use strict; | ||
|
||
use Test::More; | ||
use WWW::FreeProxyListsCom; | ||
|
||
|
||
my $p = WWW::FreeProxyListsCom->new(timeout => 10); | ||
|
||
eval { | ||
$p->get_list(type => 'ca'); | ||
$p->_set_error($p->{mech}, 'net'); | ||
|
||
}; | ||
|
||
if ($@){ | ||
like ($@, qr/Error GETing/, "timeout skip"); | ||
} | ||
else { | ||
like ($p->error, qr/Network error/, "network error ok"); | ||
} | ||
|
||
eval { | ||
$p->get_list(type => 'ca'); | ||
$p->_set_error("error"); | ||
}; | ||
|
||
if ($@){ | ||
like ($@, qr/Error GETing/, "timeout skip"); | ||
} | ||
else { | ||
is ($p->error, 'error', "string error ok"); | ||
} | ||
|
||
done_testing(); |