fix pagename, pagetype tests
Put tests in right file. Set internal variable to hash, the functions expect that.master
parent
8c8b18935b
commit
c1907ded87
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/perl
|
#!/usr/bin/perl
|
||||||
use warnings;
|
use warnings;
|
||||||
use strict;
|
use strict;
|
||||||
use Test::More tests => 5;
|
use Test::More tests => 6;
|
||||||
|
|
||||||
BEGIN { use_ok("IkiWiki"); }
|
BEGIN { use_ok("IkiWiki"); }
|
||||||
|
|
||||||
|
@ -10,5 +10,8 @@ $IkiWiki::hooks{htmlize}{mdwn}{call}=sub {};
|
||||||
|
|
||||||
is(pagename("foo.mdwn"), "foo");
|
is(pagename("foo.mdwn"), "foo");
|
||||||
is(pagename("foo/bar.mdwn"), "foo/bar");
|
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.png"), "foo.png");
|
||||||
|
is(pagename("foo/bar.png"), "foo/bar.png");
|
||||||
is(pagename("foo"), "foo");
|
is(pagename("foo"), "foo");
|
||||||
|
|
10
t/pagetype.t
10
t/pagetype.t
|
@ -6,12 +6,10 @@ use Test::More tests => 6;
|
||||||
BEGIN { use_ok("IkiWiki"); }
|
BEGIN { use_ok("IkiWiki"); }
|
||||||
|
|
||||||
# Used internally.
|
# Used internally.
|
||||||
$IkiWiki::hooks{htmlize}{mdwn}=1;
|
$IkiWiki::hooks{htmlize}{mdwn}={};
|
||||||
|
|
||||||
is(pagetype("foo.mdwn"), "mdwn");
|
is(pagetype("foo.mdwn"), "mdwn");
|
||||||
is(pagetype("foo/bar.mdwn"), "mdwn");
|
is(pagetype("foo/bar.mdwn"), "mdwn");
|
||||||
|
is(pagetype("foo.png"), undef);
|
||||||
# bare files get the full filename as page name
|
is(pagetype("foo/bar.png"), undef);
|
||||||
is(pagename("foo.png"), "foo.png");
|
is(pagetype("foo"), undef);
|
||||||
is(pagename("foo/bar.png"), "foo/bar.png");
|
|
||||||
is(pagename("foo"), "foo");
|
|
||||||
|
|
Loading…
Reference in New Issue