Test::HTML::Lint(3pm)
π Test::HTML::Lint π
okay bestie, so this is Test::HTML::Lint, a lil module from the User Contributed Perl Documentation corner of the universe, and it is exactly what it sounds like: a Test::More-style wrapper around HTML::Lint. no cap.
β¨ NAME β¨
Test::HTML::Lint β a Test::More-style wrapper around HTML::Lint. that's it, that's the whole vibe π¦
πΈ VERSION πΈ
Version 2.32 β¨
π SYNOPSIS π
use Test::HTML::Lint tests => 4;
my $table = build_display_table();
html_ok( $table, 'Built display table properly' );
π DESCRIPTION π
So here's the tea: this module hands you a few convenience methods for testing exception-based code. it's built with Test::Builder, which means it plays happily with Test::More and all their friends π«Ά
and if you're not already familiar with Test::More, bestie, now would be the time to go take a look. like, right now. go. π
π EXPORT π
"html_ok"
π html_ok( [$lint, ] $html, $name ) π
This one checks to see if $html is a valid HTML document β and yes, that includes checking for the <html>, <head>, <title>> and <body> tags. (not a typo on my end, that double > is literally in there, iykyk π)
If what you're checking is only a fragment of an HTML document, use "html_fragment_ok()" instead. she's the one for that job.
If you pass an HTML::Lint object, "html_ok()" will use that for its settings. main character energy, your lint your rules:
my $lint = new HTML::Lint( only_types => STRUCTURE );
html_ok( $lint, $content, "Web page passes structural tests only" );
Otherwise, it will use the default rules. slay:
html_ok( $content, "Web page passes ALL tests" );
β οΈ Note that if you pass in your ownHTML::Lintobject,"html_ok()"will clear its errors before using it. so like, if you were attached to those errorsβ¦ they're gone. π
π¦ html_fragment_ok( [$lint, ] $html, $name ) π¦
Checks that $fragment is valid HTML, but not necessarily a valid HTML document. it's giving "good enough for a fragment" β¨
For example, this is a valid fragment, but not a valid HTML document:
<body>
<p>Lorem ipsum</p>
</body>
because it doesn't contain <html> and <head> tags. so if you want to check that it is a valid document, use "html_ok()" instead. different test, different vibe.
If you pass an HTML::Lint object, "html_fragment_ok()" will use that for its settings:
my $lint = new HTML::Lint( only_types => STRUCTURE );
html_fragment_ok( $lint, $content, 'Web page passes structural tests only' );
Otherwise, it will use the default rules:
html_fragment_ok( $content, 'Fragment passes ALL tests' );
β οΈ Note that if you pass in your ownHTML::Lintobject,"html_fragment_ok()"will clear its errors before using it. same energy as above, still very much a thing. π«Ά
π BUGS π
All bugs and requests are now being handled through GitHub. we're modern like that π
https://github.com/petdance/html-lint/issues
π¨ DO NOT send bug reports to http://rt.cpan.org/. like, do not. i'm so serious.
π TO DO π
There needs to be a "html_table_ok()" to check that the HTML is a self-contained, well-formed table, and then a comparable one for "html_page_ok()". not me manifesting these into existence π
If you think this module should do something that it doesn't do at the moment, please let me know. bestie, the inbox is open π
π§ ACKNOWLEDGEMENTS π§
Thanks to chromatic and Michael G Schwern for the excellent Test::Builder, without which this module wouldn't be possible. absolute icons, both of them π
Thanks to Adrian Howard for writing Test::Exception, from which most of this module is taken. king behaviour fr fr π
π COPYRIGHT & LICENSE π
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.
http://www.opensource.org/licenses/Artistic-2.0
π Please note that these modules are not products of or supported by the employers of the various contributors to the code. just so we're clear!
β AUTHOR β
Andy Lester, "andy@petdance.com" β¨
and that's the whole page, babe! this lil doc ships with perl v5.32.0 and it's dated 2020-12-28 β the Test::HTML::Lint(3pm) manual, written by the lovely User Contributed Perl Documentation girlies. go lint something gorgeous πππ¦
π¦ where this page comes from
- debian bookworm: libhtml-lint-perl 2.32+dfsg-1.1 Β· Artistic-2.0
- debian trixie: libhtml-lint-perl 2.32+dfsg-1.1 Β· Artistic-2.0
- ubuntu jammy: libhtml-lint-perl 2.32+dfsg-1.1 Β· Artistic-2.0
- ubuntu noble: libhtml-lint-perl 2.32+dfsg-1.1 Β· Artistic-2.0
- ubuntu resolute: libhtml-lint-perl 2.32+dfsg-1.1 Β· Artistic-2.0
- ubuntu stonking: libhtml-lint-perl 2.32+dfsg-1.1 Β· Artistic-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms