cover some edgecases and invalid tables in tests
This commit is contained in:
parent
23f01fe6da
commit
c0aaedae59
18
init.lua
18
init.lua
@ -9,13 +9,27 @@ dofile(test_string_to_table.modpath .. "algtour.lua")
|
||||
|
||||
local tests = {
|
||||
'{1, 2, 3}',
|
||||
'{a = 1, b = 2, c = 3}',
|
||||
'{a = 1; b = 2; c = 3}',
|
||||
'{a = {b = {c = 3}}}',
|
||||
'{1, "hello", true, false, nil, 3.14}',
|
||||
'{[1] = "one", [2] = "two", ["three"] = 3}',
|
||||
'{"quoted string", \'single quoted\'}',
|
||||
'{nested = {tables = {are = {supported = true}}}}',
|
||||
"{key1 = 123, key2 = true, key3 = {nestedKey1 = 'value1', nestedKey2 = false}}"
|
||||
"{key1 = 123, key2 = true, key3 = {nestedKey1 = 'value1', nestedKey2 = false}}",
|
||||
"{}", "{ }",
|
||||
"{[{'tables can be'}] = 'keys too'}",
|
||||
'{\'{table = "that", "contains", a = "string", ["looking"] = {"like", "a"; "table"}}\'}',
|
||||
'{[-42.42e42] = 42.42E-42}',
|
||||
'{1, 2, 3, }',
|
||||
-- invalid tables, the code should return an error
|
||||
-- --[[
|
||||
"{a = 1",
|
||||
"{'unclosed string\\'}",
|
||||
"{invalid key = 3}",
|
||||
"{1 = 2}", -- invalid key
|
||||
"{,}",
|
||||
"{[nil] = 1}"
|
||||
--]]
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user