From e9c14bb14fe42cb2394831cafc9b82a96c373294 Mon Sep 17 00:00:00 2001 From: swelljoe Date: Sun, 14 Dec 2014 18:43:17 -0600 Subject: [PATCH] Add support for HTML::Lint::Pluggable Test::HTML::Lint currently only supports a $lint object reference of type HTML::Lint, which prevents use of HTML::Lint::Pluggable modules in tests. I needed HTML5 support, so I did some digging, and found why it didn't work. This change allows tests using the HTML4 validator to continue to work, as before, but now makes it possible to add new validators via the pluggable interface. Using it looks exactly the same, except for setting up the $lint object: use HTML::Lint::Pluggable; my $lint = new HTML::Lint::Pluggable; $lint->load_plugins(qw/HTML5/); html_ok( $lint, $content, "HTML validation"); --- lib/Test/HTML/Lint.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Test/HTML/Lint.pm b/lib/Test/HTML/Lint.pm index d1057d1..5aa1cb2 100644 --- a/lib/Test/HTML/Lint.pm +++ b/lib/Test/HTML/Lint.pm @@ -87,7 +87,7 @@ will clear its errors before using it. sub html_ok { my $lint; - if ( ref($_[0]) eq 'HTML::Lint' ) { + if ( ref($_[0]) eq 'HTML::Lint' || ref($_[0]) =~ /HTML::Lint::Pluggable/ ) { $lint = shift; $lint->newfile(); $lint->clear_errors();