| Server IP : 45.40.142.9 / Your IP : 216.73.216.250 Web Server : Apache System : Linux s45-40-142-9.secureserver.net 2.6.32-754.35.1.el6.x86_64 #1 SMP Sat Nov 7 12:42:14 UTC 2020 x86_64 User : bayspec ( 506) PHP Version : 5.6.40 Disable Function : NONE MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /.cpanm/latest-build/HTTP-Tiny-0.070/t/ |
Upload File : |
#!perl
use strict;
use warnings;
use Test::More tests => 5;
use HTTP::Tiny;
# Just make sure timeout is handled correctly as a constructor param,
# and that it works as expected as an "attribute".
my $default = 60;
{
my $ua = HTTP::Tiny->new();
is $ua->timeout, $default, 'default timeout is as expected';
}
{
my $ua = HTTP::Tiny->new(timeout => 10);
is $ua->timeout, 10, 'timeout is handled as a constructor param';
}
{
my $ua = HTTP::Tiny->new(timeout => 0);
is $ua->timeout, 0, 'constructor arg of timeout=0 is passed through';
}
{
my $ua = HTTP::Tiny->new(timeout => undef);
is $ua->timeout, $default, 'constructor arg of timeout=undef is ignored';
}
{
my $ua = HTTP::Tiny->new();
$ua->timeout(15);
is $ua->timeout, 15, 'timeout works as expected as a r/w attribute';
}