* [PATCH 5/6] t/cgi.t: move expected failure tests to t/plack.t
2019-01-04 13:10 5% [PATCH 0/6] t/cgi.t: test speedups and cleanups Eric Wong
@ 2019-01-04 13:10 7% ` Eric Wong
0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2019-01-04 13:10 UTC (permalink / raw)
To: meta
No point in implementing these slowly with the CGI wrapper
when PSGI is sufficient for testing.
---
t/cgi.t | 10 ----------
t/plack.t | 13 +++++++++++++
2 files changed, 13 insertions(+), 10 deletions(-)
diff --git a/t/cgi.t b/t/cgi.t
index a25d2ee..e705cd7 100644
--- a/t/cgi.t
+++ b/t/cgi.t
@@ -80,16 +80,6 @@ EOF
$im->done;
}
-# obvious failures, first
-{
- local $ENV{HOME} = $home;
- my $res = cgi_run("/", "", "PUT");
- like($res->{head}, qr/Status:\s*405/i, "PUT not allowed");
-
- $res = cgi_run("/");
- like($res->{head}, qr/Status:\s*404/i, "index returns 404");
-}
-
# message-id pages
{
local $ENV{HOME} = $home;
diff --git a/t/plack.t b/t/plack.t
index 14c9b65..9901186 100644
--- a/t/plack.t
+++ b/t/plack.t
@@ -240,6 +240,19 @@ EOF
is(206, $res->code, 'got partial another response');
is($res->content, substr($orig, 5), 'partial body OK past end');
});
+
+ # things which should fail
+ test_psgi($app, sub {
+ my ($cb) = @_;
+
+ my $res = $cb->(PUT('/'));
+ is(405, $res->code, 'no PUT to / allowed');
+ $res = $cb->(PUT('/test/'));
+ is(405, $res->code, 'no PUT /$INBOX allowed');
+
+ # TODO
+ # $res = $cb->(GET('/'));
+ });
}
done_testing();
--
EW
^ permalink raw reply related [relevance 7%]
* [PATCH 0/6] t/cgi.t: test speedups and cleanups
@ 2019-01-04 13:10 5% Eric Wong
2019-01-04 13:10 7% ` [PATCH 5/6] t/cgi.t: move expected failure tests to t/plack.t Eric Wong
0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2019-01-04 13:10 UTC (permalink / raw)
To: meta
While we relied on CGI.pm early in the project, we've moved onto PSGI
and relied on PSGI for providing CGI compatibility. Thus, most of our
CGI-based tests are redundant and Perl startup overhead is painful.
On my system, this cuts the t/cgi.t from 4.4s to 1.8s for a nice
improvement. Moving some tests to t/plack.t did not increase runtimes
in a meaningful way.
Eric Wong (6):
t/cgi.t: eliminate some cruft and unnecessary tests
t/cgi.t: remove redundant redirect check
t/cgi.t: remove atom.xml test
t/cgi.t: move dumb HTTP git clone/fetch tests to plack.t
t/cgi.t: move expected failure tests to t/plack.t
t/cgi.t: remove more redundant tests
t/cgi.t | 105 ++++++++----------------------------------------------
t/plack.t | 43 ++++++++++++++++++++--
2 files changed, 54 insertions(+), 94 deletions(-)
--
EW
^ permalink raw reply [relevance 5%]
Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2019-01-04 13:10 5% [PATCH 0/6] t/cgi.t: test speedups and cleanups Eric Wong
2019-01-04 13:10 7% ` [PATCH 5/6] t/cgi.t: move expected failure tests to t/plack.t Eric Wong
Code repositories for project(s) associated with this public inbox
https://80x24.org/public-inbox.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).