summaryrefslogtreecommitdiff
path: root/test/test-lace.lex.lua
diff options
context:
space:
mode:
Diffstat (limited to 'test/test-lace.lex.lua')
-rw-r--r--test/test-lace.lex.lua12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/test-lace.lex.lua b/test/test-lace.lex.lua
index 5d9d552..41f1685 100644
--- a/test/test-lace.lex.lua
+++ b/test/test-lace.lex.lua
@@ -248,6 +248,18 @@ function suite.escape_inside_unclosed_unused()
assert(content.lines[1].warnings[2]:find("escape"), "The warning should be about the escape")
end
+function suite.empty_string_words_work()
+ local content = assert(lex.string("allow ''", "SRC"))
+ assert(content.source == "SRC", "Source name not propagated")
+ assert(type(content.lines) == "table", "Lines is not a table")
+ assert(#content.lines == 1, "There should have been one line")
+ assert(#content.lines[1].content == 2, "The line should have 2 words")
+ assert(content.lines[1].content[1].spos == 1, "The first word starts at the first character")
+ assert(content.lines[1].content[1].str == "allow", "The word is \"allow\"")
+ assert(content.lines[1].content[2].str == "", "The second word is empty")
+ assert(content.lines[1].content[2].spos == 7, "The empty word starts at the seventh character")
+end
+
local count_ok = 0
for _, testname in ipairs(testnames) do
print("Run: " .. testname)