diff options
author | Daniel Silverstone <dsilvers@digital-scurf.org> | 2017-05-13 10:45:28 +0100 |
---|---|---|
committer | Daniel Silverstone <dsilvers@digital-scurf.org> | 2017-05-13 10:45:28 +0100 |
commit | 2b519094313c6f771dc484f9e65169b216c469f6 (patch) | |
tree | 67b1109b28a2ae3d31543d00f9ea30507cb0346b | |
parent | febbfabe516ed12070f11ba4a9381692352ea12b (diff) | |
download | lace-2b519094313c6f771dc484f9e65169b216c469f6.tar.gz |
Test for bad defines in allow
Ensure that when a bad define name is used in an allow
that we report it, and hilight it properly.
-rw-r--r-- | test/test-lace.builtin.lua | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/test-lace.builtin.lua b/test/test-lace.builtin.lua index ff4d613..48b8d45 100644 --- a/test/test-lace.builtin.lua +++ b/test/test-lace.builtin.lua @@ -75,6 +75,16 @@ function suite.run_builtin_allow_deny_novariables() assert(msg == "because", "Expected reason should be 'because'") end +function suite.run_builtin_allow_deny_baddefines() + local compctx = {_lace = {}} + local cmdtab, msg = builtin.commands.allow(compctx, "allow", "because", "boogaloo") + assert(cmdtab == false, "Internal errors should return false") + assert(type(msg) == "table", "Internal errors should return tables") + assert(type(msg.msg) == "string", "Internal errors should have string messages") + assert(msg.msg:match("boogaloo"), "Expected error should mention 'boogaloo'") + assert(msg.words[1] == 3, "Expected hilight to be word 3 (boogaloo)") +end + function suite.builtin_get_set_unconditional() builtin.get_set_last_unconditional_result("FOO") assert(builtin.get_set_last_unconditional_result() == "FOO", |