]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - t/autoindex.t
removed
[git.ikiwiki.info.git] / t / autoindex.t
index 2c7a286f8bf00a475f5659319a0a6b4c144eb6fb..e25b617337fd816be5ead453d371b35cd5fc3223 100755 (executable)
@@ -3,7 +3,7 @@ package IkiWiki;
 
 use warnings;
 use strict;
 
 use warnings;
 use strict;
-use Test::More tests => 44;
+use Test::More tests => 50;
 
 BEGIN { use_ok("IkiWiki"); }
 BEGIN { use_ok("IkiWiki::Render"); }
 
 BEGIN { use_ok("IkiWiki"); }
 BEGIN { use_ok("IkiWiki::Render"); }
@@ -54,15 +54,15 @@ $pagemtime{"has_internal/internal"} = 123456789;
 $pagectime{"has_internal/internal"} = 123456789;
 writefile("has_internal/internal._aggregated", "t/tmp/in", "this page is internal");
 
 $pagectime{"has_internal/internal"} = 123456789;
 writefile("has_internal/internal._aggregated", "t/tmp/in", "this page is internal");
 
-# a directory containing only a page in an underlay shouldn't be indexed
-# (arguably; see [[transient autocreated tagbase is not transient autoindexed]])
+# a directory containing only a page in an underlay is now indexed
+# (see [[transient autocreated tagbase is not transient autoindexed]])
 $pagesources{"has_underlay/underlay"} = "has_underlay/underlay.mdwn";
 $pagemtime{"has_underlay/underlay"} = 123456789;
 $pagectime{"has_underlay/underlay"} = 123456789;
 writefile("has_underlay/underlay.mdwn", "t/tmp/underlay", "this page is in an underlay");
 
 $pagesources{"has_underlay/underlay"} = "has_underlay/underlay.mdwn";
 $pagemtime{"has_underlay/underlay"} = 123456789;
 $pagectime{"has_underlay/underlay"} = 123456789;
 writefile("has_underlay/underlay.mdwn", "t/tmp/underlay", "this page is in an underlay");
 
-# a directory containing only a transient page shouldn't be indexed
-# (arguably; see [[transient autocreated tagbase is not transient autoindexed]])
+# a directory containing only a transient page is now indexed
+# (see [[transient autocreated tagbase is not transient autoindexed]])
 $pagesources{"has_transient/transient"} = "has_transient/transient.mdwn";
 $pagemtime{"has_transient/transient"} = 123456789;
 $pagectime{"has_transient/transient"} = 123456789;
 $pagesources{"has_transient/transient"} = "has_transient/transient.mdwn";
 $pagemtime{"has_transient/transient"} = 123456789;
 $pagectime{"has_transient/transient"} = 123456789;
@@ -117,24 +117,36 @@ ok(! exists $wikistate{autoindex}{autofile}{"has_internal.mdwn"});
 ok(! exists $autofiles{"has_internal.mdwn"});
 ok(! -f "t/tmp/in/has_internal.mdwn");
 
 ok(! exists $autofiles{"has_internal.mdwn"});
 ok(! -f "t/tmp/in/has_internal.mdwn");
 
-# a directory containing only a page in an underlay shouldn't be indexed
-# (arguably; see [[transient autocreated tagbase is not transient autoindexed]])
+# a directory containing only a page in an underlay is now indexed
+# (see [[transient autocreated tagbase is not transient autoindexed]])
 ok(! exists $wikistate{autoindex}{autofile}{"has_underlay.mdwn"});
 ok(! exists $wikistate{autoindex}{autofile}{"has_underlay.mdwn"});
-ok(! exists $autofiles{"has_underlay.mdwn"});
+is($autofiles{"has_underlay.mdwn"}{plugin}, "autoindex");
+%pages = ();
+@del = ();
+IkiWiki::gen_autofile("has_underlay.mdwn", \%pages, \@del);
+is_deeply(\%pages, {"t/tmp/in/has_underlay" => 1});
+is_deeply(\@del, []);
 ok(! -f "t/tmp/in/has_underlay.mdwn");
 ok(! -f "t/tmp/in/has_underlay.mdwn");
+ok(-s "t/tmp/in/.ikiwiki/transient/has_underlay.mdwn");
 
 
-# a directory containing only a transient page shouldn't be indexed
-# (arguably; see [[transient autocreated tagbase is not transient autoindexed]])
+# a directory containing only a transient page is now indexed
+# (see [[transient autocreated tagbase is not transient autoindexed]])
 ok(! exists $wikistate{autoindex}{autofile}{"has_transient.mdwn"});
 ok(! exists $wikistate{autoindex}{autofile}{"has_transient.mdwn"});
-ok(! exists $autofiles{"has_transient.mdwn"});
+is($autofiles{"has_transient.mdwn"}{plugin}, "autoindex");
+%pages = ();
+@del = ();
+IkiWiki::gen_autofile("has_transient.mdwn", \%pages, \@del);
+is_deeply(\%pages, {"t/tmp/in/has_transient" => 1});
+is_deeply(\@del, []);
 ok(! -f "t/tmp/in/has_transient.mdwn");
 ok(! -f "t/tmp/in/has_transient.mdwn");
+ok(-s "t/tmp/in/.ikiwiki/transient/has_transient.mdwn");
 
 # this page was re-created, but that no longer gets a special case
 # (see [[todo/autoindex_should_use_add__95__autofile]]) so it's the same as
 # deleted
 is($wikistate{autoindex}{autofile}{"reinstated.mdwn"}, 1);
 ok(! exists $autofiles{"reinstated.mdwn"});
 
 # this page was re-created, but that no longer gets a special case
 # (see [[todo/autoindex_should_use_add__95__autofile]]) so it's the same as
 # deleted
 is($wikistate{autoindex}{autofile}{"reinstated.mdwn"}, 1);
 ok(! exists $autofiles{"reinstated.mdwn"});
-ok(! -f "t/tmp/in/reinstated.mdwn");
+ok(! -f "t/tmp/in/.ikiwiki/transient/reinstated.mdwn");
 
 # needs creating (deferred; part of the autofile mechanism now)
 ok(! exists $wikistate{autoindex}{autofile}{"tags.mdwn"});
 
 # needs creating (deferred; part of the autofile mechanism now)
 ok(! exists $wikistate{autoindex}{autofile}{"tags.mdwn"});