]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blob - t/htmlize.t
add some more tests
[git.ikiwiki.info.git] / t / htmlize.t
1 #!/usr/bin/perl
2 use warnings;
3 use strict;
4 use Test::More tests => 5;
5 use Encode;
7 BEGIN { use_ok("IkiWiki"); }
9 # Initialize htmlscrubber plugin
10 %config=IkiWiki::defaultconfig();
11 $config{srcdir}=$config{destdir}="/dev/null";
12 IkiWiki::loadplugins();
13 IkiWiki::checkconfig();
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");
22 my $ret=IkiWiki::htmlize("foo", "mdwn", readfile("t/javascript.mdwn"));
23 ok($ret !~ /GOTCHA/,
24         "javascript.mdwn contains a number of attempts at getting
25         javascript that contains GOTCHA past the html sanitiser.");