websites need tests, too
[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);
9use Test::More;
10
11# Skip means sweep bugs under the rug.
12# I want this test to be actually run.
13BAIL_OUT 'xmllint (part of the libxml2 package) not installed.'
14 unless which 'xmllint';
15
16my $destdir;
17{
18 my $runtime_params_file = '_build/runtime_params';
19 my $runtime_params = do $runtime_params_file;
20 die "Could not load $runtime_params_file. Run Build.PL first.\n"
21 unless $runtime_params;
22 $destdir = $runtime_params->{destdir};
23}
24
25my $iter = File::Next::files({
26 file_filter => sub {/\.html \z/msx},
27 sort_files => 1,
28 },
29 $destdir
30);
31
32my $file_counter;
33while (defined(my $html_file = $iter->())) {
34 $file_counter++;
35 my (undef, $stderr) = capture {
36 system qw(xmllint --noout), $html_file;
37 };
38 ok !$stderr, "$html_file validates";
39 diag $stderr if $stderr;
40}
41
42done_testing($file_counter);