File: followable_links.t

package info (click to toggle)
libtest-www-mechanize-perl 1.52-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 372 kB
  • sloc: perl: 2,570; makefile: 4
file content (28 lines) | stat: -rw-r--r-- 697 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!perl -T

use strict;
use warnings;
use Test::More tests => 3;
use URI::file;

use Test::WWW::Mechanize ();

my $mech = Test::WWW::Mechanize->new();
isa_ok($mech,'Test::WWW::Mechanize');

my $uri = URI::file->new_abs( 't/manylinks.html' )->as_string;
$mech->get_ok( $uri );

# Good links.
my @links = $mech->followable_links();
@links = map { $_->url_abs } @links;
my @expected = (
    URI::file->new_abs( 't/goodlinks.html' )->as_string,
    'http://bongo.com/wang.html',
    'https://secure.bongo.com/',
    URI::file->new_abs( 't/badlinks.html' )->as_string,
    URI::file->new_abs( 't/goodlinks.html' )->as_string,
);
is_deeply( \@links, \@expected, 'Got the right links' );

done_testing();