X-Git-Url: http://vcs.maemo.org/git/?a=blobdiff_plain;f=dev%2Farm%2Flibwww-mechanize-perl%2Flibwww-mechanize-perl-1.34%2Ft%2Flocal%2Freload.t;fp=dev%2Farm%2Flibwww-mechanize-perl%2Flibwww-mechanize-perl-1.34%2Ft%2Flocal%2Freload.t;h=50fc31aeafbcc158343034928649cf5ec338a27d;hb=f477fa73365d491991707e7ed9217b48d6994551;hp=0000000000000000000000000000000000000000;hpb=da95c414033799c3a62606f299c3c00b5c77ca11;p=dh-make-perl diff --git a/dev/arm/libwww-mechanize-perl/libwww-mechanize-perl-1.34/t/local/reload.t b/dev/arm/libwww-mechanize-perl/libwww-mechanize-perl-1.34/t/local/reload.t new file mode 100644 index 0000000..50fc31a --- /dev/null +++ b/dev/arm/libwww-mechanize-perl/libwww-mechanize-perl-1.34/t/local/reload.t @@ -0,0 +1,54 @@ +#!perl + +use warnings; +use strict; +use Test::More tests => 14; + +use lib 't/local'; +use LocalServer; + +BEGIN { + delete @ENV{ grep { lc eq 'http_proxy' } keys %ENV }; + delete @ENV{ qw( IFS CDPATH ENV BASH_ENV ) }; + use_ok( 'WWW::Mechanize' ); +} + +my $server = LocalServer->spawn; +isa_ok( $server, 'LocalServer' ); + +my $agent = WWW::Mechanize->new; +isa_ok( $agent, 'WWW::Mechanize', 'Created object' ); + +NO_GET: { + my $r = $agent->reload; + ok( !defined($r), 'Initial reload should fail' ); +} + +FIRST_GET: { + my $r = $agent->get($server->url); + isa_ok( $r, 'HTTP::Response' ); + ok( $r->is_success, 'Get google webpage'); + ok( $agent->is_html, 'Valid HTML' ); + is( $agent->title, 'WWW::Mechanize::Shell test page' ); +} + +INVALIDATE: { + undef $agent->{content}; + undef $agent->{ct}; + isnt( $agent->title, 'WWW::Mechanize::Shell test page' ); + ok( !$agent->is_html, 'Not HTML' ); +} + +RELOAD: { + my $r = $agent->reload; + isa_ok( $r, 'HTTP::Response' ); + ok( $agent->is_html, 'Valid HTML' ); + ok( $agent->title, 'WWW::Mechanize::Shell test page' ); +} + +SKIP: { + eval 'use Test::Memory::Cycle'; + skip 'Test::Memory::Cycle not installed', 1 if $@; + + memory_cycle_ok( $agent, 'Mech: no cycles' ); +}