File: bad-url-with-options.t

package info (click to toggle)
libweb-query-perl 1.01-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 424 kB
  • sloc: perl: 984; xml: 329; makefile: 2
file content (28 lines) | stat: -rw-r--r-- 551 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
24
25
26
27
28
use Test2::V0;
use Test2::Tools::Exception qw/dies/;

use strict;
use warnings;
use utf8;
use LWP::UserAgent;
use Web::Query;

my $ua = $Web::Query::UserAgent = LWP::UserAgent->new( agent => 'Mozilla/5.0' );

$ua->add_handler(request_send => sub {
    my ($request) = @_;
    my $code = $request->uri->host eq 'bad.com' ? 500 : 200;
    return HTTP::Response->new($code);
});

plan tests => 2;

ok dies {
    Web::Query->new('http://bad.com/');
}, "without options";

ok dies {
    Web::Query->new('http://bad.com/',{indent=>3});
}, "with options";