]> Dogcows Code - chaz/p5-CGI-Ex/blob - t/2_fill_12_mult.t
CGI::Ex 2.00
[chaz/p5-CGI-Ex] / t / 2_fill_12_mult.t
1 # -*- Mode: Perl; -*-
2
3 =head1 NAME
4
5 2_fill_12_mult.t - Test CGI::Ex::Fill's ability to fill multiple instances of the same field name
6
7 =cut
8
9 use strict;
10 use Test::More tests => 4;
11
12 use_ok('CGI::Ex::Fill');
13
14 my $hidden_form_in = qq{<INPUT TYPE="TEXT" NAME="foo1" value="cat1">
15 <input type="text" name="foo1" value="cat2"/>};
16
17 my %fdat = (foo1 => ['bar1','bar2']);
18
19 my $output = CGI::Ex::Fill::form_fill($hidden_form_in,
20 \%fdat);
21 ok($output =~ m/^<input( (type="TEXT"|name="foo1"|value="bar1")){3}>\s*<input( (type="text"|name="foo1"|value="bar2")){3}\s*\/>$/i,
22 "Should match ($output)");
23
24
25 %fdat = (foo1 => ['bar1']);
26
27 $output = CGI::Ex::Fill::form_fill($hidden_form_in,
28 \%fdat);
29 ok($output =~ m/^<input( (type="TEXT"|name="foo1"|value="bar1")){3}>\s*<input( (type="text"|name="foo1"|value="")){3}\s*\/>$/i,
30 "Should match ($output)");
31
32 %fdat = (foo1 => 'bar1');
33
34 $output = CGI::Ex::Fill::form_fill($hidden_form_in,
35 \%fdat);
36 ok($output =~ m/^<input( (type="TEXT"|name="foo1"|value="bar1")){3}>\s*<input( (type="text"|name="foo1"|value="bar1")){3}\s*\/>$/i,
37 "Should match ($output)");
This page took 0.034626 seconds and 4 git commands to generate.