From bac347c3605b37a1839937a689e380303a9085a4 Mon Sep 17 00:00:00 2001 From: DongHun Kwak Date: Mon, 25 Jul 2022 08:07:46 +0900 Subject: Imported Upstream version 4.11 --- t/01basic.t | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 't/01basic.t') 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"); -- cgit v1.2.3