summaryrefslogtreecommitdiff
path: root/t/tag.t
blob: fe547d85bc51eaa306d85b90e28d79d4793f8a4e (plain)
  1. #!/usr/bin/perl
  2. package IkiWiki;
  3. use warnings;
  4. use strict;
  5. use Test::More tests => 7;
  6. BEGIN { use_ok("IkiWiki"); }
  7. BEGIN { use_ok("IkiWiki::Plugin::tag"); }
  8. ok(! system("rm -rf t/tmp; mkdir t/tmp"));
  9. $config{userdir} = "users";
  10. $config{tagbase} = "tags";
  11. %oldrenderedfiles=%pagectime=();
  12. %pagesources=%pagemtime=%oldlinks=%links=%depends=%typedlinks=%oldtypedlinks=
  13. %destsources=%renderedfiles=%pagecase=%pagestate=();
  14. foreach my $page (qw(tags/numbers tags/letters one two alpha beta)) {
  15. $pagesources{$page} = "$page.mdwn";
  16. $pagemtime{$page} = $pagectime{$page} = 1000000;
  17. }
  18. $links{one}=[qw(tags/numbers alpha tags/letters)];
  19. $links{two}=[qw(tags/numbers)];
  20. $links{alpha}=[qw(tags/letters one)];
  21. $links{beta}=[qw(tags/letters)];
  22. $typedlinks{one}={tag => {"tags/numbers" => 1 }};
  23. $typedlinks{two}={tag => {"tags/numbers" => 1 }};
  24. $typedlinks{alpha}={tag => {"tags/letters" => 1 }};
  25. $typedlinks{beta}={tag => {"tags/letters" => 1 }};
  26. ok(pagespec_match("one", "tagged(numbers)"));
  27. ok(!pagespec_match("two", "tagged(alpha)"));
  28. ok(pagespec_match("one", "link(tags/numbers)"));
  29. ok(pagespec_match("one", "link(alpha)"));
  30. 1;