"Fossies" - the Fresh Open Source Software Archive 
Member "perl-5.32.1/cpan/HTTP-Tiny/t/004_timeout.t" (18 Dec 2020, 827 Bytes) of package /linux/misc/perl-5.32.1.tar.xz:
As a special service "Fossies" has tried to format the requested text file into HTML format (style:
standard) with prefixed line numbers.
Alternatively you can here
view or
download the uninterpreted source code file.
1 #!perl
2
3 use strict;
4 use warnings;
5
6 use Test::More tests => 5;
7 use HTTP::Tiny;
8
9 # Just make sure timeout is handled correctly as a constructor param,
10 # and that it works as expected as an "attribute".
11
12 my $default = 60;
13
14 {
15 my $ua = HTTP::Tiny->new();
16 is $ua->timeout, $default, 'default timeout is as expected';
17 }
18
19 {
20 my $ua = HTTP::Tiny->new(timeout => 10);
21 is $ua->timeout, 10, 'timeout is handled as a constructor param';
22 }
23
24 {
25 my $ua = HTTP::Tiny->new(timeout => 0);
26 is $ua->timeout, 0, 'constructor arg of timeout=0 is passed through';
27 }
28
29 {
30 my $ua = HTTP::Tiny->new(timeout => undef);
31 is $ua->timeout, $default, 'constructor arg of timeout=undef is ignored';
32 }
33
34 {
35 my $ua = HTTP::Tiny->new();
36 $ua->timeout(15);
37 is $ua->timeout, 15, 'timeout works as expected as a r/w attribute';
38 }