fix HTML
[gitmo/moose-website.git] / t / 01-validate.t
CommitLineData
d45dd0ef 1#!perl
2use 5.010;
3use utf8;
4use strict;
5use warnings FATAL => 'all';
6use Capture::Tiny qw(capture);
7use File::Next qw();
8use File::Which qw(which);
49046f7e 9use Module::Build qw();
d45dd0ef 10use Test::More;
11
12# Skip means sweep bugs under the rug.
13# I want this test to be actually run.
14BAIL_OUT 'xmllint (part of the libxml2 package) not installed.'
15 unless which 'xmllint';
16
49046f7e 17my $build;
18eval { $build = Module::Build->current; 1; }
19 or BAIL_OUT 'We are not in a Module::Build session. Run Build.PL first.';
d45dd0ef 20
21my $iter = File::Next::files({
22 file_filter => sub {/\.html \z/msx},
23 sort_files => 1,
24 },
49046f7e 25 $build->destdir
d45dd0ef 26);
27
28my $file_counter;
29while (defined(my $html_file = $iter->())) {
30 $file_counter++;
31 my (undef, $stderr) = capture {
32 system qw(xmllint --noout), $html_file;
33 };
34 ok !$stderr, "$html_file validates";
35 diag $stderr if $stderr;
36}
37
38done_testing($file_counter);