Debian lenny version packages
[pkg-perl] / deb-src / libwww-mechanize-perl / libwww-mechanize-perl-1.34 / t / frames.t
1 #!perl -Tw
2
3 use warnings;
4 use strict;
5 use Test::More tests => 7;
6 use URI::file;
7
8 BEGIN {
9     delete @ENV{qw(PATH IFS CDPATH ENV BASH_ENV)};  # Placates taint-unsafe Cwd.pm in 5.6.1
10     use_ok( 'WWW::Mechanize' );
11 }
12
13 my $mech = WWW::Mechanize->new( cookie_jar => undef );
14 isa_ok( $mech, 'WWW::Mechanize' );
15
16 my $uri = URI::file->new_abs( 't/frames.html' )->as_string;
17
18 $mech->get( $uri );
19 ok( $mech->success, "Fetched $uri" ) or die q{Can't get test page};
20
21 my $link = $mech->find_link();
22 isa_ok( $link, 'WWW::Mechanize::Link' );
23
24 my @links = $mech->find_all_links();
25 is( scalar @links, 2, 'Only two links' );
26
27 is_deeply( [@{$links[0]}[0..3]], [ 'find_link.html', undef, 'top', 'frame' ], 'First frame OK' );
28
29 is_deeply( [@{$links[1]}[0..3]], [ 'google.html', undef, 'bottom', 'frame' ], 'Second frame OK' );