Merge branch 'master' of ssh://git.ikiwiki.info/srv/git/ikiwiki.info
[ikiwiki.git] / t / htmlbalance.t
blobe5a5db0ee949e5b2935b03d49a4017a096a1c2c5
1 #!/usr/bin/perl
2 use warnings;
3 use strict;
5 BEGIN {
6 eval q{
7 use HTML::TreeBuilder;
8 };
9 if ($@) {
10 eval q{use Test::More skip_all => "HTML::TreeBuilder not available"};
12 else {
13 eval q{use Test::More tests => 7};
15 use_ok("IkiWiki::Plugin::htmlbalance");
18 is(IkiWiki::Plugin::htmlbalance::sanitize(content => "<br></br>"), "<br />");
19 is(IkiWiki::Plugin::htmlbalance::sanitize(content => "<div><p b=\"c\">hello world</div>"), "<div><p b=\"c\">hello world</p></div>");
20 is(IkiWiki::Plugin::htmlbalance::sanitize(content => "<a></a></a>"), "<a></a>");
21 is(IkiWiki::Plugin::htmlbalance::sanitize(content => "<b>foo <a</b>"), "<b>foo </b>");
22 is(IkiWiki::Plugin::htmlbalance::sanitize(content => "<b> foo <a</a></b>"), "<b> foo </b>");
23 is(IkiWiki::Plugin::htmlbalance::sanitize(content => "a>"), "a&gt;");