]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blob - t/404.t
Rebuild for jessie-backports.
[git.ikiwiki.info.git] / t / 404.t
1 #!/usr/bin/perl
2 use warnings;
3 use strict;
4 use Test::More tests => 17;
6 BEGIN { use_ok("IkiWiki::Plugin::404"); }
8 sub cgi_page_from_404 {
9         return IkiWiki::Plugin::404::cgi_page_from_404(shift, shift, shift);
10 }
12 $IkiWiki::config{htmlext} = 'html';
14 is(cgi_page_from_404('/', 'http://example.com', 1), 'index');
15 is(cgi_page_from_404('/index.html', 'http://example.com', 0), 'index');
16 is(cgi_page_from_404('/', 'http://example.com/', 1), 'index');
17 is(cgi_page_from_404('/index.html', 'http://example.com/', 0), 'index');
19 is(cgi_page_from_404('/~user/foo/bar', 'http://example.com/~user', 1),
20    'foo/bar');
21 is(cgi_page_from_404('/~user/foo/bar/index.html', 'http://example.com/~user', 1),
22    'foo/bar');
23 is(cgi_page_from_404('/~user/foo/bar/', 'http://example.com/~user', 1),
24    'foo/bar');
25 is(cgi_page_from_404('/~user/foo/bar.html', 'http://example.com/~user', 0),
26    'foo/bar');
28 is(cgi_page_from_404('/~user/foo/bar', 'http://example.com/~user/', 1),
29    'foo/bar');
30 is(cgi_page_from_404('/~user/foo/bar/index.html', 'http://example.com/~user/', 1),
31    'foo/bar');
32 is(cgi_page_from_404('/~user/foo/bar/', 'http://example.com/~user/', 1),
33    'foo/bar');
34 is(cgi_page_from_404('/~user/foo/bar.html', 'http://example.com/~user/', 0),
35    'foo/bar');
37 is(cgi_page_from_404('/~user/foo', 'https://example.com/~user', 1),
38    'foo');
39 is(cgi_page_from_404('/~user/foo/index.html', 'https://example.com/~user', 1),
40    'foo');
41 is(cgi_page_from_404('/~user/foo/', 'https://example.com/~user', 1),
42    'foo');
43 is(cgi_page_from_404('/~user/foo.html', 'https://example.com/~user', 0),
44    'foo');