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