summaryrefslogtreecommitdiffstats
path: root/t/response.t
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2012-07-18 16:43:57 -0500
committerJesse Luehrs <doy@tozt.net>2012-07-18 16:43:57 -0500
commitb275579910d410e7f9ecff88cccdeb673191d332 (patch)
treeb1ca4397924ad7a0dd46e9f693edca7eba82a9cf /t/response.t
parenta2986198eb809d38bd99e7c56cd80e27ff6394f0 (diff)
downloadweb-request-b275579910d410e7f9ecff88cccdeb673191d332.tar.gz
web-request-b275579910d410e7f9ecff88cccdeb673191d332.zip
import the Plack::Response test suite
Diffstat (limited to 't/response.t')
-rw-r--r--t/response.t53
1 files changed, 53 insertions, 0 deletions
diff --git a/t/response.t b/t/response.t
new file mode 100644
index 0000000..a189c4d
--- /dev/null
+++ b/t/response.t
@@ -0,0 +1,53 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use Test::More;
+
+use Web::Response;
+
+sub res {
+ my $res = Web::Response->new;
+ my %v = @_;
+ while (my($k, $v) = each %v) {
+ $res->$k($v);
+ }
+ $res->finalize;
+}
+
+is_deeply(
+ res(
+ status => 200,
+ body => 'hello',
+ ),
+ [ 200, +[], [ 'hello' ] ]
+);
+is_deeply(
+ res(
+ status => 200,
+ cookies => +{
+ 'foo_sid' => +{
+ value => 'ASDFJKL:',
+ expires => 'Thu, 25-Apr-1999 00:40:33 GMT',
+ domain => 'example.com',
+ path => '/',
+ },
+ 'poo_sid' => +{
+ value => 'QWERTYUI',
+ expires => 'Thu, 25-Apr-1999 00:40:33 GMT',
+ domain => 'example.com',
+ path => '/',
+ },
+ },
+ body => 'hello',
+ ),
+ [
+ 200,
+ +[
+ 'Set-Cookie' => 'poo_sid=QWERTYUI; domain=example.com; path=/; expires=Thu, 25-Apr-1999 00:40:33 GMT',
+ 'Set-Cookie' => 'foo_sid=ASDFJKL%3A; domain=example.com; path=/; expires=Thu, 25-Apr-1999 00:40:33 GMT',
+ ],
+ [ 'hello' ],
+ ]
+);
+
+done_testing;