summaryrefslogtreecommitdiff
path: root/t/basewiki_brokenlinks.t
blob: 74ddc61c5a8b636a80b5ed24c293ce2c3582c4de (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 underlay_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"));