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