]> Dogcows Code - chaz/p5-CGI-Ex/blobdiff - t/2_fill_02_hidden.t
CGI::Ex 2.00
[chaz/p5-CGI-Ex] / t / 2_fill_02_hidden.t
index 49c6c759927d2b34d32a79a20c0e37fce64aa4ad..5d50a5479873054bee4544e462b17cf9977d9398 100644 (file)
@@ -1,27 +1,26 @@
 # -*- Mode: Perl; -*-
 
-use strict;
+=head1 NAME
 
-$^W = 1;
+2_fill_02_hidden.t - Test CGI::Ex::Fill's ability to fill hidden fields
 
-print "1..2\n";
+=cut
 
-use CGI::Ex;
+use strict;
+use Test::More tests => 2;
 
-print "ok 1\n";
+use_ok('CGI::Ex::Fill');
 
 my $hidden_form_in = qq{<input type="hidden" name="foo1">
 <input type="hidden" name="foo2" value="ack">};
 
 my %fdat = (foo1a => 'bar1a',
-       foo2 => ['bar2','bar3']);
-
-my $fif = new CGI::Ex;
-my $output = $fif->fill(scalarref => \$hidden_form_in,
-                       fdat => \%fdat);
-if ($output =~ m/^<input( (type="hidden"|name="foo1"|value="")){3}>\s*<input( (type="hidden"|name="foo2"|value="bar2")){3}>$/){
-       print "ok 2\n";
-} else {
-       print "Got unexpected out for hidden form:\n$output\n";
-       print "not ok 2\n";
-}
+            foo2  => ['bar2','bar3'],
+            );
+
+
+my $output = CGI::Ex::Fill::form_fill($hidden_form_in,
+                                      \%fdat);
+ok($output =~ m/^<input( (type="hidden"|name="foo1"|value="")){3}>\s*<input( (type="hidden"|name="foo2"|value="bar2")){3}>$/,
+   "Hidden should've matched ($output)");
+
This page took 0.02142 seconds and 4 git commands to generate.