From 7a8b492bcce45123cef45ebe6f97cd70b38b9db7 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 6 Oct 2009 19:07:52 -0400 Subject: [PATCH] add_depends should default to content dependencies if unknown type specified --- IkiWiki.pm | 4 +--- t/add_depends.t | 7 ++++++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/IkiWiki.pm b/IkiWiki.pm index 7348ea2f7..7b1d24c6a 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm @@ -1810,9 +1810,7 @@ sub add_depends ($$;@) { } } } - else { - $deptype=$DEPEND_CONTENT; - } + $deptype=$DEPEND_CONTENT unless $deptype; if ($simple) { $depends_simple{$page}{lc $pagespec} |= $deptype; diff --git a/t/add_depends.t b/t/add_depends.t index 68429b24a..2d686a17d 100755 --- a/t/add_depends.t +++ b/t/add_depends.t @@ -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))); -- 2.26.2