Fixed decoding of escaped '/', added test

pull/6/head
rxi 2015-08-31 18:43:08 +01:00
parent 45cd518b25
commit 4fb28bbeee
2 changed files with 2 additions and 1 deletions

View File

@ -25,7 +25,7 @@ local escape_char_map = {
[ "\t" ] = "\\t",
}
local escape_char_map_inv = {}
local escape_char_map_inv = { [ "\\/" ] = "/" }
for k, v in pairs(escape_char_map) do
escape_char_map_inv[v] = k
end

View File

@ -156,6 +156,7 @@ test("decode escape", function()
[ [["\r\n\t\\\""]] ] = '\r\n\t\\"',
[ [["\\"]] ] = '\\',
[ [["\\\\"]] ] = '\\\\',
[ [["\/"]] ] = '/',
}
for k, v in pairs(t) do
local res = json.decode(k)