]> sipb.mit.edu Git - ikiwiki.git/commitdiff
add_depends should default to content dependencies if unknown type specified
authorJoey Hess <joey@gnu.kitenet.net>
Tue, 6 Oct 2009 23:07:52 +0000 (19:07 -0400)
committerJoey Hess <joey@gnu.kitenet.net>
Tue, 6 Oct 2009 23:07:52 +0000 (19:07 -0400)
IkiWiki.pm
t/add_depends.t

index 7348ea2f7757b420910d48c582364856ed817317..7b1d24c6a2214d14543aadcbbadde9767a15af52 100644 (file)
@@ -1810,9 +1810,7 @@ sub add_depends ($$;@) {
                        }
                }
        }
-       else {
-               $deptype=$DEPEND_CONTENT;
-       }
+       $deptype=$DEPEND_CONTENT unless $deptype;
 
        if ($simple) {
                $depends_simple{$page}{lc $pagespec} |= $deptype;
index 68429b24ae88cb9b8af45d47cbd52f5344d80f8b..2d686a17ddd1eb39330d98aebe9ebcd32698f144 100755 (executable)
@@ -1,7 +1,7 @@
 #!/usr/bin/perl
 use warnings;
 use strict;
-use Test::More tests => 85;
+use Test::More tests => 88;
 
 BEGIN { use_ok("IkiWiki"); }
 %config=IkiWiki::defaultconfig();
@@ -85,3 +85,8 @@ foreach my $spec ("index or (backlink(index) and !*.png)", "backlink(foo)") {
        ok($IkiWiki::depends{foo7}{$spec} & $IkiWiki::DEPEND_LINKS);
        ok(! ($IkiWiki::depends{foo7}{$spec} & $IkiWiki::DEPEND_PRESENCE));
 }
+
+# content is the default if unknown types are entered
+ok(add_depends("foo8", "*", presenCe => 1));
+ok($IkiWiki::depends{foo8}{"*"} & $IkiWiki::DEPEND_CONTENT);
+ok(! ($IkiWiki::depends{foo8}{"*"} & ($IkiWiki::DEPEND_PRESENCE | $IkiWiki::DEPEND_LINKS)));