File: bad-request.t

package info (click to toggle)
libwww-mechanize-perl 2.20-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,080 kB
  • sloc: perl: 4,623; makefile: 6
file content (35 lines) | stat: -rw-r--r-- 552 bytes parent folder | download | duplicates (2)
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";