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