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);
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),
21 is
(cgi_page_from_404
('/~user/foo/bar/index.html', 'http://example.com/~user', 1),
23 is
(cgi_page_from_404
('/~user/foo/bar/', 'http://example.com/~user', 1),
25 is
(cgi_page_from_404
('/~user/foo/bar.html', 'http://example.com/~user', 0),
28 is
(cgi_page_from_404
('/~user/foo/bar', 'http://example.com/~user/', 1),
30 is
(cgi_page_from_404
('/~user/foo/bar/index.html', 'http://example.com/~user/', 1),
32 is
(cgi_page_from_404
('/~user/foo/bar/', 'http://example.com/~user/', 1),
34 is
(cgi_page_from_404
('/~user/foo/bar.html', 'http://example.com/~user/', 0),
37 is
(cgi_page_from_404
('/~user/foo', 'https://example.com/~user', 1),
39 is
(cgi_page_from_404
('/~user/foo/index.html', 'https://example.com/~user', 1),
41 is
(cgi_page_from_404
('/~user/foo/', 'https://example.com/~user', 1),
43 is
(cgi_page_from_404
('/~user/foo.html', 'https://example.com/~user', 0),