forked from Dependencies/lua-json
Fixed decoding of escaped '/', added test
parent
45cd518b25
commit
4fb28bbeee
2
json.lua
2
json.lua
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue