aboutsummaryrefslogtreecommitdiff
path: root/t/404.t
diff options
context:
space:
mode:
authorJoey Hess <joey@gnu.kitenet.net>2009-01-31 19:26:36 -0500
committerJoey Hess <joey@gnu.kitenet.net>2009-01-31 19:26:36 -0500
commit3b83e520182a83e4ae6c61ab7b360b0eb939469f (patch)
tree540e62579bb246a411d25fac866968605ee496f7 /t/404.t
parente5c8bc6222712fe9f465d4ac36350fd4ea729787 (diff)
downloadikiwiki-3b83e520182a83e4ae6c61ab7b360b0eb939469f.tar
ikiwiki-3b83e520182a83e4ae6c61ab7b360b0eb939469f.tar.gz
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.
Diffstat (limited to 't/404.t')
-rwxr-xr-xt/404.t44
1 files changed, 44 insertions, 0 deletions
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');