use warnings; use strict; # Response to an HTML::Lint request that it handle mishandled quotes. # See https://rt.cpan.org/Ticket/Display.html?id=1459 use Test::More tests => 4; BEGIN { use_ok( 'HTML::Tidy' ); } my $html = do { local $/ = undef; }; my $tidy = HTML::Tidy->new; isa_ok( $tidy, 'HTML::Tidy' ); $tidy->ignore( text => qr/DOCTYPE/ ); $tidy->parse( "-", $html ); my @expected = split /\n/, q{ - (4:1) Warning: unexpected or duplicate quote mark - (4:1) Warning: escaping malformed URI reference - (4:1) Warning: lacks "alt" attribute }; chomp @expected; shift @expected; # First one's blank sub strIfMSWin { return shift(@_) unless $^O =~ /M?S?Win/i; return substr( $_[0],-1 ) eq "\015" ? substr( $_[0],0,length($_[0])-1 ) : $_[0] } my @messages = $tidy->messages; is( scalar @messages, 3 ); my @strings = map { strIfMSWin($_->as_string) } @messages; is_deeply( \@strings, \@expected, "Matching warnings" ); __DATA__ Bogo