File: autoload.t

package info (click to toggle)
libwww-perl 6.78-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,008 kB
  • sloc: perl: 4,148; makefile: 10; sh: 6
file content (32 lines) | stat: -rw-r--r-- 689 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
use strict;
use warnings;
use Test::More;

use HTTP::Request ();
use LWP::UserAgent ();
use URI ();

plan tests => 4;

#
# See if autoloading of protocol schemes work
#
# note no LWP::Protocol::file;

my $url = "file:.";
is(URI->new($url)->file, '.', 'URI of file:. is .');

my $ua = LWP::UserAgent->new;   # create a useragent to test

$ua->timeout(30);
is($ua->timeout(), 30, 'timeout: set to 30 seconds');

my $request = HTTP::Request->new(GET => $url);

my $response = $ua->request($request);
isa_ok($response, 'HTTP::Response', 'Got a proper response');

ok( $response->is_success(), 'Response was successful' );
unless($response->is_success()) {
    diag $response->error_as_HTML;
}