summaryrefslogtreecommitdiff
path: root/t/headers/cookie.t
diff options
context:
space:
mode:
Diffstat (limited to 't/headers/cookie.t')
-rw-r--r--t/headers/cookie.t34
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;