fix pagename, pagetype tests
authorJoey Hess <joey@gnu.kitenet.net>
Thu, 19 Feb 2009 23:28:43 +0000 (18:28 -0500)
committerJoey Hess <joey@gnu.kitenet.net>
Thu, 19 Feb 2009 23:28:43 +0000 (18:28 -0500)
Put tests in right file.

Set internal variable to hash, the functions expect that.

t/pagename.t
t/pagetype.t

index c7f1ce1801d92ee470f901e7f9f1eca35a6fa6fb..43f574e9878ba49e4e27396bf64484d9fb7df14c 100755 (executable)
@@ -1,7 +1,7 @@
 #!/usr/bin/perl
 use warnings;
 use strict;
-use Test::More tests => 5;
+use Test::More tests => 6;
 
 BEGIN { use_ok("IkiWiki"); }
 
@@ -10,5 +10,8 @@ $IkiWiki::hooks{htmlize}{mdwn}{call}=sub {};
 
 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");
index 2df59387a6d22752606f6aaf54c74a27f1439820..bb06a1568b0f1c72147f7886bc50fe9c9051262c 100755 (executable)
@@ -6,12 +6,10 @@ use Test::More tests => 6;
 BEGIN { use_ok("IkiWiki"); }
 
 # Used internally.
-$IkiWiki::hooks{htmlize}{mdwn}=1;
+$IkiWiki::hooks{htmlize}{mdwn}={};
 
 is(pagetype("foo.mdwn"), "mdwn");
 is(pagetype("foo/bar.mdwn"), "mdwn");
-
-# 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");
+is(pagetype("foo.png"), undef);
+is(pagetype("foo/bar.png"), undef);
+is(pagetype("foo"), undef);