summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/lace/builtin.lua2
-rw-r--r--test/test-lace.builtin.lua8
2 files changed, 3 insertions, 7 deletions
diff --git a/lib/lace/builtin.lua b/lib/lace/builtin.lua
index 289f688..ff1cfd2 100644
--- a/lib/lace/builtin.lua
+++ b/lib/lace/builtin.lua
@@ -81,7 +81,7 @@ function builtin.default(compcontext, def, result, reason, unwanted)
return compiler().error("Cannot change the default")
end
- compcontext[".lace"].default = { result, reason }
+ compcontext[".lace"].default = _return(compcontext, result, reason)
return {
fn = function() return true end,
diff --git a/test/test-lace.builtin.lua b/test/test-lace.builtin.lua
index 4da3bb2..558f15a 100644
--- a/test/test-lace.builtin.lua
+++ b/test/test-lace.builtin.lua
@@ -135,9 +135,7 @@ function suite.compile_builtin_default_ok()
assert(type(cmdtab.args) == "table", "And an arg table")
assert(cmdtab.fn() == true, "Default command should always return true")
assert(type(compctx[".lace"].default) == "table", "Default should always set up the context")
- assert(#compctx[".lace"].default == 2, "Default table should consist of two entries")
- assert(compctx[".lace"].default[1] == "allow", "First entry should be the result")
- assert(compctx[".lace"].default[2] == "because", "Second entry should be the reason")
+ assert(type(compctx[".lace"].default.fn) == "function", "Default table should have a function like a rule")
end
function suite.compile_builtin_default_twice()
@@ -159,9 +157,7 @@ function suite.compile_builtin_default_noreason()
assert(type(cmdtab.args) == "table", "And an arg table")
assert(cmdtab.fn() == true, "Default command should always return true")
assert(type(compctx[".lace"].default) == "table", "Default should always set up the context")
- assert(#compctx[".lace"].default == 2, "Default table should consist of two entries")
- assert(compctx[".lace"].default[1] == "allow", "First entry should be the result")
- assert(compctx[".lace"].default[2] == "Default behaviour", "Second entry should be the reason")
+ assert(type(compctx[".lace"].default.fn) == "function", "Default table should have a function like a rule")
end