web commit by harleypig
[ikiwiki.git] / t / htmlize.t
1 #!/usr/bin/perl
2 use warnings;
3 use strict;
4 use Test::More tests => 4;
5 use Encode;
6
7 BEGIN { use_ok("IkiWiki"); }
8
9 # Initialize htmlscrubber plugin
10 %config=IkiWiki::defaultconfig();
11 $config{srcdir}=$config{destdir}="/dev/null";
12 IkiWiki::loadplugins();
13 IkiWiki::checkconfig();
14
15 is(IkiWiki::htmlize("foo", "mdwn", "foo\n\nbar\n"), "<p>foo</p>\n\n<p>bar</p>\n",
16         "basic");
17 is(IkiWiki::htmlize("foo", "mdwn", readfile("t/test1.mdwn")),
18         Encode::decode_utf8(qq{<p><img src="../images/o.jpg" alt="o" title="&oacute;" />\nóóóóó</p>\n}),
19         "utf8; bug #373203");
20 ok(IkiWiki::htmlize("foo", "mdwn", readfile("t/test2.mdwn")),
21         "this file crashes markdown if it's fed in as decoded utf-8");