File: 06_radio.t

package info (click to toggle)
libhtml-fillinform-perl 2.22-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 356 kB
  • sloc: perl: 649; makefile: 2
file content (31 lines) | stat: -rw-r--r-- 786 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# -*- Mode: Perl; -*-

use strict;

$^W = 1;

print "1..2\n";

use HTML::FillInForm;

print "ok 1\n";

my $hidden_form_in = qq{<INPUT TYPE="radio" NAME="foo1" value="bar1">
<input type="radio" name="foo1" value="bar2">
<input type="radio" name="foo1" value="bar3">
<input type="radio" name="foo1" checked value="bar4">
<input type="radio" name="foo2" value="baz1">
<input type="radio" name="foo2" value="baz2" checked>};

my %fdat = (foo1 => 'bar2');

my $fif = new HTML::FillInForm;
my $output = $fif->fill(scalarref => \$hidden_form_in,
			fdat => \%fdat);
my $is_checked = join(" ",map { m/checked/ ? "yes" : "no" } split ("\n",$output));
if ($is_checked eq 'no yes no no no yes'){
	print "ok 2\n";
} else {
	print "Got unexpected is_checked:\n$is_checked\n";
	print "not ok 2\n";
}