Skip to content

Commit 0da1555

Browse files
committed
Bump HTTP::Request version from 6 to 7.01
and update tests to reflect the new requirement
1 parent eee9abb commit 0da1555

File tree

2 files changed

+11
-20
lines changed

2 files changed

+11
-20
lines changed

dist.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ user = libwww-perl
3636

3737
[Prereqs]
3838
Encode = 2
39-
HTTP::Request = 6
39+
HTTP::Request = 7.01
4040
HTTP::Request::Common = 6.03
4141
perl = 5.008001
4242
Test::More = 0.96

t/form.t

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,6 @@ use warnings;
66
use Test::More;
77
use HTML::Form;
88

9-
# this handles all versions of HTTP::Message, both before and after
10-
# 7.01, when the stringification of requests changed
11-
sub is_maybe_nl {
12-
my ($got, $expected, $message) = @_;
13-
14-
local $Test::Builder::Level = $Test::Builder::Level + 1;
15-
16-
if ($got !~ m{\n$} && $expected =~ m{\n$}) {
17-
chomp($expected);
18-
}
19-
20-
is($got, $expected, $message);
21-
}
22-
239
my @warn;
2410
$SIG{__WARN__} = sub { push( @warn, $_[0] ) };
2511

@@ -97,13 +83,14 @@ EOT
9783
#print $f->dump;
9884
#print $f->click->as_string;
9985

100-
is_maybe_nl( $f->click->as_string, <<'EOT');
86+
chomp(my $expected_advanced = <<'EOT');
10187
POST http://localhost/
10288
Content-Length: 86
10389
Content-Type: application/x-www-form-urlencoded
10490
10591
i.x=1&i.y=1&c=on&r=b&t=&p=&tel=&date=&h=xyzzy&f=&x=&a=%0D%0Aabc%0D%0A+++&s=bar&m=a&m=b
10692
EOT
93+
is( $f->click->as_string, $expected_advanced);
10794

10895
is( @warn, 1 );
10996
like( $warn[0], qr/^Unknown input type 'xyzzy'/ );
@@ -477,22 +464,24 @@ EOT
477464
ok( $f->find_input("randomkey") );
478465
is( $f->find_input("randomkey")->challenge, "1234567890" );
479466
is( $f->find_input("randomkey")->keytype, "rsa" );
480-
is_maybe_nl( $f->click->as_string, <<EOT);
467+
chomp(my $expected_keygen = <<EOT);
481468
POST http://example.com/secure/keygen/test.cgi
482469
Content-Length: 19
483470
Content-Type: application/x-www-form-urlencoded
484471
485472
Field1=Default+Text
486473
EOT
474+
is( $f->click->as_string, $expected_keygen);
487475

488476
$f->value( randomkey => "foo" );
489-
is_maybe_nl( $f->click->as_string, <<EOT);
477+
chomp(my $expected_keygen_foo = <<EOT);
490478
POST http://example.com/secure/keygen/test.cgi
491479
Content-Length: 33
492480
Content-Type: application/x-www-form-urlencoded
493481
494482
randomkey=foo&Field1=Default+Text
495483
EOT
484+
is( $f->click->as_string, $expected_keygen_foo);
496485

497486
$f = HTML::Form->parse( <<EOT, "http://www.example.com" );
498487
<form ACTION="http://example.com/">
@@ -616,13 +605,14 @@ $f = HTML::Form->parse( <<EOT, base => "http://localhost/" );
616605
</form>
617606
EOT
618607

619-
is_maybe_nl( $f->click->as_string, <<EOT);
608+
chomp(my $expected_button_go = <<EOT);
620609
POST http://localhost/
621610
Content-Length: 9
622611
Content-Type: application/x-www-form-urlencoded
623612
624613
submit=go
625614
EOT
615+
is( $f->click->as_string, $expected_button_go);
626616

627617
$f = HTML::Form->parse( <<EOT, base => "http://localhost/" );
628618
<form method=post>
@@ -631,13 +621,14 @@ $f = HTML::Form->parse( <<EOT, base => "http://localhost/" );
631621
</form>
632622
EOT
633623

634-
is_maybe_nl( $f->click->as_string, <<EOT);
624+
chomp(my $expected_button_empty = <<EOT);
635625
POST http://localhost/
636626
Content-Length: 7
637627
Content-Type: application/x-www-form-urlencoded
638628
639629
submit=
640630
EOT
631+
is( $f->click->as_string, $expected_button_empty);
641632

642633
# select with a name followed by select without a name GH#2
643634
$f = HTML::Form->parse( <<EOT, "http://localhost/" );

0 commit comments

Comments
 (0)