ikiwiki/t/pagename.t

23 lines
576 B
Perl
Raw Normal View History

2006-09-11 05:52:55 +02:00
#!/usr/bin/perl
use warnings;
use strict;
2009-02-20 00:31:57 +01:00
use Test::More tests => 8;
2006-09-11 05:52:55 +02:00
BEGIN { use_ok("IkiWiki"); }
# Used internally.
2009-02-20 00:31:57 +01:00
$IkiWiki::hooks{htmlize}{mdwn}={};
$IkiWiki::hooks{htmlize}{txt}={keepextension => 1};
2006-09-11 05:52:55 +02:00
is(pagename("foo.mdwn"), "foo");
is(pagename("foo/bar.mdwn"), "foo/bar");
# bare files get the full filename as page name
2006-09-11 05:52:55 +02:00
is(pagename("foo.png"), "foo.png");
is(pagename("foo/bar.png"), "foo/bar.png");
2006-09-11 05:52:55 +02:00
is(pagename("foo"), "foo");
2009-02-20 00:31:57 +01:00
# keepextension preserves the extension in the page name
is(pagename("foo.txt"), "foo.txt");
is(pagename("foo/bar.txt"), "foo/bar.txt");