1Test::HTML::Lint(3) User Contributed Perl Documentation Test::HTML::Lint(3)
2
3
4
6 Test::HTML::Lint - Test::More-style wrapper around HTML::Lint
7
9 Version 2.32
10
12 use Test::HTML::Lint tests => 4;
13
14 my $table = build_display_table();
15 html_ok( $table, 'Built display table properly' );
16
18 This module provides a few convenience methods for testing exception
19 based code. It is built with Test::Builder and plays happily with
20 Test::More and friends.
21
22 If you are not already familiar with Test::More now would be the time
23 to go take a look.
24
26 "html_ok"
27
28 html_ok( [$lint, ] $html, $name )
29 Checks to see if $html is a valid HTML document, including checks for
30 having "<html>", "<head>", "<title>>" and "<body>" tags.
31
32 If you're checking something that is only a fragment of an HTML
33 document, use "html_fragment_ok()".
34
35 If you pass an HTML::Lint object, "html_ok()" will use that for its
36 settings.
37
38 my $lint = new HTML::Lint( only_types => STRUCTURE );
39 html_ok( $lint, $content, "Web page passes structural tests only" );
40
41 Otherwise, it will use the default rules.
42
43 html_ok( $content, "Web page passes ALL tests" );
44
45 Note that if you pass in your own HTML::Lint object, "html_ok()" will
46 clear its errors before using it.
47
48 html_fragment_ok( [$lint, ] $html, $name )
49 Checks that $fragment is valid HTML, but not necessarily a valid HTML
50 document.
51
52 For example, this is a valid fragment, but not a valid HTML document:
53
54 <body>
55 <p>Lorem ipsum</p>
56 </body>
57
58 because it doesn't contain "<html>" and "<head>" tags. If you want to
59 check that it is a valid document, use "html_ok()".
60
61 If you pass an HTML::Lint object, "html_fragment_ok()" will use that
62 for its settings.
63
64 my $lint = new HTML::Lint( only_types => STRUCTURE );
65 html_fragment_ok( $lint, $content, 'Web page passes structural tests only' );
66
67 Otherwise, it will use the default rules.
68
69 html_fragment_ok( $content, 'Fragment passes ALL tests' );
70
71 Note that if you pass in your own HTML::Lint object,
72 "html_fragment_ok()" will clear its errors before using it.
73
75 All bugs and requests are now being handled through GitHub.
76
77 https://github.com/petdance/html-lint/issues
78
79 DO NOT send bug reports to http://rt.cpan.org/.
80
82 There needs to be a "html_table_ok()" to check that the HTML is a self-
83 contained, well-formed table, and then a comparable one for
84 "html_page_ok()".
85
86 If you think this module should do something that it doesn't do at the
87 moment please let me know.
88
90 Thanks to chromatic and Michael G Schwern for the excellent
91 Test::Builder, without which this module wouldn't be possible.
92
93 Thanks to Adrian Howard for writing Test::Exception, from which most of
94 this module is taken.
95
97 Copyright 2005-2018 Andy Lester.
98
99 This program is free software; you can redistribute it and/or modify it
100 under the terms of the Artistic License v2.0.
101
102 http://www.opensource.org/licenses/Artistic-2.0
103
104 Please note that these modules are not products of or supported by the
105 employers of the various contributors to the code.
106
108 Andy Lester, "andy@petdance.com"
109
110
111
112perl v5.34.0 2021-07-22 Test::HTML::Lint(3)