File: 18_ignore_fdat.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-- 741 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
#!/usr/local/bin/perl

# contributed by James Tolley

use strict;
use warnings FATAL => 'all';

use Test::More tests => 4;

use_ok('HTML::FillInForm');

my $html = qq[
<form>
<input type="text" name="one" value="not disturbed">
<input type="text" name="two" value="not disturbed">
<input type="text" name="three" value="not disturbed">
</form>
];

my $result = HTML::FillInForm->new->fill(
					 scalarref => \$html,
					 fdat => {
					   two => "new val 2",
					   three => "new val 3",
					 },
					 ignore_fields => [qw(one two)],
					 );

ok($result =~ /not disturbed/ && $result =~ /\bone/,'ignore 1');
ok($result =~ /not disturbed/ && $result =~ /\btwo/,'ignore 2');
ok($result =~ /new val 3/ && $result =~ /\bthree/,'ignore 3');