diff options
author | DongHun Kwak <dh0128.kwak@samsung.com> | 2022-07-25 08:07:46 +0900 |
---|---|---|
committer | DongHun Kwak <dh0128.kwak@samsung.com> | 2022-07-25 08:07:46 +0900 |
commit | bac347c3605b37a1839937a689e380303a9085a4 (patch) | |
tree | 9cda36fd2c11df9aaa40660149bf688ce66d14ce /t/01basic.t | |
parent | 3d7755f418633e4b2eda8c8a4b1ae156ec1b65ed (diff) | |
download | perl-WWW-Curl-bac347c3605b37a1839937a689e380303a9085a4.tar.gz perl-WWW-Curl-bac347c3605b37a1839937a689e380303a9085a4.tar.bz2 perl-WWW-Curl-bac347c3605b37a1839937a689e380303a9085a4.zip |
Imported Upstream version 4.11upstream/4.11
Diffstat (limited to 't/01basic.t')
-rw-r--r-- | t/01basic.t | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/t/01basic.t b/t/01basic.t index 5b4d175..58fdf4d 100644 --- a/t/01basic.t +++ b/t/01basic.t @@ -2,14 +2,14 @@ use strict; use warnings; -use Test::More tests => 14; +use Test::More tests => 18; use File::Temp qw/tempfile/; BEGIN { use_ok( 'WWW::Curl::Easy' ); } my $url = $ENV{CURL_TEST_URL} || "http://www.google.com"; -my $memfile = ''; + # Init the curl session my $curl = WWW::Curl::Easy->new(); ok($curl, 'Curl session initialize returns something'); @@ -18,6 +18,8 @@ ok(ref($curl) eq 'WWW::Curl::Easy', 'Curl session looks like an object from the ok(! $curl->setopt(CURLOPT_NOPROGRESS, 1), "Setting CURLOPT_NOPROGRESS"); ok(! $curl->setopt(CURLOPT_FOLLOWLOCATION, 1), "Setting CURLOPT_FOLLOWLOCATION"); ok(! $curl->setopt(CURLOPT_TIMEOUT, 30), "Setting CURLOPT_TIMEOUT"); +ok(! $curl->setopt(CURLOPT_ENCODING, undef), "Setting CURLOPT_ENCODING to undef"); +ok(! $curl->setopt(CURLOPT_RESUME_FROM_LARGE, 0), "Setting CURLOPT_RESUME_FROM_LARGE to 0"); $curl->setopt(CURLOPT_HEADER, 1); my $head = tempfile(); @@ -33,6 +35,7 @@ $myheaders[0] = "Server: www"; $myheaders[1] = "User-Agent: Perl interface for libcURL"; ok(! $curl->setopt(CURLOPT_HTTPHEADER, \@myheaders), "Setting CURLOPT_HTTPHEADER"); +$curl->setopt(CURLOPT_COOKIEFILE, ""); my $retcode = $curl->perform(); ok(! $retcode, "Curl return code ok"); @@ -43,6 +46,14 @@ my $realurl = $curl->getinfo(CURLINFO_EFFECTIVE_URL); ok( $realurl, "getinfo returns CURLINFO_EFFECTIVE_URL"); my $httpcode = $curl->getinfo(CURLINFO_HTTP_CODE); ok( $httpcode, "getinfo returns CURLINFO_HTTP_CODE"); + +SKIP: { + skip "Only testing cookies against google.com", 2 unless $url eq "http://www.google.com"; + my $cookies = $curl->getinfo(CURLINFO_COOKIELIST); + is(ref $cookies, "ARRAY", "Returned array reference"); + ok(@$cookies > 0, "Got 1 or more cookies"); +} + #diag ("Bytes: $bytes"); #diag ("realurl: $realurl"); #diag ("httpcode: $httpcode"); |