From 3b83e520182a83e4ae6c61ab7b360b0eb939469f Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 31 Jan 2009 19:26:36 -0500 Subject: rename apache404 -> 404 This may already work with other web servers that have copied apache's interface, and it should be easy to add support to it for web servers that use some other interface. So, make the name more general. --- t/404.t | 44 ++++++++++++++++++++++++++++++++++++++++++++ t/apache404.t | 45 --------------------------------------------- 2 files changed, 44 insertions(+), 45 deletions(-) create mode 100755 t/404.t delete mode 100755 t/apache404.t (limited to 't') diff --git a/t/404.t b/t/404.t new file mode 100755 index 000000000..0bb3c6063 --- /dev/null +++ b/t/404.t @@ -0,0 +1,44 @@ +#!/usr/bin/perl +use warnings; +use strict; +use Test::More tests => 17; + +BEGIN { use_ok("IkiWiki::Plugin::404"); } + +sub cgi_page_from_404 { + return IkiWiki::Plugin::404::cgi_page_from_404(shift, shift, shift); +} + +$IkiWiki::config{htmlext} = 'html'; + +is(cgi_page_from_404('/', 'http://example.com', 1), 'index'); +is(cgi_page_from_404('/index.html', 'http://example.com', 0), 'index'); +is(cgi_page_from_404('/', 'http://example.com/', 1), 'index'); +is(cgi_page_from_404('/index.html', 'http://example.com/', 0), 'index'); + +is(cgi_page_from_404('/~user/foo/bar', 'http://example.com/~user', 1), + 'foo/bar'); +is(cgi_page_from_404('/~user/foo/bar/index.html', 'http://example.com/~user', 1), + 'foo/bar'); +is(cgi_page_from_404('/~user/foo/bar/', 'http://example.com/~user', 1), + 'foo/bar'); +is(cgi_page_from_404('/~user/foo/bar.html', 'http://example.com/~user', 0), + 'foo/bar'); + +is(cgi_page_from_404('/~user/foo/bar', 'http://example.com/~user/', 1), + 'foo/bar'); +is(cgi_page_from_404('/~user/foo/bar/index.html', 'http://example.com/~user/', 1), + 'foo/bar'); +is(cgi_page_from_404('/~user/foo/bar/', 'http://example.com/~user/', 1), + 'foo/bar'); +is(cgi_page_from_404('/~user/foo/bar.html', 'http://example.com/~user/', 0), + 'foo/bar'); + +is(cgi_page_from_404('/~user/foo', 'https://example.com/~user', 1), + 'foo'); +is(cgi_page_from_404('/~user/foo/index.html', 'https://example.com/~user', 1), + 'foo'); +is(cgi_page_from_404('/~user/foo/', 'https://example.com/~user', 1), + 'foo'); +is(cgi_page_from_404('/~user/foo.html', 'https://example.com/~user', 0), + 'foo'); diff --git a/t/apache404.t b/t/apache404.t deleted file mode 100755 index 00fc35250..000000000 --- a/t/apache404.t +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/bin/perl -use warnings; -use strict; -use Test::More tests => 17; - -BEGIN { use_ok("IkiWiki::Plugin::apache404"); } - -sub cgi_page_from_404 { - return IkiWiki::Plugin::apache404::cgi_page_from_404(shift, shift, - shift); -} - -$IkiWiki::config{htmlext} = 'html'; - -is(cgi_page_from_404('/', 'http://example.com', 1), 'index'); -is(cgi_page_from_404('/index.html', 'http://example.com', 0), 'index'); -is(cgi_page_from_404('/', 'http://example.com/', 1), 'index'); -is(cgi_page_from_404('/index.html', 'http://example.com/', 0), 'index'); - -is(cgi_page_from_404('/~user/foo/bar', 'http://example.com/~user', 1), - 'foo/bar'); -is(cgi_page_from_404('/~user/foo/bar/index.html', 'http://example.com/~user', 1), - 'foo/bar'); -is(cgi_page_from_404('/~user/foo/bar/', 'http://example.com/~user', 1), - 'foo/bar'); -is(cgi_page_from_404('/~user/foo/bar.html', 'http://example.com/~user', 0), - 'foo/bar'); - -is(cgi_page_from_404('/~user/foo/bar', 'http://example.com/~user/', 1), - 'foo/bar'); -is(cgi_page_from_404('/~user/foo/bar/index.html', 'http://example.com/~user/', 1), - 'foo/bar'); -is(cgi_page_from_404('/~user/foo/bar/', 'http://example.com/~user/', 1), - 'foo/bar'); -is(cgi_page_from_404('/~user/foo/bar.html', 'http://example.com/~user/', 0), - 'foo/bar'); - -is(cgi_page_from_404('/~user/foo', 'https://example.com/~user', 1), - 'foo'); -is(cgi_page_from_404('/~user/foo/index.html', 'https://example.com/~user', 1), - 'foo'); -is(cgi_page_from_404('/~user/foo/', 'https://example.com/~user', 1), - 'foo'); -is(cgi_page_from_404('/~user/foo.html', 'https://example.com/~user', 0), - 'foo'); -- cgit v1.2.3