diff options
| author | SnowOnion <snowonionlee@gmail.com> | 2026-06-14 21:30:49 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-06-14 21:30:49 +0800 |
| commit | fa418dcac3de13c9fe2ddc997bd53e92d793f0bc (patch) | |
| tree | 504480de7d00dade1233437641f6cac3dee65b3e /tests/test.lua | |
| parent | b97100852940cd7cd0ee187326778fa7c911d92f (diff) | |
| download | lua-cjson-fa418dcac3de13c9fe2ddc997bd53e92d793f0bc.tar.gz lua-cjson-fa418dcac3de13c9fe2ddc997bd53e92d793f0bc.tar.bz2 lua-cjson-fa418dcac3de13c9fe2ddc997bd53e92d793f0bc.zip | |
bugfix: setting encode_escape_forward_slash on a cjson instance does not affect other instances.2.1.0.18
Diffstat (limited to '')
| -rwxr-xr-x | tests/test.lua | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/test.lua b/tests/test.lua index 270f63a..fc373f6 100755 --- a/tests/test.lua +++ b/tests/test.lua | |||
| @@ -515,6 +515,18 @@ local cjson_tests = { | |||
| 515 | { "Decode (safe) error generation after new()", | 515 | { "Decode (safe) error generation after new()", |
| 516 | function(...) return json_safe.new().decode(...) end, { "Oops" }, | 516 | function(...) return json_safe.new().decode(...) end, { "Oops" }, |
| 517 | true, { nil, "Expected value but found invalid token at character 1" } }, | 517 | true, { nil, "Expected value but found invalid token at character 1" } }, |
| 518 | { "Set encode_escape_forward_slash on a cjson instance should not affect other instances", | ||
| 519 | function() | ||
| 520 | local j1 = json.new() | ||
| 521 | local r1 = j1.encode("/") | ||
| 522 | |||
| 523 | local j2 = json.new() | ||
| 524 | j2.encode_escape_forward_slash(false) | ||
| 525 | local r2 = j2.encode("/") | ||
| 526 | local r3 = j1.encode("/") | ||
| 527 | return r1, r2, r3 | ||
| 528 | end, { }, | ||
| 529 | true, { [["\/"]], [["/"]], [["\/"]] } }, | ||
| 518 | } | 530 | } |
| 519 | 531 | ||
| 520 | print(("==> Testing Lua CJSON version %s\n"):format(json._VERSION)) | 532 | print(("==> Testing Lua CJSON version %s\n"):format(json._VERSION)) |
