]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blob - t/wellformed.t
Standards-Version: 3.9.8 (no changes required)
[git.ikiwiki.info.git] / t / wellformed.t
1 #!/usr/bin/perl
2 use warnings;
3 use strict;
4 use Cwd qw();
5 use File::Find;
6 use Test::More;
8 plan(skip_all => 'running installed') if $ENV{INSTALLED_TESTS};
10 plan(skip_all => "XML::Parser not available")
11         unless eval q{use XML::Parser (); 1;};
13 use IkiWiki;
15 ok(system("make >/dev/null") == 0);
17 chdir("html") || die "chdir: $!";
19 sub wanted {
20         my $file = $_;
21         return if -d $file;
22         $file =~ s{^\./}{};
23         return if $file !~ m/\.html$/;
24         if (eval {
25                 XML::Parser->new()->parsefile($file);
26                 1;
27         }) {
28                 pass($file);
29         }
30         elsif ($file =~ m{^(?:
31                         # user-contributed, contains explicit <br>
32                         plugins/contrib/gallery |
33                         # use templatebody when branchable.com has been upgraded
34                         templates/ |
35                         # malformed content in <pre> not escaped by discount
36                         tips/convert_mediawiki_to_ikiwiki
37                         # user-contributed, content is anyone's guess
38                         users/ |
39                         )}x) {
40                 TODO: {
41                         local $TODO = $@;
42                         fail($file);
43                 }
44         }
45 }
47 find({
48         no_chdir => 1,
49         wanted => \&wanted,
50 }, '.');
52 done_testing;