1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
|
#!/usr/bin/perl -T
use strict;
use warnings;
use Test::Exception;
use Test::More tests => 3;
use HTML::Tidy;
my $tidy = HTML::Tidy->new;
isa_ok( $tidy, 'HTML::Tidy' );
my $expected_pattern = 'Usage: clean($str [, $str...])';
throws_ok {
$tidy->clean();
} qr/\Q$expected_pattern\E/,
'clean() croaks when not given a string or list of strings';
like(
$tidy->clean(''),
_expected_empty_html(),
'$tidy->clean("") returns empty HTML document',
);
sub _expected_empty_html {
return qr{<!DOCTYPE html>
<html>
<head>
<meta name="generator" content="[^"]+">
<title></title>
</head>
<body>
</body>
</html>
};
}
|