summaryrefslogtreecommitdiff
path: root/t/basewiki_brokenlinks.t
blob: 479c71a93a0bcbe94e8b0bd867668c6484f8c134 (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. "-templatedir=templates t/basewiki_brokenlinks t/tmp/out"));
  16. my $result=`grep 'no broken links' t/tmp/out/index.html`;
  17. ok(length($result));
  18. if (! length $result) {
  19. print STDERR "\n\nbroken links found".($plugin ? " (with $plugin)" : "")."\n";
  20. system("grep '<li>' t/tmp/out/index.html >&2");
  21. print STDERR "\n\n";
  22. }
  23. ok(-e "t/tmp/out/style.css"); # linked to..
  24. ok(! system("rm -rf t/tmp/out t/basewiki_brokenlinks/.ikiwiki"));
  25. }
  26. ok(! system("rm -rf t/tmp"));