fixes and more tests

master
joey 2007-02-07 00:45:00 +00:00
parent 28e3bd2db2
commit d472e293cd
4 changed files with 11 additions and 10 deletions

View File

@ -881,7 +881,7 @@ sub match_glob ($$$) { #{{{
if ($glob =~ m!^\./!) {
$from=~s!/?[^/]+$!!;
$glob=~s!^\./!!;
$glob="$from/$glob";
$glob="$from/$glob" if length $from;
}
# turn glob into safe regexp

View File

@ -314,9 +314,9 @@ Makes the specified page depend on the specified [[PageSpec]].
#### `pagespec_match($$;$)`
Passed a page name, a [[PageSpec]], and the location the glob should be
matched against, returns true if the [[PageSpec]] matches the page. (If the
third parameter is not passed, relative PageSpecs will match relative to
Passed a page name, a [[PageSpec]], and the location the [[PageSpec]] should
be matched against, returns true if the [[PageSpec]] matches the page. (If
the third parameter is not passed, relative PageSpecs will match relative to
the top of the wiki.)
#### `bestlink($$)`

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2007-02-06 15:59-0500\n"
"POT-Creation-Date: 2007-02-06 19:43-0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"

View File

@ -1,7 +1,7 @@
#!/usr/bin/perl
use warnings;
use strict;
use Test::More tests => 40;
use Test::More tests => 41;
BEGIN { use_ok("IkiWiki"); }
@ -18,10 +18,11 @@ ok(! pagespec_match("foo", "* and !foo", ""));
ok(! pagespec_match("foo", "foo and !foo", ""));
ok(! pagespec_match("foo.png", "* and !*.*", ""));
ok(pagespec_match("foo", "(bar or ((meep and foo) or (baz or foo) or beep))", ""));
ok(! pagespec_match("foo/bar", "./*", "foo"), "relative fail");
ok(! pagespec_match("a/foo", "./*", "a/b"), "relative");
ok(! pagespec_match("a/b/foo", "./*", "a/b"), "relative fail");
ok(! pagespec_match("foo", "./*", "a"), "relative toplevel");
ok(! pagespec_match("a/foo", "foo", "a/b"), "nonrelative fail");
ok(! pagespec_match("foo", "./*", "a/b"), "relative fail");
ok(pagespec_match("a/foo", "./*", "a/b"), "relative");
ok(pagespec_match("a/b/foo", "./*", "a/b"), "relative 2");
ok(pagespec_match("foo", "./*", "a"), "relative toplevel");
ok(pagespec_match("foo/bar", "*", "baz"), "absolute");
$links{foo}=[qw{bar baz}];