X-Git-Url: http://git.maemo.org/git/?p=dh-make-perl;a=blobdiff_plain;f=dev%2Fi386%2Flibwww-mechanize-perl%2Flibwww-mechanize-perl-1.34%2Ft%2Flocal%2Fform.t;fp=dev%2Fi386%2Flibwww-mechanize-perl%2Flibwww-mechanize-perl-1.34%2Ft%2Flocal%2Fform.t;h=87e8dbdf0f2d35a6edcf5964a6dc955fd09a54c3;hp=0000000000000000000000000000000000000000;hb=8977e561d8a9eae6959218b0306c9df2056a38a9;hpb=df794b845212301ea0d267c919232538bfef356a diff --git a/dev/i386/libwww-mechanize-perl/libwww-mechanize-perl-1.34/t/local/form.t b/dev/i386/libwww-mechanize-perl/libwww-mechanize-perl-1.34/t/local/form.t new file mode 100644 index 0000000..87e8dbd --- /dev/null +++ b/dev/i386/libwww-mechanize-perl/libwww-mechanize-perl-1.34/t/local/form.t @@ -0,0 +1,35 @@ +#!perl + +use warnings; +use strict; +use Test::More tests => 11; + +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 $mech = WWW::Mechanize->new(); +isa_ok( $mech, 'WWW::Mechanize' ) or die; +$mech->quiet(1); +$mech->get($server->url); +ok( $mech->success, 'Got a page' ) or die 'cannot even get google'; +is( $mech->uri, $server->url, 'Got page' ); + +my $form_number_1 = $mech->form_number(1); +isa_ok( $form_number_1, 'HTML::Form', 'Can select the first form'); +is( $mech->current_form(), $mech->{forms}->[0], 'Set the form attribute' ); + +ok( !$mech->form_number(99), 'cannot select the 99th form'); +is( $mech->current_form(), $mech->{forms}->[0], 'Form is still set to 1' ); + +my $form_name_f = $mech->form_name('f'); +isa_ok( $form_name_f, 'HTML::Form', 'Can select the form' ); +ok( !$mech->form_name('bargle-snark'), 'cannot select non-existent form' );