de-emphasize contributions to Joey; ikiwiki has more developers than just me. Donatio...
[ikiwiki.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;
7
8 plan(skip_all => "XML::Parser not available")
9         unless eval q{use XML::Parser (); 1;};
10
11 use IkiWiki;
12
13 ok(system("make >/dev/null") == 0);
14
15 chdir("html") || die "chdir: $!";
16
17 sub wanted {
18         my $file = $_;
19         return if -d $file;
20         $file =~ s{^\./}{};
21         return if $file !~ m/\.html$/;
22         if (eval {
23                 XML::Parser->new()->parsefile($file);
24                 1;
25         }) {
26                 pass($file);
27         }
28         elsif ($file =~ m{^(?:
29                         # user-contributed, contains explicit <br>
30                         plugins/contrib/gallery |
31                         # use templatebody when branchable.com has been upgraded
32                         templates/ |
33                         # malformed content in <pre> not escaped by discount
34                         tips/convert_mediawiki_to_ikiwiki
35                         # user-contributed, content is anyone's guess
36                         users/ |
37                         )}x) {
38                 TODO: {
39                         local $TODO = $@;
40                         fail($file);
41                 }
42         }
43 }
44
45 find({
46         no_chdir => 1,
47         wanted => \&wanted,
48 }, '.');
49
50 done_testing;