]> sipb.mit.edu Git - ikiwiki.git/blob - t/htmlbalance.t
modify to skip tests if the neccessary perl modules are not available
[ikiwiki.git] / t / htmlbalance.t
1 #!/usr/bin/perl
2 use warnings;
3 use strict;
4
5 BEGIN {
6         eval q{
7                 use HTML::TreeBuilder;
8                 use XML::Atom::Util qw(encode_xml);
9         };
10         if ($@) {
11                 eval q{use Test::More skip_all => "HTML::TreeBuilder or XML::Atom::Util not available"};
12         }
13         else {
14                 eval q{use Test::More tests => 7};
15         }
16         use_ok("IkiWiki::Plugin::htmlbalance");
17 }
18
19 is(IkiWiki::Plugin::htmlbalance::sanitize(content => "<br></br>"), "<br />");
20 is(IkiWiki::Plugin::htmlbalance::sanitize(content => "<div><p b=\"c\">hello world</div>"), "<div><p b=\"c\">hello world</p></div>");
21 is(IkiWiki::Plugin::htmlbalance::sanitize(content => "<a></a></a>"), "<a></a>");
22 is(IkiWiki::Plugin::htmlbalance::sanitize(content => "<b>foo <a</b>"), "<b>foo </b>");
23 is(IkiWiki::Plugin::htmlbalance::sanitize(content => "<b> foo <a</a></b>"), "<b> foo </b>");
24 is(IkiWiki::Plugin::htmlbalance::sanitize(content => "a>"), "a&gt;");