summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorSimon McVittie <smcv@debian.org>2010-03-24 00:29:10 +0000
committerSimon McVittie <smcv@debian.org>2010-03-24 00:29:10 +0000
commite67a9382f67e745af3be7d367fe7a0d36c1777e6 (patch)
treea8c244b493dbc96b13488df948f5ac90718df45a /t
parente74a85c671cf9fe1e445ad183d66e059beaec2f9 (diff)
Allow hooks to add sorting functions to pagespec_match_list
Diffstat (limited to 't')
-rwxr-xr-xt/pagespec_match_list.t6
1 files changed, 5 insertions, 1 deletions
diff --git a/t/pagespec_match_list.t b/t/pagespec_match_list.t
index dd5dcc5b0..b34ee769f 100755
--- a/t/pagespec_match_list.t
+++ b/t/pagespec_match_list.t
@@ -1,7 +1,7 @@
#!/usr/bin/perl
use warnings;
use strict;
-use Test::More tests => 88;
+use Test::More tests => 89;
BEGIN { use_ok("IkiWiki"); }
@@ -9,6 +9,8 @@ BEGIN { use_ok("IkiWiki"); }
$config{srcdir}=$config{destdir}="/dev/null";
IkiWiki::checkconfig();
+hook(type => "sort", id => "path", call => sub { $_[0] cmp $_[1] });
+
%pagesources=(
foo => "foo.mdwn",
foo2 => "foo2.mdwn",
@@ -34,6 +36,8 @@ is_deeply([pagespec_match_list("foo", "post/*", sort => "title", num => 50)],
is_deeply([pagespec_match_list("foo", "post/*", sort => "title",
filter => sub { $_[0] =~ /3/}) ],
["post/1", "post/2"]);
+is_deeply([pagespec_match_list("foo", "*", sort => "path", num => 2)],
+ ["bar", "foo"]);
my $r=eval { pagespec_match_list("foo", "beep") };
ok(eval { pagespec_match_list("foo", "beep") } == 0);
ok(! $@, "does not fail with error when unable to match anything");