(no commit message)
[ikiwiki.git] / t / tag.t
blobfe547d85bc51eaa306d85b90e28d79d4793f8a4e
1 #!/usr/bin/perl
2 package IkiWiki;
4 use warnings;
5 use strict;
6 use Test::More tests => 7;
8 BEGIN { use_ok("IkiWiki"); }
9 BEGIN { use_ok("IkiWiki::Plugin::tag"); }
11 ok(! system("rm -rf t/tmp; mkdir t/tmp"));
13 $config{userdir} = "users";
14 $config{tagbase} = "tags";
16 %oldrenderedfiles=%pagectime=();
17 %pagesources=%pagemtime=%oldlinks=%links=%depends=%typedlinks=%oldtypedlinks=
18 %destsources=%renderedfiles=%pagecase=%pagestate=();
20 foreach my $page (qw(tags/numbers tags/letters one two alpha beta)) {
21 $pagesources{$page} = "$page.mdwn";
22 $pagemtime{$page} = $pagectime{$page} = 1000000;
25 $links{one}=[qw(tags/numbers alpha tags/letters)];
26 $links{two}=[qw(tags/numbers)];
27 $links{alpha}=[qw(tags/letters one)];
28 $links{beta}=[qw(tags/letters)];
29 $typedlinks{one}={tag => {"tags/numbers" => 1 }};
30 $typedlinks{two}={tag => {"tags/numbers" => 1 }};
31 $typedlinks{alpha}={tag => {"tags/letters" => 1 }};
32 $typedlinks{beta}={tag => {"tags/letters" => 1 }};
34 ok(pagespec_match("one", "tagged(numbers)"));
35 ok(!pagespec_match("two", "tagged(alpha)"));
36 ok(pagespec_match("one", "link(tags/numbers)"));
37 ok(pagespec_match("one", "link(alpha)"));