4 use Test::More tests => 35;
6 BEGIN { use_ok("IkiWiki"); }
8 ok(IkiWiki::pagespec_match("foo", "*"));
9 ok(IkiWiki::pagespec_match("page", "?ag?"));
10 ok(! IkiWiki::pagespec_match("page", "?a?g?"));
11 ok(IkiWiki::pagespec_match("foo.png", "*.*"));
12 ok(! IkiWiki::pagespec_match("foo", "*.*"));
13 ok(IkiWiki::pagespec_match("foo", "foo or bar"), "simple list");
14 ok(IkiWiki::pagespec_match("bar", "foo or bar"), "simple list 2");
15 ok(IkiWiki::pagespec_match("foo", "f?? and !foz"));
16 ok(! IkiWiki::pagespec_match("foo", "f?? and !foo"));
17 ok(! IkiWiki::pagespec_match("foo", "* and !foo"));
18 ok(! IkiWiki::pagespec_match("foo", "foo and !foo"));
19 ok(! IkiWiki::pagespec_match("foo.png", "* and !*.*"));
20 ok(IkiWiki::pagespec_match("foo", "(bar or ((meep and foo) or (baz or foo) or beep))"));
22 $IkiWiki::links{foo}=[qw{bar baz}];
23 ok(IkiWiki::pagespec_match("foo", "link(bar)"));
24 ok(! IkiWiki::pagespec_match("foo", "link(quux)"));
25 ok(IkiWiki::pagespec_match("bar", "backlink(foo)"));
26 ok(! IkiWiki::pagespec_match("quux", "backlink(foo)"));
28 $IkiWiki::pagectime{foo}=1154532692; # Wed Aug 2 11:26 EDT 2006
29 $IkiWiki::pagectime{bar}=1154532695; # after
30 ok(IkiWiki::pagespec_match("foo", "created_before(bar)"));
31 ok(! IkiWiki::pagespec_match("foo", "created_after(bar)"));
32 ok(! IkiWiki::pagespec_match("bar", "created_before(foo)"));
33 ok(IkiWiki::pagespec_match("bar", "created_after(foo)"));
34 ok(IkiWiki::pagespec_match("foo", "creation_year(2006)"), "year");
35 ok(! IkiWiki::pagespec_match("foo", "creation_year(2005)"), "other year");
36 ok(IkiWiki::pagespec_match("foo", "creation_month(8)"), "month");
37 ok(! IkiWiki::pagespec_match("foo", "creation_month(9)"), "other month");
38 ok(IkiWiki::pagespec_match("foo", "creation_day(2)"), "day");
39 ok(! IkiWiki::pagespec_match("foo", "creation_day(3)"), "other day");
42 ok(IkiWiki::pagespec_match("foo", "foo bar"), "simple list");
43 ok(IkiWiki::pagespec_match("bar", "foo bar"), "simple list 2");
44 ok(IkiWiki::pagespec_match("foo", "f?? !foz"));
45 ok(! IkiWiki::pagespec_match("foo", "f?? !foo"));
46 ok(! IkiWiki::pagespec_match("foo", "* !foo"));
47 ok(! IkiWiki::pagespec_match("foo", "foo !foo"));
48 ok(! IkiWiki::pagespec_match("foo.png", "* !*.*"));