Debian Codegraph @

t/21-autofill-re.t

raw
1 #!/usr/bin/perl -w
2 use strict;
3 use lib './inc';
4 use File::Temp qw( tempfile );
5 use IO::Catch;
6 our ($_STDOUT_, $_STDERR_);
7
8 # pre-5.8.0's warns aren't caught by a tied STDERR.
9 tie *STDOUT, 'IO::Catch', '_STDOUT_' or die $!;
10 tie *STDERR, 'IO::Catch', '_STDERR_' or die $!;
11
12 use Test::More tests => 2;
13
14 # Disable all ReadLine functionality
15 $ENV{PERL_RL} = 0;
16
17 use_ok('WWW::Mechanize::Shell');
18
19 my $s = WWW::Mechanize::Shell->new( 'test', rcfile => undef, warnings => undef );
20 $s->agent->{content} = q{<html><form name='f' action="/formsubmit"><input type="text" name="query" value="not filled"/></form></html>};
21 $s->agent->{forms} = [ HTML::Form->parse($s->agent->{content}, "http://www.example.com/" )];
22 $s->agent->{form} = $s->agent->{forms}->[0];
23
24 $s->cmd( 'autofill /qu/i Fixed "filled"' );
25 $s->cmd( 'fillout' );
26
27 is($s->agent->current_form->find_input("query")->value,"filled", "autofill via RE works");