]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blob - t/mdwn.t
t/git-untrusted.t: New test case for untrusted pushes
[git.ikiwiki.info.git] / t / mdwn.t
1 #!/usr/bin/perl
2 use warnings;
3 use strict;
4 use Test::More;
5 use Encode;
7 BEGIN { use_ok("IkiWiki"); }
9 %config=IkiWiki::defaultconfig();
10 $config{srcdir}=$config{destdir}="/dev/null";
11 IkiWiki::loadplugins();
12 IkiWiki::checkconfig();
14 is(IkiWiki::htmlize("foo", "foo", "mdwn",
15         "C. S. Lewis wrote books\n"),
16         "<p>C. S. Lewis wrote books</p>\n", "alphalist off by default");
18 $config{mdwn_alpha_lists} = 1;
19 like(IkiWiki::htmlize("foo", "foo", "mdwn",
20         "A. One\n".
21         "B. Two\n"),
22         qr{<ol\W}, "alphalist can be enabled");
24 $config{mdwn_alpha_lists} = 0;
25 like(IkiWiki::htmlize("foo", "foo", "mdwn",
26         "A. One\n".
27         "B. Two\n"),
28         qr{<p>A. One\sB. Two</p>\n}, "alphalist can be disabled");
30 like(IkiWiki::htmlize("foo", "foo", "mdwn",
31         "This works[^1]\n\n[^1]: Sometimes it doesn't.\n"),
32         qr{<p>This works<sup\W}, "footnotes on by default");
34 $config{mdwn_footnotes} = 0;
35 like(IkiWiki::htmlize("foo", "foo", "mdwn",
36         "An unusual link label: [^1]\n\n[^1]: http://example.com/\n"),
37         qr{<a href="http://example\.com/">\^1</a>}, "footnotes can be disabled");
39 $config{mdwn_footnotes} = 1;
40 like(IkiWiki::htmlize("foo", "foo", "mdwn",
41         "This works[^1]\n\n[^1]: Sometimes it doesn't.\n"),
42         qr{<p>This works<sup\W}, "footnotes can be enabled");
44 done_testing();