diff options
author | Simon McVittie <smcv@debian.org> | 2014-10-16 11:25:10 +0100 |
---|---|---|
committer | Simon McVittie <smcv@debian.org> | 2014-10-16 11:25:10 +0100 |
commit | b679fc65f5f9cce62412bfd86b7751cb39cfd674 (patch) | |
tree | e57189f8a0330f597a5b284c6385fa278fd87b63 /t | |
parent | fb7225dbe6abc58c3d03004d2ee14eac02c7b1f0 (diff) | |
download | ikiwiki-b679fc65f5f9cce62412bfd86b7751cb39cfd674.tar ikiwiki-b679fc65f5f9cce62412bfd86b7751cb39cfd674.tar.gz |
We no longer have a test for DTD-valid XHTML 1.0, but at least check well-formedness
This means that people can do XSLT nonsense if they want to.
The failures are currently marked TODO because not everything in the
docwiki is in fact well-formed.
Diffstat (limited to 't')
-rwxr-xr-x | t/wellformed.t | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/t/wellformed.t b/t/wellformed.t new file mode 100755 index 000000000..cee0ff3be --- /dev/null +++ b/t/wellformed.t @@ -0,0 +1,50 @@ +#!/usr/bin/perl +use warnings; +use strict; +use Cwd qw(); +use File::Find; +use Test::More; + +plan(skip_all => "XML::Parser not available") + unless eval q{use XML::Parser (); 1;}; + +use IkiWiki; + +ok(system("make >/dev/null") == 0); + +chdir("html") || die "chdir: $!"; + +sub wanted { + my $file = $_; + return if -d $file; + $file =~ s{^\./}{}; + return if $file !~ m/\.html$/; + if (eval { + XML::Parser->new()->parsefile($file); + 1; + }) { + pass($file); + } + elsif ($file =~ m{^(?: + # user-contributed, contains explicit <br> + plugins/contrib/gallery | + # use templatebody when branchable.com has been upgraded + templates/ | + # malformed content in <pre> not escaped by discount + tips/convert_mediawiki_to_ikiwiki + # user-contributed, content is anyone's guess + users/ | + )}x) { + TODO: { + local $TODO = $@; + fail($file); + } + } +} + +find({ + no_chdir => 1, + wanted => \&wanted, +}, '.'); + +done_testing; |