aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rwxr-xr-xtests/test.lua9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/test.lua b/tests/test.lua
index a827e6a..4c00453 100755
--- a/tests/test.lua
+++ b/tests/test.lua
@@ -67,6 +67,12 @@ function load_testdata()
67 data.table_cycle = {} 67 data.table_cycle = {}
68 data.table_cycle[1] = data.table_cycle 68 data.table_cycle[1] = data.table_cycle
69 69
70 local big = {}
71 for i = 1, 1100 do
72 big = { { 10, false, true, cjson.null }, "string", a = big }
73 end
74 data.deeply_nested_data = big
75
70 return data 76 return data
71end 77end
72 78
@@ -185,6 +191,9 @@ local cjson_tests = {
185 false, { "Cannot serialise, excessive nesting (6)" } }, 191 false, { "Cannot serialise, excessive nesting (6)" } },
186 { "Set encode_max_depth(1000)", 192 { "Set encode_max_depth(1000)",
187 json.encode_max_depth, { 1000 }, true, { 1000 } }, 193 json.encode_max_depth, { 1000 }, true, { 1000 } },
194 { "Encode deeply nested data [throw error]",
195 json.encode, { testdata.deeply_nested_data },
196 false, { "Cannot serialise, excessive nesting (1001)" } },
188 197
189 -- Test encoding simple types 198 -- Test encoding simple types
190 { "Encode null", 199 { "Encode null",