add keepextension tests
[ikiwiki] / t / pagename.t
1 #!/usr/bin/perl
2 use warnings;
3 use strict;
4 use Test::More tests => 8;
5
6 BEGIN { use_ok("IkiWiki"); }
7
8 # Used internally.
9 $IkiWiki::hooks{htmlize}{mdwn}={};
10 $IkiWiki::hooks{htmlize}{txt}={keepextension => 1};
11
12 is(pagename("foo.mdwn"), "foo");
13 is(pagename("foo/bar.mdwn"), "foo/bar");
14
15 # bare files get the full filename as page name
16 is(pagename("foo.png"), "foo.png");
17 is(pagename("foo/bar.png"), "foo/bar.png");
18 is(pagename("foo"), "foo");
19
20 # keepextension preserves the extension in the page name
21 is(pagename("foo.txt"), "foo.txt");
22 is(pagename("foo/bar.txt"), "foo/bar.txt");