]> Dogcows Code - chaz/p5-CGI-Ex/blobdiff - t/2_fill_08_multiple_objects.t
CGI::Ex 2.00
[chaz/p5-CGI-Ex] / t / 2_fill_08_multiple_objects.t
index c26cf13d1a185ab2a3e4c6f532cf8d24cccc0f5d..28548abd9b6db814dc5d3108a6fc95d75ff7e7f2 100644 (file)
@@ -1,31 +1,32 @@
 # -*- Mode: Perl; -*-
 
-use strict;
+=head1 NAME
+
+2_fill_08_multiple_objects.t - Test CGI::Ex::Fill's ability to fill using multiple form objects
 
-$^W = 1;
+=cut
+
+use strict;
+use Test::More tests => 2;
 
-print "1..2\n";
+use_ok('CGI::Ex::Fill');
 
-use CGI::Ex;
-use CGI;
+SKIP: {
 
-print "ok 1\n";
+skip('CGI.pm not found', 1) if ! eval { require CGI };
 
 my $hidden_form_in = qq{<INPUT TYPE="TEXT" NAME="foo1" value="nada">
 <input type="hidden" name="foo2">};
 
 my %fdat = (foo1 => 'bar1',
-       foo2 => 'bar2');
-
-my $q1 = new CGI( { foo1 => 'bar1' });
-my $q2 = new CGI( { foo2 => 'bar2' });
-
-my $fif = new CGI::Ex;
-my $output = $fif->fill(scalarref => \$hidden_form_in,
-                       fobject => [$q1, $q2]);
-if ($output =~ m/^<input( (type="TEXT"|name="foo1"|value="bar1")){3}>\s*<input( (type="hidden"|name="foo2"|value="bar2")){3}>$/i){
-       print "ok 2\n";
-} else {
-       print "Got unexpected out for $hidden_form_in:\n$output\n";
-       print "not ok 2\n";
-}
+            foo2 => 'bar2');
+
+my $q1 = CGI->new({ foo1 => 'bar1' });
+my $q2 = CGI->new({ foo2 => 'bar2' });
+
+my $output = CGI::Ex::Fill::form_fill($hidden_form_in,
+                                      [$q1, $q2]);
+ok($output =~ m/^<input( (type="TEXT"|name="foo1"|value="bar1")){3}>\s*<input( (type="hidden"|name="foo2"|value="bar2")){3}>$/i,
+   "Should match ($output)");
+
+}; #end of SKIP
This page took 0.01674 seconds and 4 git commands to generate.