aboutsummaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorSimon McVittie <smcv@debian.org>2017-05-16 08:25:53 +0100
committerSimon McVittie <smcv@debian.org>2017-05-16 08:25:53 +0100
commit1b4571acd57294e4048e0dc61b1146cf4310913e (patch)
tree7e2e48f19c2ef85c7a44d4b53d97ceba223b11ab /t
parentc72dc5ddb79391ea9f518b4b76b9d1bb0f318649 (diff)
downloadikiwiki-1b4571acd57294e4048e0dc61b1146cf4310913e.tar
ikiwiki-1b4571acd57294e4048e0dc61b1146cf4310913e.tar.gz
Add a test-case for Markdown options
Diffstat (limited to 't')
-rwxr-xr-xt/mdwn.t44
1 files changed, 44 insertions, 0 deletions
diff --git a/t/mdwn.t b/t/mdwn.t
new file mode 100755
index 000000000..93b8bd8e9
--- /dev/null
+++ b/t/mdwn.t
@@ -0,0 +1,44 @@
+#!/usr/bin/perl
+use warnings;
+use strict;
+use Test::More;
+use Encode;
+
+BEGIN { use_ok("IkiWiki"); }
+
+%config=IkiWiki::defaultconfig();
+$config{srcdir}=$config{destdir}="/dev/null";
+IkiWiki::loadplugins();
+IkiWiki::checkconfig();
+
+is(IkiWiki::htmlize("foo", "foo", "mdwn",
+ "C. S. Lewis wrote books\n"),
+ "<p>C. S. Lewis wrote books</p>\n", "alphalist off by default");
+
+$config{mdwn_alpha_lists} = 1;
+like(IkiWiki::htmlize("foo", "foo", "mdwn",
+ "A. One\n".
+ "B. Two\n"),
+ qr{<ol\W}, "alphalist can be enabled");
+
+$config{mdwn_alpha_lists} = 0;
+like(IkiWiki::htmlize("foo", "foo", "mdwn",
+ "A. One\n".
+ "B. Two\n"),
+ qr{<p>A. One\sB. Two</p>\n}, "alphalist can be disabled");
+
+like(IkiWiki::htmlize("foo", "foo", "mdwn",
+ "This works[^1]\n\n[^1]: Sometimes it doesn't.\n"),
+ qr{<p>This works<sup\W}, "footnotes on by default");
+
+$config{mdwn_footnotes} = 0;
+like(IkiWiki::htmlize("foo", "foo", "mdwn",
+ "An unusual link label: [^1]\n\n[^1]: http://example.com/\n"),
+ qr{<a href="http://example\.com/">\^1</a>}, "footnotes can be disabled");
+
+$config{mdwn_footnotes} = 1;
+like(IkiWiki::htmlize("foo", "foo", "mdwn",
+ "This works[^1]\n\n[^1]: Sometimes it doesn't.\n"),
+ qr{<p>This works<sup\W}, "footnotes can be enabled");
+
+done_testing();