@@ -5,7 +5,7 @@ use strict;
55use Test::More ' no_plan' ;
66use Test::Fatal qw( exception ) ;
77use Test::Warnings ' :all' ;
8- use Test::Deep qw( cmp_deeply re ) ;
8+ use Test::Deep qw( cmp_deeply re array_each code ) ;
99use URI::file ();
1010
1111BEGIN {
@@ -81,13 +81,31 @@ ok( $mech->success, "Fetched $uri" ) or die q{Can't get test page};
8181
8282{
8383 my @forms = $mech -> all_forms_with( name => ' 3rd_form_ambiguous' );
84- is( scalar @forms , 2 );
84+ is( scalar @forms , 2 , ' all_forms_with finds similar forms ' );
8585 isa_ok( $forms [0], ' HTML::Form' );
8686 isa_ok( $forms [1], ' HTML::Form' );
8787 is($forms [0]-> attr(' name' ), ' 3rd_form_ambiguous' , ' first result of 3rd_form_ambiguous' );
8888 is($forms [1]-> attr(' name' ), ' 3rd_form_ambiguous' , ' second result of 3rd_form_ambiguous' );
8989}
9090
91+ {
92+ my @forms = $mech -> all_forms_with( action => ' http://localhost/' );
93+ is( scalar @forms , 7, ' all_forms_with action finds all 7 forms' );
94+ cmp_deeply(
95+ \@forms ,
96+ array_each(
97+ code(
98+ # one of the forms is missing the trailing slash, we
99+ # should not have it
100+ sub {
101+ $_ [0]-> action eq ' http://localhost/' ;
102+ }
103+ )
104+ ),
105+ ' ... and all of them have the correct action'
106+ );
107+ }
108+
91109{
92110 $mech -> get($uri );
93111 like(
0 commit comments