]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blob - t/pagename.t
Merge commit 'upstream/master' into prv/po
[git.ikiwiki.info.git] / t / pagename.t
1 #!/usr/bin/perl
2 use warnings;
3 use strict;
4 use Test::More tests => 19;
6 BEGIN { use_ok("IkiWiki"); }
8 # define mdwn as an extension
9 $IkiWiki::hooks{htmlize}{mdwn}={};
10 is(pagetype("foo.mdwn"), "mdwn");
11 is(pagename("foo.mdwn"), "foo");
12 is(pagetype("foo/bar.mdwn"), "mdwn");
13 is(pagename("foo/bar.mdwn"), "foo/bar");
15 # bare files get the full filename as page name, undef type
16 is(pagetype("foo.png"), undef);
17 is(pagename("foo.png"), "foo.png");
18 is(pagetype("foo/bar.png"), undef);
19 is(pagename("foo/bar.png"), "foo/bar.png");
20 is(pagetype("foo"), undef);
21 is(pagename("foo"), "foo");
23 # keepextension preserves the extension in the page name
24 $IkiWiki::hooks{htmlize}{txt}={keepextension => 1};
25 is(pagename("foo.txt"), "foo.txt");
26 is(pagetype("foo.txt"), "txt");
27 is(pagename("foo/bar.txt"), "foo/bar.txt");
28 is(pagetype("foo/bar.txt"), "txt");
30 # noextension makes extensionless files be treated as first-class pages
31 $IkiWiki::hooks{htmlize}{Makefile}={noextension =>1};
32 is(pagetype("Makefile"), "Makefile");
33 is(pagename("Makefile"), "Makefile");
34 is(pagetype("foo/Makefile"), "Makefile");
35 is(pagename("foo/Makefile"), "foo/Makefile");