summaryrefslogtreecommitdiff
path: root/t/404.t
diff options
context:
space:
mode:
authorintrigeri <intrigeri@boum.org>2009-03-08 09:50:27 +0100
committerintrigeri <intrigeri@boum.org>2009-03-08 09:50:27 +0100
commitae474d8e14631ff519ed7d54bb64eaa0538f56d9 (patch)
tree09637db5faf2632b67b581cf04463fe4493584d4 /t/404.t
parent0314ed459ba1c49fad9170a54cc05f1c9e9c96bf (diff)
parent08e4472fc469c630ebef93e16a66a5a69d9cb33a (diff)
Merge commit 'upstream/master' into prv/po
Conflicts: IkiWiki/Plugin/editpage.pm debian/control debian/copyright doc/todo/need_global_renamepage_hook.mdwn Signed-off-by: intrigeri <intrigeri@boum.org>
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');