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 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
|
#!perl -T
use 5.010001;
use warnings;
use strict;
use Test::More tests => 3;
use HTML::Tidy5;
use lib 't';
use TidyTestUtils;
my $args = { newline => 'LF', wrap => 0 };
my $tidy = HTML::Tidy5->new($args);
isa_ok( $tidy, 'HTML::Tidy5' );
$tidy->ignore( type => TIDY_INFO );
# clean once
$tidy->ignore( text => qr/DOCTYPE/ );
my $html = '<a href="http://www.example.com/"><em>This is a test.</a>';
my $clean = $tidy->clean( $html );
# then verify that it meets tidy's high standards
$tidy = HTML::Tidy5->new($args); # reset messages;
$tidy->ignore( type => TIDY_INFO );
$tidy->ignore( text => qr/title/ );
$clean = $tidy->clean($clean);
my @messages = $tidy->messages( $clean );
is_deeply( \@messages, [], q{The cleaned stuff shouldn't have any errors} );
$clean = remove_specificity( $clean );
my $expected = do { local $/ = undef; <DATA> };
is( $clean, $expected, 'Cleaned up properly' );
done_testing();
exit 0;
__DATA__
<!DOCTYPE html>
<html>
<head>
<meta name="generator" content="TIDY">
<title></title>
</head>
<body>
<a href="http://www.example.com/"><em>This is a test.</em></a>
</body>
</html>
|