12.7. Checking bad HTML

Example 12-4. examples/www/static_lint_bad.t

#!/usr/bin/perl
use strict;
use warnings;

use Test::More tests => 2;
use Test::HTML::Lint;
use LWP::Simple qw(get);

my $html = get 'http://test_server/bad.html';
ok $html, 'There is a response';
html_ok $html, 'HTML OK';

$ perl static_lint_bad.t 
not ok 1
#     Failed test (static_lint_bad.t at line 10)
# Errors:
#  (3:13) </a> with no opening <a>
#  (8:1) <h1> at (3:1) is never closed
1..1
# Looks like you failed 1 tests of 1.

If you are interested in on-site trainings by the author, please contact me directly.

Online courses:

Would you like to get
updated when I publish
the next article?

Follow me:

Google Plus Twitter RSS feed