Debian lenny version packages
[pkg-perl] / deb-src / libwww-mechanize-perl / libwww-mechanize-perl-1.34 / t / live / wikipedia.t
1 #!perl -T
2
3 use warnings;
4 use strict;
5
6 use constant LANGUAGES => qw( en it ja es nl pl );
7 use Test::More tests => 3 + (2 * scalar LANGUAGES);
8
9 BEGIN {
10     use_ok( 'WWW::Mechanize' );
11 }
12
13 my $mech = WWW::Mechanize->new;
14 isa_ok( $mech, 'WWW::Mechanize', 'Created object' );
15 $mech->agent_alias( 'Windows IE 6' ); # Wikipedia 403s out obvious bots
16
17 for my $lang ( LANGUAGES ) {
18     my $start = "http://$lang.wikipedia.org/";
19
20     $mech->get( $start );
21
22     ok( $mech->success, "Got $start" );
23     my @links = $mech->links();
24     cmp_ok( scalar @links, '>', 50, "Over 50 links on $start" );
25 }
26
27 SKIP: {
28     eval 'use Test::Memory::Cycle';
29     skip 'Test::Memory::Cycle not installed', 1 if $@;
30
31     memory_cycle_ok( $mech, 'No memory cycles found' );
32 }
33