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