modify to skip tests if the neccessary perl modules are not available

Joey Hess 2008-11-17 14:22:11 -05:00
parent e8a945845b
commit 43039d7d86
1 changed files with 13 additions and 2 deletions

View File

@ -1,9 +1,20 @@
#!/usr/bin/perl #!/usr/bin/perl
use warnings; use warnings;
use strict; 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 => "<br></br>"), "<br />");
is(IkiWiki::Plugin::htmlbalance::sanitize(content => "<div><p b=\"c\">hello world</div>"), "<div><p b=\"c\">hello world</p></div>"); is(IkiWiki::Plugin::htmlbalance::sanitize(content => "<div><p b=\"c\">hello world</div>"), "<div><p b=\"c\">hello world</p></div>");