summaryrefslogtreecommitdiff
path: root/test/test-lace.engine.lua
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@digital-scurf.org>2015-11-30 18:11:03 +0000
committerDaniel Silverstone <dsilvers@digital-scurf.org>2015-11-30 18:11:03 +0000
commitca9fa31776e6a5652b02aee6f12e1809cfa3cc22 (patch)
tree0abb5c5bc75520b183b91c7539030160e17eceba /test/test-lace.engine.lua
parenta6a6ee4f86f354477e4b5d374dba4c4e90d03df6 (diff)
parentb1a8d13ae5854b488ef4e7243fa7bf626eeb458e (diff)
downloadlace-ca9fa31776e6a5652b02aee6f12e1809cfa3cc22.tar.gz
Merge branch 'subword-errors' of git://git.gitano.org.uk/personal/richardmaw/lace
Diffstat (limited to 'test/test-lace.engine.lua')
-rw-r--r--test/test-lace.engine.lua17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/test-lace.engine.lua b/test/test-lace.engine.lua
index 936a2ed..7b8a055 100644
--- a/test/test-lace.engine.lua
+++ b/test/test-lace.engine.lua
@@ -289,6 +289,23 @@ function suite.subsubdefine_err_reported()
assert(line4 == " ^^^^^ ", "The fourth line highlights relevant words")
end
+function suite.subdefine_chained_err_reported()
+ local ruleset, msg = lace.compiler.compile(comp_context, "chaindefine-error")
+ assert(type(ruleset) == "table", "Ruleset did not compile")
+ local ectx = {error = true}
+ local result, msg = lace.engine.run(ruleset, ectx)
+ assert(result == false, "Did not error out")
+ local lines = {}
+ msg:gsub("([^\n]*)\n?", function(c) table.insert(lines, c) end)
+ assert(lines[1] == "woah", "The first line must mention the error")
+ assert(lines[2] == "real-chaindefine-error :: 2", "The second line is where the error happened")
+ assert(lines[3] == 'allow "FAIL" [anyof [equal jeff banana] bogus]', "The third line is the original line")
+ assert(lines[4] == " ^^^^^ ", "The fourth line highlights relevant words")
+ assert(lines[5] == "real-chaindefine-error :: 1", "The fifth line is where the definition that errored comes from")
+ assert(lines[6] == 'define bogus error', "The sixth line is the define")
+ assert(lines[7] == " ^^^^^", "The seventh line highlights relevant words")
+end
+
local count_ok = 0
for _, testname in ipairs(testnames) do
-- print("Run: " .. testname)