2006-06-15 08:37:33 +02:00
|
|
|
#!/usr/bin/perl
|
|
|
|
use warnings;
|
|
|
|
use strict;
|
2008-02-10 09:38:30 +01:00
|
|
|
use Test::More tests => 5;
|
2006-06-15 08:37:33 +02:00
|
|
|
use Encode;
|
|
|
|
|
|
|
|
BEGIN { use_ok("IkiWiki"); }
|
|
|
|
|
|
|
|
# Initialize htmlscrubber plugin
|
2006-09-10 00:50:27 +02:00
|
|
|
%config=IkiWiki::defaultconfig();
|
|
|
|
$config{srcdir}=$config{destdir}="/dev/null";
|
2006-07-28 19:48:24 +02:00
|
|
|
IkiWiki::loadplugins();
|
2006-06-15 08:37:33 +02:00
|
|
|
IkiWiki::checkconfig();
|
|
|
|
|
2006-08-28 20:17:59 +02:00
|
|
|
is(IkiWiki::htmlize("foo", "mdwn", "foo\n\nbar\n"), "<p>foo</p>\n\n<p>bar</p>\n",
|
2006-06-15 08:37:33 +02:00
|
|
|
"basic");
|
2006-09-10 00:50:27 +02:00
|
|
|
is(IkiWiki::htmlize("foo", "mdwn", readfile("t/test1.mdwn")),
|
2006-06-15 08:37:33 +02:00
|
|
|
Encode::decode_utf8(qq{<p><img src="../images/o.jpg" alt="o" title="ó" />\nóóóóó</p>\n}),
|
|
|
|
"utf8; bug #373203");
|
2006-09-10 00:50:27 +02:00
|
|
|
ok(IkiWiki::htmlize("foo", "mdwn", readfile("t/test2.mdwn")),
|
2006-06-16 06:56:25 +02:00
|
|
|
"this file crashes markdown if it's fed in as decoded utf-8");
|
2008-02-10 09:38:30 +01:00
|
|
|
my $ret=IkiWiki::htmlize("foo", "mdwn", readfile("t/javascript.mdwn"));
|
|
|
|
ok($ret !~ /GOTCHA/,
|
|
|
|
"javascript.mdwn contains a number of attempts at getting
|
|
|
|
javascript that contains GOTCHA past the html sanitiser.");
|