Photos
Blog
Projects
vanrenterghem.biz
projects
/
git.ikiwiki.info.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
add TODO notes
[git.ikiwiki.info.git]
/
t
/
index.t
diff --git
a/t/index.t
b/t/index.t
index 2f23524a7cc987cf82329a2035370840d36ee3ef..392a167e9747131dbcd065b022a725ebf35f16d2 100755
(executable)
--- a/
t/index.t
+++ b/
t/index.t
@@
-4,7
+4,7
@@
use strict;
use IkiWiki;
package IkiWiki; # use internal variables
use IkiWiki;
package IkiWiki; # use internal variables
-use Test::More tests =>
27
;
+use Test::More tests =>
31
;
$config{wikistatedir}="/tmp/ikiwiki-test.$$";
system "rm -rf $config{wikistatedir}";
$config{wikistatedir}="/tmp/ikiwiki-test.$$";
system "rm -rf $config{wikistatedir}";
@@
-31,6
+31,7
@@
$renderedfiles{"bar"}=["bar.html", "bar.rss", "sparkline-foo.gif"];
$renderedfiles{"bar.png"}=["bar.png"];
$links{"Foo"}=["bar.png"];
$links{"bar"}=["Foo", "new-page"];
$renderedfiles{"bar.png"}=["bar.png"];
$links{"Foo"}=["bar.png"];
$links{"bar"}=["Foo", "new-page"];
+$typedlinks{"bar"}={tag => {"Foo" => 1}};
$links{"bar.png"}=[];
$depends{"Foo"}={};
$depends{"bar"}={"foo*" => 1};
$links{"bar.png"}=[];
$depends{"Foo"}={};
$depends{"bar"}={"foo*" => 1};
@@
-45,7
+46,7
@@
ok(-s "$config{wikistatedir}/indexdb", "index file created");
# Clear state.
%oldrenderedfiles=%pagectime=();
# Clear state.
%oldrenderedfiles=%pagectime=();
-%pagesources=%pagemtime=%oldlinks=%links=%depends=
+%pagesources=%pagemtime=%oldlinks=%links=%depends=
%typedlinks=%oldtypedlinks=
%destsources=%renderedfiles=%pagecase=%pagestate=();
ok(loadindex(), "load index");
%destsources=%renderedfiles=%pagecase=%pagestate=();
ok(loadindex(), "load index");
@@
-104,17
+105,26
@@
is_deeply(\%destsources, {
"sparkline-foo.gif" => "bar",
"bar.png" => "bar.png",
}, "%destsources generated correctly");
"sparkline-foo.gif" => "bar",
"bar.png" => "bar.png",
}, "%destsources generated correctly");
+is_deeply(\%typedlinks, {
+ bar => {tag => {"Foo" => 1}},
+}, "%typedlinks loaded correctly");
+is_deeply(\%oldtypedlinks, {
+ bar => {tag => {"Foo" => 1}},
+}, "%oldtypedlinks loaded correctly");
# Clear state.
%oldrenderedfiles=%pagectime=();
# Clear state.
%oldrenderedfiles=%pagectime=();
-%pagesources=%pagemtime=%oldlinks=%links=%depends=
+%pagesources=%pagemtime=%oldlinks=%links=%depends=
%typedlinks=%oldtypedlinks=
%destsources=%renderedfiles=%pagecase=%pagestate=();
%destsources=%renderedfiles=%pagecase=%pagestate=();
-# When state is loaded for a wiki rebuild, only ctime
and oldrenderedfiles
-# are retained.
+# When state is loaded for a wiki rebuild, only ctime
, oldrenderedfiles,
+# a
nd pagesources a
re retained.
$config{rebuild}=1;
ok(loadindex(), "load index");
is_deeply(\%pagesources, {
$config{rebuild}=1;
ok(loadindex(), "load index");
is_deeply(\%pagesources, {
+ Foo => "Foo.mdwn",
+ bar => "bar.mdwn",
+ "bar.png" => "bar.png",
}, "%pagesources loaded correctly");
is_deeply(\%pagemtime, {
}, "%pagemtime loaded correctly");
}, "%pagesources loaded correctly");
is_deeply(\%pagemtime, {
}, "%pagemtime loaded correctly");
@@
-136,9
+146,16
@@
is_deeply(\%depends, {
}, "%depends loaded correctly");
is_deeply(\%pagestate, {
}, "%pagestate loaded correctly");
}, "%depends loaded correctly");
is_deeply(\%pagestate, {
}, "%pagestate loaded correctly");
-is_deeply(\%pagecase, {
+is_deeply(\%pagecase, { # generated implicitly since pagesources is loaded
+ foo => "Foo",
+ bar => "bar",
+ "bar.png" => "bar.png"
}, "%pagecase generated correctly");
is_deeply(\%destsources, {
}, "%destsources generated correctly");
}, "%pagecase generated correctly");
is_deeply(\%destsources, {
}, "%destsources generated correctly");
+is_deeply(\%typedlinks, {
+}, "%typedlinks cleared correctly");
+is_deeply(\%oldtypedlinks, {
+}, "%oldtypedlinks cleared correctly");
system "rm -rf $config{wikistatedir}";
system "rm -rf $config{wikistatedir}";