summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@digital-scurf.org>2012-05-13 23:17:01 +0100
committerDaniel Silverstone <dsilvers@digital-scurf.org>2012-05-13 23:17:01 +0100
commit2b596488ddf1e401f7bb51411775bbced4f07185 (patch)
tree2a4f2475fced8f490900840a120ee64fc2a654f0 /test
parent6c7d53071fc0334482bcb8c349987d19ee01babe (diff)
downloadlace-2b596488ddf1e401f7bb51411775bbced4f07185.tar.gz
Allow empty quotes to force an empty word to get into the lexer output
Diffstat (limited to 'test')
-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)