File: wikipedia.t

package info (click to toggle)
libwww-mechanize-perl 1.71-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 620 kB
  • sloc: perl: 3,272; makefile: 4
file content (38 lines) | stat: -rw-r--r-- 759 bytes parent folder | download | duplicates (3)
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
29
30
31
32
33
34
35
36
37
38
#!perl -T

use warnings;
use strict;

use constant LANGUAGES => qw( en it ja es nl pl );
use Test::More tests => 3 + (2 * scalar LANGUAGES);

use lib 't';

BEGIN {
    use Tools;
}

BEGIN {
    use_ok( 'WWW::Mechanize' );
}

my $mech = WWW::Mechanize->new;
isa_ok( $mech, 'WWW::Mechanize', 'Created object' );
$mech->agent_alias( 'Windows IE 6' ); # Wikipedia 403s out obvious bots

for my $lang ( LANGUAGES ) {
    my $start = "http://$lang.wikipedia.org/";

    $mech->get( $start );

    ok( $mech->success, "Got $start" );
    my @links = $mech->links();
    cmp_ok( scalar @links, '>', 50, "Over 50 links on $start" );
}

SKIP: {
    skip 'Test::Memory::Cycle not installed', 1 unless $canTMC;

    memory_cycle_ok( $mech, 'No memory cycles found' );
}