]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blob - t/basewiki_brokenlinks.t
nearly works with autoindex_commit => 0, but not quite...
[git.ikiwiki.info.git] / t / basewiki_brokenlinks.t
1 #!/usr/bin/perl
2 use warnings;
3 use strict;
4 use Test::More 'no_plan';
6 ok(! system("rm -rf t/tmp; mkdir t/tmp"));
7 ok(! system("make -s ikiwiki.out"));
8 ok(! system("make underlay_install DESTDIR=`pwd`/t/tmp/install PREFIX=/usr >/dev/null"));
10 foreach my $plugin ("", "listdirectives") {
11         ok(! system("LC_ALL=C perl -I. ./ikiwiki.out -rebuild -plugin brokenlinks ".
12                         # always enabled because pages link to it conditionally,
13                         # which brokenlinks cannot handle properly
14                         "-plugin smiley ".
15                         ($plugin ? "-plugin $plugin " : "").
16                         "-underlaydir=t/tmp/install/usr/share/ikiwiki/basewiki ".
17                         "-set underlaydirbase=t/tmp/install/usr/share/ikiwiki ".
18                         "-templatedir=templates t/basewiki_brokenlinks t/tmp/out"));
19         my $result=`grep 'no broken links' t/tmp/out/index.html`;
20         ok(length($result));
21         if (! length $result) {
22                 print STDERR "\n\nbroken links found".($plugin ? " (with $plugin)" : "")."\n";
23                 system("grep '<li>' t/tmp/out/index.html >&2");
24                 print STDERR "\n\n";
25         }
26         ok(-e "t/tmp/out/style.css"); # linked to..
27         ok(! system("rm -rf t/tmp/out t/basewiki_brokenlinks/.ikiwiki"));
28 }
29 ok(! system("rm -rf t/tmp"));