File: 08-FF-fillout.t

package info (click to toggle)
libwww-mechanize-formfiller-perl 0.08-2
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 224 kB
  • ctags: 45
  • sloc: perl: 1,469; makefile: 43
file content (23 lines) | stat: -rwxr-xr-x 687 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
use strict;
use Test::More tests => 4;
use HTML::Form;

BEGIN {
  use_ok("WWW::Mechanize::FormFiller");
};

my $f = WWW::Mechanize::FormFiller->new( values => [[ check => Fixed => "baz"]]);
isa_ok($f,"WWW::Mechanize::FormFiller");

my $form = HTML::Form->parse(q(
  <html><body><form name="f">
    <input type="checkbox" name="check" value="foo">
    <input type="checkbox" name="check" value="bar">
  </form></body></html>
),'http://www.example.com');

{
  eval { $f->fill_form($form) };
  isnt($@,undef,"We (resp. HTML::Form) croaked on invalid values for a field");
  like($@,qr/^Field 'check' had illegal value: baz at/,"We croaked for the field 'check'");
};