diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2015-06-16 06:44:29 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2015-06-16 06:44:29 +0000 |
commit | f9f3ab3056d94292adb4ab2e1451645bee989769 (patch) | |
tree | cc5a62954d359d5aad449420bc7ec259b3edb79e /t/headers/cookie.t | |
download | CGI-tarball-master.tar.gz |
Diffstat (limited to 't/headers/cookie.t')
-rw-r--r-- | t/headers/cookie.t | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/t/headers/cookie.t b/t/headers/cookie.t new file mode 100644 index 0000000..a62f6fd --- /dev/null +++ b/t/headers/cookie.t @@ -0,0 +1,34 @@ +use strict; +use CGI; +use Test::More; + +{ + my $cgi = CGI->new; + my $got = $cgi->header( -cookie => 'foo' ); + my $expected = "^Set-Cookie: foo$CGI::CRLF" + . "Date: [^$CGI::CRLF]+$CGI::CRLF" + . 'Content-Type: text/html; charset=ISO-8859-1' + . $CGI::CRLF x 2; + like $got, qr($expected), 'cookie'; +} + +{ + my $cgi = CGI->new; + my $got = $cgi->header( -cookie => [ 'foo', 'bar' ] ); + my $expected = "^Set-Cookie: foo$CGI::CRLF" + . "Set-Cookie: bar$CGI::CRLF" + . "Date: [^$CGI::CRLF]+$CGI::CRLF" + . 'Content-Type: text/html; charset=ISO-8859-1' + . $CGI::CRLF x 2; + like $got, qr($expected), 'cookie arrayref'; +} + +{ + my $cgi = CGI->new; + my $got = $cgi->header( -cookie => q{} ); + my $expected = 'Content-Type: text/html; charset=ISO-8859-1' + . $CGI::CRLF x 2; + is $got, $expected, 'cookie empty string'; +} + +done_testing; |