5 use Test::More tests => 14;
11 delete @ENV{ grep { lc eq 'http_proxy' } keys %ENV };
12 delete @ENV{ qw( IFS CDPATH ENV BASH_ENV ) };
13 use_ok( 'WWW::Mechanize' );
16 my $server = LocalServer->spawn;
17 isa_ok( $server, 'LocalServer' );
19 my $agent = WWW::Mechanize->new;
20 isa_ok( $agent, 'WWW::Mechanize', 'Created object' );
23 my $r = $agent->reload;
24 ok( !defined($r), 'Initial reload should fail' );
28 my $r = $agent->get($server->url);
29 isa_ok( $r, 'HTTP::Response' );
30 ok( $r->is_success, 'Get google webpage');
31 ok( $agent->is_html, 'Valid HTML' );
32 is( $agent->title, 'WWW::Mechanize::Shell test page' );
36 undef $agent->{content};
38 isnt( $agent->title, 'WWW::Mechanize::Shell test page' );
39 ok( !$agent->is_html, 'Not HTML' );
43 my $r = $agent->reload;
44 isa_ok( $r, 'HTTP::Response' );
45 ok( $agent->is_html, 'Valid HTML' );
46 ok( $agent->title, 'WWW::Mechanize::Shell test page' );
50 eval 'use Test::Memory::Cycle';
51 skip 'Test::Memory::Cycle not installed', 1 if $@;
53 memory_cycle_ok( $agent, 'Mech: no cycles' );