po: make the "backlinks involve dependencies" feature optional
[ikiwiki.git] / t / basewiki_brokenlinks.t
1 #!/usr/bin/perl
2 use warnings;
3 use strict;
4 use Test::More 'no_plan';
5
6 ok(! system("rm -rf t/tmp; mkdir t/tmp"));
7 ok(! system("make -s ikiwiki.out"));
8 ok(! system("make extra_install DESTDIR=`pwd`/t/tmp/install PREFIX=/usr >/dev/null"));
9
10 foreach my $plugin ("", "listdirectives") {
11         ok(! system("LC_ALL=C perl -T -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                         "-templatedir=templates t/basewiki_brokenlinks t/tmp/out"));
18         my $result=`grep 'no broken links' t/tmp/out/index.html`;
19         ok(length($result));
20         if (! length $result) {
21                 print STDERR "\n\nbroken links found".($plugin ? " (with $plugin)" : "")."\n";
22                 system("grep '<li>' t/tmp/out/index.html >&2");
23                 print STDERR "\n\n";
24         }
25         ok(-e "t/tmp/out/style.css"); # linked to..
26         ok(! system("rm -rf t/tmp/out t/basewiki_brokenlinks/.ikiwiki"));
27 }
28 ok(! system("rm -rf t/tmp"));