summaryrefslogtreecommitdiffstats
path: root/t/response-compatible.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-compatible.t
parenta2986198eb809d38bd99e7c56cd80e27ff6394f0 (diff)
downloadweb-request-b275579910d410e7f9ecff88cccdeb673191d332.tar.gz
web-request-b275579910d410e7f9ecff88cccdeb673191d332.zip
import the Plack::Response test suite
Diffstat (limited to 't/response-compatible.t')
-rw-r--r--t/response-compatible.t60
1 files changed, 60 insertions, 0 deletions
diff --git a/t/response-compatible.t b/t/response-compatible.t
new file mode 100644
index 0000000..9fa8e54
--- /dev/null
+++ b/t/response-compatible.t
@@ -0,0 +1,60 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use Test::More;
+
+use Web::Response;
+
+{
+ my $res = Web::Response->new;
+ $res->status(200);
+ $res->header("Foo:Bar" => "baz");
+ $res->body("Hello");
+
+ is_deeply $res->finalize, [ 200, [ 'Foo:Bar' => 'baz' ], ["Hello"] ];
+}
+
+{
+ my $res = Web::Response->new;
+ $res->status(200);
+ $res->header("Foo\000Bar" => "baz");
+ $res->header("Qux\177Quux" => "42");
+ $res->body("Hello");
+
+ is_deeply $res->finalize, [ 200, [ "Foo\000Bar" => 'baz', "Qux\177Quux" => '42' ], ["Hello"] ];
+}
+
+{
+ my $res = Web::Response->new;
+ $res->status(200);
+ $res->header("X-LWS-I" => "Bar\r\n true");
+ $res->header("X-LWS-II" => "Bar\r\n\t\ttrue");
+ $res->body("Hello");
+
+ is_deeply $res->finalize,
+ [
+ 200,
+ [ 'X-LWS-I' => 'Bar true', 'X-LWS-II' => 'Bar true' ],
+ ["Hello"]
+ ];
+}
+
+{
+ my $res = Web::Response->new;
+ $res->status(200);
+ $res->header("X-CR-LF" => "Foo\nBar\rBaz");
+ $res->body("Hello");
+
+ is_deeply $res->finalize, [ 200, [ 'X-CR-LF' => 'FooBarBaz' ], ["Hello"] ];
+}
+
+{
+ my $res = Web::Response->new;
+ $res->status(200);
+ $res->header("X-CR-LF" => "Foo\nBar\rBaz");
+ $res->body("Hello");
+
+ is_deeply $res->finalize, [ 200, [ 'X-CR-LF' => 'FooBarBaz' ], ["Hello"] ];
+}
+
+done_testing;