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 32 33 34 35
|
#!perl
use warnings;
use strict;
use Test::More tests => 2;
=head1 NAME
bad-request.t
=head1 SYNOPSIS
Tests the detection of bad API usage.
->request()
Checks for behaviour of calls to C<< ->request() >> without the required
parameter.
=cut
use WWW::Mechanize ();
my $mech = WWW::Mechanize->new();
my $lives = eval {
#line 1
$mech->request();
1;
};
my $err = $@;
ok !$lives, "->request wants at least one parameter";
like $err, qr/->request was called without a request parameter/,
"We carp with a descriptive error message";
|