]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blob - t/cgi_page_from_404.t
CGI: pad error responses with 512 bytes of spaces so IE will display them
[git.ikiwiki.info.git] / t / cgi_page_from_404.t
1 #!/usr/bin/perl
2 use warnings;
3 use strict;
4 use Test::More tests => 18;
6 BEGIN { use_ok("IkiWiki"); }
7 BEGIN { use_ok("IkiWiki::CGI"); }
9 sub cgi_page_from_404 { return IkiWiki::cgi_page_from_404(shift, shift, shift); }
11 $IkiWiki::config{htmlext} = 'html';
13 is(cgi_page_from_404('/', 'http://example.com', 1), 'index');
14 is(cgi_page_from_404('/index.html', 'http://example.com', 0), 'index');
15 is(cgi_page_from_404('/', 'http://example.com/', 1), 'index');
16 is(cgi_page_from_404('/index.html', 'http://example.com/', 0), 'index');
18 is(cgi_page_from_404('/~user/foo/bar', 'http://example.com/~user', 1),
19    'foo/bar');
20 is(cgi_page_from_404('/~user/foo/bar/index.html', 'http://example.com/~user', 1),
21    'foo/bar');
22 is(cgi_page_from_404('/~user/foo/bar/', 'http://example.com/~user', 1),
23    'foo/bar');
24 is(cgi_page_from_404('/~user/foo/bar.html', 'http://example.com/~user', 0),
25    'foo/bar');
27 is(cgi_page_from_404('/~user/foo/bar', 'http://example.com/~user/', 1),
28    'foo/bar');
29 is(cgi_page_from_404('/~user/foo/bar/index.html', 'http://example.com/~user/', 1),
30    'foo/bar');
31 is(cgi_page_from_404('/~user/foo/bar/', 'http://example.com/~user/', 1),
32    'foo/bar');
33 is(cgi_page_from_404('/~user/foo/bar.html', 'http://example.com/~user/', 0),
34    'foo/bar');
36 is(cgi_page_from_404('/~user/foo', 'https://example.com/~user', 1),
37    'foo');
38 is(cgi_page_from_404('/~user/foo/index.html', 'https://example.com/~user', 1),
39    'foo');
40 is(cgi_page_from_404('/~user/foo/', 'https://example.com/~user', 1),
41    'foo');
42 is(cgi_page_from_404('/~user/foo.html', 'https://example.com/~user', 0),
43    'foo');