| 1 | #!perl -T |
| 2 | |
| 3 | use strictscip-perl cpan Test-WWW-Mechanize 1.60 strict/; |
| 4 | use warningsscip-perl cpan Test-WWW-Mechanize 1.60 warnings/; |
| 5 | use Test::Morescip-perl cpan Test-WWW-Mechanize 1.60 Test/More/ tests => 3; |
| 6 | use URI::filescip-perl cpan Test-WWW-Mechanize 1.60 URI/file/; |
| 7 | |
| 8 | use Test::WWW::Mechanizescip-perl cpan Test-WWW-Mechanize 1.60 Test/WWW/Mechanize/ (); |
| 9 | |
| 10 | my $mech = Test::WWW::Mechanize->newscip-perl cpan Test-WWW-Mechanize 1.60 Test/WWW/Mechanize/new().(); |
| 11 | isa_okscip-perl cpan Test-WWW-Mechanize 1.60 main/isa_ok().($mech,'Test::WWW::Mechanize'); |
| 12 | |
| 13 | my $uri = URI::file->new_absscip-perl cpan Test-WWW-Mechanize 1.60 URI/file/new_abs().( 't/manylinks.html' )->as_stringscip-perl cpan Test-WWW-Mechanize 1.60 main/as_string().; |
| 14 | $mech->get_okscip-perl cpan Test-WWW-Mechanize 1.60 Test/WWW/Mechanize/get_ok().( $uri ); |
| 15 | |
| 16 | # Good links. |
| 17 | my @links = $mech->followable_linksscip-perl cpan Test-WWW-Mechanize 1.60 Test/WWW/Mechanize/followable_links().(); |
| 18 | @links = mapscip-perl cpan Test-WWW-Mechanize 1.60 main/map(). { $_scip-perl cpan Test-WWW-Mechanize 1.60 main/$_.->url_absscip-perl cpan Test-WWW-Mechanize 1.60 main/url_abs(). } @links; |
| 19 | my @expected = ( |
| 20 | URI::file->new_absscip-perl cpan Test-WWW-Mechanize 1.60 URI/file/new_abs().( 't/goodlinks.html' )->as_stringscip-perl cpan Test-WWW-Mechanize 1.60 main/as_string()., |
| 21 | 'http://bongo.com/wang.html', |
| 22 | 'https://secure.bongo.com/', |
| 23 | URI::file->new_absscip-perl cpan Test-WWW-Mechanize 1.60 URI/file/new_abs().( 't/badlinks.html' )->as_stringscip-perl cpan Test-WWW-Mechanize 1.60 main/as_string()., |
| 24 | URI::file->new_absscip-perl cpan Test-WWW-Mechanize 1.60 URI/file/new_abs().( 't/goodlinks.html' )->as_stringscip-perl cpan Test-WWW-Mechanize 1.60 main/as_string()., |
| 25 | ); |
| 26 | is_deeplyscip-perl cpan Test-WWW-Mechanize 1.60 main/is_deeply().( \@links, \@expected, 'Got the right links' ); |
| 27 | |
| 28 | done_testingscip-perl cpan Test-WWW-Mechanize 1.60 main/done_testing().(); |