ameliorate markup semantics and spelling
[gitmo/moose-website.git] / t / 01-validate.t
1 #!perl
2 use 5.010;
3 use utf8;
4 use strict;
5 use warnings FATAL => 'all';
6 use Capture::Tiny qw(capture);
7 use File::Next qw();
8 use File::Which qw(which);
9 use Test::More;
10
11 # Skip means sweep bugs under the rug.
12 # I want this test to be actually run.
13 BAIL_OUT 'xmllint (part of the libxml2 package) not installed.'
14   unless which 'xmllint';
15
16 my $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
25 my $iter = File::Next::files({
26         file_filter => sub {/\.html \z/msx},
27         sort_files  => 1,
28     },
29     $destdir
30 );
31
32 my $file_counter;
33 while (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
42 done_testing($file_counter);