#!perl -Tw use warnings; use strict; use Test::More tests => 3; BEGIN { use_ok( 'HTML::Tidy' ); } my $html = do { local $/; }; my @expected_messages = split /\n/, q{ DATA (24:XX) Warning: unescaped & which should be written as & DATA (24:XX) Warning: unescaped & which should be written as & }; chomp @expected_messages; shift @expected_messages; # First one's blank IGNORE_BOGOTAG: { my $tidy = new HTML::Tidy; isa_ok( $tidy, 'HTML::Tidy' ); $tidy->ignore( text => qr/bogotag/ ); $tidy->ignore( text => [ qr/UNESCAPED/, qr/doctype/i ] ); # The qr/UNESCAPED/ should not ignore anything because there's no /i $tidy->parse( 'DATA', $html ); my @returned = map { $_->as_string } $tidy->messages; munge_returned( \@returned, 'DATA' ); s/[\r\n]+\z// for @returned; is_deeply( \@returned, \@expected_messages, 'Matching warnings' ); } sub munge_returned { # non-1 line numbers are not reliable across libtidies my $returned = shift; my $start_line = shift || qq{-}; for ( my $i = 0; $i < scalar @{$returned}; $i++ ) { next if $returned->[$i] =~ m/$start_line \(\d+:1\)/; $returned->[$i] =~ s/$start_line \((\d+):(\d+)\)/$start_line ($1:XX)/; } } __DATA__ petdance.com: Andy Lester's Programming & Writing Andy & Amy's Pet Supplies & Dance Instruction

Perl, Programming & Writing

My Technology & publishing blog at oreillynet.com
My Perl-specific and personal blog at use.perl.org
Andy Lester's resume
Andy's Perl Pages

The Lester Family

Andy: The Dad
Amy: The Mom
Quinn: The Girl
Baxter: The Dog
Our family trees

About Andy & Amy

The Page Of Mush
People we're looking for
Article about us and how we met from the Northwest Herald

Useful Stuff

Andy's Magic Start Page: Bunches of your favorite search engines, all in one place
Add-a-page Page: Bunches of website submission forms, all in one place
Cold Fusion stuff: CFX_HTTP and other custom tags

Musical Information, etc

Naked Raygun: Bring your mom and your mom's friends, too
Action Park: A compendium of information about Big Black, Rapeman, Shellac and Steve Albini

Other things that might be fun

When In Doubt, Use Parsley: Amy's journal
Wonder: Andy's old journal
So American It Hurts: Andy & Amy's trip to Graceland
Gallery Of Household Appliances
Media Wants: Stuff I yearn to consume
Buzzword Bingo