Test::HTML::Tidy5 - Test::More-style wrapper around HTML::Tidy5


Version 1.06


    use Test::HTML::Tidy5 tests => 4;

    my $table = build_display_table();
    html_tidy_ok( $table, 'Built display table properly' );


This module provides a few convenience methods for testing exception based code. It is built with Test::Builder and plays happily with Test::More and friends.

If you are not already familiar with Test::More now would be the time to go take a look.



html_tidy_ok( [$tidy, ] $html, $name )

Checks to see if $html is a valid HTML document.

If you pass an HTML::Tidy5 object, html_tidy_ok() will use that for its settings.

    my $tidy = HTML::Tidy5->new( {config_file => 'path/to/config'} );
    $tidy->ignore( type => TIDY_WARNING, type => TIDY_INFO );
    html_tidy_ok( $tidy, $content, "Web page is OK, ignoring warnings and info' );

Otherwise, it will use the default rules.

    html_tidy_ok( $content, "Web page passes ALL tests" );

html_fragment_tidy_ok( [$tidy, ] $html, $name )

Works the same as html_tidy_ok, but first wraps it up an HTML document. This is useful for when want to validate self-contained snippets of HTML, such as from templates or an HTML feed from a third party, and check that it is valid.


All bugs and requests are now being handled through GitHub.

DO NOT send bug reports to


Copyright 2005-2018 Andy Lester.

This program is free software; you can redistribute it and/or modify it under the terms of the Artistic License v2.0.

Please note that these modules are not products of or supported by the employers of the various contributors to the code.


Andy Lester,