summaryrefslogtreecommitdiff
path: root/spec/persist_spec.lua
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2018-12-10 15:53:26 -0200
committerHisham Muhammad <hisham@gobolinux.org>2018-12-10 15:53:26 -0200
commit9bb5c285f007d4d2f83ff5593db5afa7fa2a0310 (patch)
tree63caa335d2bb74e7c039284b861fdc1d6c151405 /spec/persist_spec.lua
parent914a2b7503b15c40894ac9efb8f33352f1a75cd1 (diff)
downloadluarocks-9bb5c285f007d4d2f83ff5593db5afa7fa2a0310.tar.gz
luarocks-9bb5c285f007d4d2f83ff5593db5afa7fa2a0310.tar.bz2
luarocks-9bb5c285f007d4d2f83ff5593db5afa7fa2a0310.zip
persist: handle keys that are keywords correctly.
Closes #947.
Diffstat (limited to 'spec/persist_spec.lua')
-rw-r--r--spec/persist_spec.lua8
1 files changed, 8 insertions, 0 deletions
diff --git a/spec/persist_spec.lua b/spec/persist_spec.lua
index dccb0ec4..734b2a4e 100644
--- a/spec/persist_spec.lua
+++ b/spec/persist_spec.lua
@@ -36,6 +36,14 @@ foo = {
36]], persist.save_from_table_to_string({foo = {1, 2, 3, 4}, bar = {baz = "string"}})) 36]], persist.save_from_table_to_string({foo = {1, 2, 3, 4}, bar = {baz = "string"}}))
37 end) 37 end)
38 38
39 it("table with a keyword key (#947)", function()
40 assert.are.same([[
41bar = {
42 ["function"] = "foo"
43}
44]], persist.save_from_table_to_string({bar = {["function"] = "foo"}}))
45 end)
46
39 it("strings with quotes", function() 47 it("strings with quotes", function()
40 assert.are.same([[ 48 assert.are.same([[
41bar = "a \\backslash?" 49bar = "a \\backslash?"