modify to skip tests if the neccessary perl modules are not available
authorJoey Hess <joey@kodama.kitenet.net>
Mon, 17 Nov 2008 19:22:11 +0000 (14:22 -0500)
committerJoey Hess <joey@kodama.kitenet.net>
Mon, 17 Nov 2008 19:22:11 +0000 (14:22 -0500)
t/htmlbalance.t

index cd124e473068d8fc01a31c41c1faa777dee0386d..783ed9841347f4abfdcde5fdb9df1c14eeb4c319 100755 (executable)
@@ -1,9 +1,20 @@
 #!/usr/bin/perl
 use warnings;
 use strict;
-use Test::More tests => 7;
 
-BEGIN { use_ok("IkiWiki::Plugin::htmlbalance"); }
+BEGIN {
+       eval q{
+               use HTML::TreeBuilder;
+               use XML::Atom::Util qw(encode_xml);
+       };
+       if ($@) {
+               eval q{use Test::More skip_all => "HTML::TreeBuilder or XML::Atom::Util not available"};
+       }
+       else {
+               eval q{use Test::More tests => 7};
+       }
+       use_ok("IkiWiki::Plugin::htmlbalance");
+}
 
 is(IkiWiki::Plugin::htmlbalance::sanitize(content => "<br></br>"), "<br />");
 is(IkiWiki::Plugin::htmlbalance::sanitize(content => "<div><p b=\"c\">hello world</div>"), "<div><p b=\"c\">hello world</p></div>");