summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@digital-scurf.org>2015-11-05 14:21:31 +0000
committerDaniel Silverstone <dsilvers@digital-scurf.org>2015-11-05 14:21:31 +0000
commitb931a482d7d152c53863d1f15413d6ce595d6c79 (patch)
tree3938098eaa88859b8509d2559e4cc6eee23b3a71
parentd802f4714a68b28a7b48f03d4784ff4d04bf4a78 (diff)
downloadlace-b931a482d7d152c53863d1f15413d6ce595d6c79.tar.bz2
Fix small bug which fails to propagate defaults
-rw-r--r--lib/lace/compiler.lua4
-rw-r--r--test/test-lace.compile-defaults_propagate.rules2
-rw-r--r--test/test-lace.compile-defaults_propagate_2.rules1
-rw-r--r--test/test-lace.compiler.lua7
4 files changed, 11 insertions, 3 deletions
diff --git a/lib/lace/compiler.lua b/lib/lace/compiler.lua
index 26a4e23..57b432f 100644
--- a/lib/lace/compiler.lua
+++ b/lib/lace/compiler.lua
@@ -2,7 +2,7 @@
--
-- Lua Access Control Engine - Ruleset compiler
--
--- Copyright 2012 Daniel Silverstone <dsilvers@digital-scurf.org>
+-- Copyright 2012,2015 Daniel Silverstone <dsilvers@digital-scurf.org>
--
-- For licence terms, see COPYING
--
@@ -152,7 +152,7 @@ local function internal_compile_ruleset(compcontext, sourcename, content, suppre
-- in which case use the default
-- There's no unconditional result and no default, fake up a default and
-- then use it.
- if not suppress_default and not uncond and not result then
+ if not suppress_default and not uncond and not result and not compcontext._lace.default then
local _, nores = err.error("No result set whatsoever", {})
return false, err.augment(nores, ruleset.content, #ruleset.content.lines + 1)
end
diff --git a/test/test-lace.compile-defaults_propagate.rules b/test/test-lace.compile-defaults_propagate.rules
new file mode 100644
index 0000000..d7d11e5
--- /dev/null
+++ b/test/test-lace.compile-defaults_propagate.rules
@@ -0,0 +1,2 @@
+# Nothing
+include defaults_propagate_2
diff --git a/test/test-lace.compile-defaults_propagate_2.rules b/test/test-lace.compile-defaults_propagate_2.rules
new file mode 100644
index 0000000..464f4f4
--- /dev/null
+++ b/test/test-lace.compile-defaults_propagate_2.rules
@@ -0,0 +1 @@
+default allow "OK"
diff --git a/test/test-lace.compiler.lua b/test/test-lace.compiler.lua
index 89fde98..412f93c 100644
--- a/test/test-lace.compiler.lua
+++ b/test/test-lace.compiler.lua
@@ -2,7 +2,7 @@
--
-- Lua Access Control Engine -- Tests for the compiler
--
--- Copyright 2012 Daniel Silverstone <dsilvers@digital-scurf.org>
+-- Copyright 2012,2015 Daniel Silverstone <dsilvers@digital-scurf.org>
--
-- For Licence terms, see COPYING
--
@@ -375,6 +375,11 @@ function suite.error_in_include2()
assert(line4 == " ^^^^^^^^^^^^^^^^^^^^^^^^", "The fourth line highlights relevant words")
end
+function suite.defaults_propagate()
+ local result, msg = compiler.compile(comp_context, "defaults_propagate")
+ assert(result, msg)
+end
+
local count_ok = 0
for _, testname in ipairs(testnames) do
-- print("Run: " .. testname)