diff options
author | Jesper Lundgren <jesperlundgren@exosite.com> | 2020-03-09 16:12:24 +0800 |
---|---|---|
committer | 罗泽轩 <spacewanderlzx@gmail.com> | 2020-03-24 09:03:48 +0800 |
commit | 0df488874f52a881d14b5876babaa780bb6200ee (patch) | |
tree | fc41c7a1842662e6b411f83b8ab4a7776244f806 /tests | |
parent | 9931667547e2eda9911ec07b0f408b1a04b8a46c (diff) | |
download | lua-cjson-2.1.0.8rc1.tar.gz lua-cjson-2.1.0.8rc1.tar.bz2 lua-cjson-2.1.0.8rc1.zip |
feature: add option to disable forward slash escaping2.1.0.8rc12.1.0.8
Thanks @spacewander for optimization and documentation.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/agentzh.t | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/agentzh.t b/tests/agentzh.t index 7967337..7591902 100644 --- a/tests/agentzh.t +++ b/tests/agentzh.t | |||
@@ -284,3 +284,22 @@ print(string.format("%16.0f", cjson.decode("9007199254740992"))) | |||
284 | 9.007199254741e+15 | 284 | 9.007199254741e+15 |
285 | 9007199254740992 | 285 | 9007199254740992 |
286 | 9007199254740992 | 286 | 9007199254740992 |
287 | |||
288 | |||
289 | |||
290 | === TEST 21: / in string | ||
291 | --- lua | ||
292 | local cjson = require "cjson" | ||
293 | local a={test = "http://google.com/google"} | ||
294 | local b=cjson.encode(a) | ||
295 | print(b) | ||
296 | cjson.encode_escape_forward_slash(false) | ||
297 | local b=cjson.encode(a) | ||
298 | print(b) | ||
299 | cjson.encode_escape_forward_slash(true) | ||
300 | local b=cjson.encode(a) | ||
301 | print(b) | ||
302 | --- out | ||
303 | {"test":"http:\/\/google.com\/google"} | ||
304 | {"test":"http://google.com/google"} | ||
305 | {"test":"http:\/\/google.com\/google"} | ||