ikiwiki/t/pagename.t

23 lines
576 B
Perl
Executable File

#!/usr/bin/perl
use warnings;
use strict;
use Test::More tests => 8;
BEGIN { use_ok("IkiWiki"); }
# Used internally.
$IkiWiki::hooks{htmlize}{mdwn}={};
$IkiWiki::hooks{htmlize}{txt}={keepextension => 1};
is(pagename("foo.mdwn"), "foo");
is(pagename("foo/bar.mdwn"), "foo/bar");
# bare files get the full filename as page name
is(pagename("foo.png"), "foo.png");
is(pagename("foo/bar.png"), "foo/bar.png");
is(pagename("foo"), "foo");
# keepextension preserves the extension in the page name
is(pagename("foo.txt"), "foo.txt");
is(pagename("foo/bar.txt"), "foo/bar.txt");