From 552db5b79604f6c669eb0a63069b3a5501135e9e Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Mon, 20 Feb 2012 09:07:27 +0100 Subject: [PATCH] t/50-cgi: todo test for upcoming multipart posts Common HTML feature which is not yet handled correctly. --- t/50-cgi.t | 18 +++++++++++++----- t/50-cgi/70-multipart.html | 2 ++ t/50-cgi/70-multipart.plp | 5 +++++ t/50-cgi/70-multipart.txt | 10 ++++++++++ 4 files changed, 30 insertions(+), 5 deletions(-) create mode 100644 t/50-cgi/70-multipart.html create mode 100644 t/50-cgi/70-multipart.plp create mode 100644 t/50-cgi/70-multipart.txt diff --git a/t/50-cgi.t b/t/50-cgi.t index 0f3eeaf..aaea969 100644 --- a/t/50-cgi.t +++ b/t/50-cgi.t @@ -24,7 +24,7 @@ eval { eval { require PerlIO::scalar }; plan skip_all => "PerlIO required (perl 5.8) to test PLP" if $@; -plan tests => 24; +plan tests => 25; require_ok('PLP::Backend::CGI') or BAIL_OUT(); @@ -56,8 +56,8 @@ sub plp_is { ); # Apache/2.2.4 CGI environment if (defined $in) { - $ENV{CONTENT_LENGTH} = length $in; - $ENV{CONTENT_TYPE} = 'application/x-www-form-urlencoded'; + $ENV{CONTENT_LENGTH} //= length $in; + $ENV{CONTENT_TYPE} //= 'application/x-www-form-urlencoded'; close STDIN; open STDIN, '<', $in; } @@ -176,12 +176,20 @@ SKIP: { plp_ok($_, INCWARN => $INCWARN) for @inctests; } -# 4*-7*: apache environment (default) -plp_ok($_) for glob '[4-7]*.html'; +# 4*-6*: apache environment (default) +plp_ok($_) for glob '[4-6]*.html'; #TODO: %fields #TODO: %cookie +# 7*: multipart posts +TODO: { + local $TODO = 'future feature'; + plp_ok($_, -env => { + CONTENT_TYPE => 'multipart/form-data; boundary=knip', + }) for glob '7*.html'; +} + # 8*: lighttpd environment plp_ok($_, -env => { # lighttpd/1.4.7 CGI environment diff --git a/t/50-cgi/70-multipart.html b/t/50-cgi/70-multipart.html new file mode 100644 index 0000000..3ca132a --- /dev/null +++ b/t/50-cgi/70-multipart.html @@ -0,0 +1,2 @@ +$HEAD +3{'foo' => 'b a r','@foo' => ['','b a r']} diff --git a/t/50-cgi/70-multipart.plp b/t/50-cgi/70-multipart.plp new file mode 100644 index 0000000..1fc42b5 --- /dev/null +++ b/t/50-cgi/70-multipart.plp @@ -0,0 +1,5 @@ +<: +print scalar keys %post; + +require Data::Dumper; +print Data::Dumper->new([\%post])->Indent(0)->Terse(1)->Dump; diff --git a/t/50-cgi/70-multipart.txt b/t/50-cgi/70-multipart.txt new file mode 100644 index 0000000..e8e7fb6 --- /dev/null +++ b/t/50-cgi/70-multipart.txt @@ -0,0 +1,10 @@ +--knip +Content-Disposition: form-data; name="foo" + +b a r +--knip +Content-Disposition: form-data; name="upload"; filename="82.results" +Content-Type: text/plain + +ok +--knip-- -- 2.30.0