summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xt/pagename.t14
-rwxr-xr-xt/pagetype.mdwn14
2 files changed, 28 insertions, 0 deletions
diff --git a/t/pagename.t b/t/pagename.t
new file mode 100755
index 000000000..96e6a87f1
--- /dev/null
+++ b/t/pagename.t
@@ -0,0 +1,14 @@
+#!/usr/bin/perl
+use warnings;
+use strict;
+use Test::More tests => 5;
+
+BEGIN { use_ok("IkiWiki"); }
+
+# Used internally.
+$IkiWiki::hooks{htmlize}{mdwn}=1;
+
+is(pagename("foo.mdwn"), "foo");
+is(pagename("foo/bar.mdwn"), "foo/bar");
+is(pagename("foo.png"), "foo.png");
+is(pagename("foo"), "foo");
diff --git a/t/pagetype.mdwn b/t/pagetype.mdwn
new file mode 100755
index 000000000..76cacd8f7
--- /dev/null
+++ b/t/pagetype.mdwn
@@ -0,0 +1,14 @@
+#!/usr/bin/perl
+use warnings;
+use strict;
+use Test::More tests => 5;
+
+BEGIN { use_ok("IkiWiki"); }
+
+# Used internally.
+$IkiWiki::hooks{htmlize}{mdwn}=1;
+
+is(pagetype("foo.mdwn"), "mdwn");
+is(pagetype("foo/bar.mdwn"), "mdwn");
+is(pagename("foo.png"), undef);
+is(pagename("foo"), undef);