2 # WWW::Mechanize tests for <area> tags
6 use Test::More tests => 9;
9 BEGIN { delete @ENV{ qw( http_proxy HTTP_PROXY PATH IFS CDPATH ENV BASH_ENV) }; }
11 use_ok( 'WWW::Mechanize' );
14 eval 'use Test::Memory::Cycle';
17 my $mech = WWW::Mechanize->new( cookie_jar => undef );
18 isa_ok( $mech, 'WWW::Mechanize' );
20 my $uri = URI::file->new_abs( 't/area_link.html' );
22 ok( $mech->success, "Fetched $uri" ) or die q{Can't get test page};
27 [ 'http://www.msnbc.com/area', undef, undef, 'area', {
29 href => 'http://www.msnbc.com/area'
31 [ 'http://www.cnn.com/area', undef, undef, 'area', {
33 href => 'http://www.cnn.com/area'
35 [ 'http://www.cpan.org/area', undef, undef, 'area', {
37 coords => '10,11,12,13',
38 href => 'http://www.cpan.org/area'
40 [ 'http://www.slashdot.org', undef, undef, 'area', {
41 href => 'http://www.slashdot.org'
43 [ 'http://mark.stosberg.com', undef, undef, 'area', {
44 alt => q{Mark Stosberg's homepage},
45 href => 'http://mark.stosberg.com'
48 my @links = $mech->find_all_links();
50 # Skip the 'base' field for now
57 is_deeply( \@links, \@wanted_links, 'Correct links came back' );
59 my $linkref = $mech->find_all_links();
60 is_deeply( $linkref, \@wanted_links, 'Correct links came back' );
63 skip 'Test::Memory::Cycle not installed', 2 unless $canTMC;
64 memory_cycle_ok( \@links, 'Link list: no cycles' );
65 memory_cycle_ok( $linkref, 'Single link: no cycles' );
70 skip 'Test::Memory::Cycle not installed', 2 unless $canTMC;
72 memory_cycle_ok( $uri, 'URI: no cycles' );
73 memory_cycle_ok( $mech, 'Mech: no cycles' );