2 function encode(encode
, json
)
3 local function test(f
, j
, e
)
7 assert_equal(f(j
), f(json
.decode(f(j
))));
9 test(encode
, json
.null
, "null")
10 test(encode
, {}, "{}")
12 test(encode
, {a
={1,2,3}});
13 test(encode
, {1}, "[1]");
16 function decode(decode
)
17 local empty_array
= decode("[]");
18 assert_equal(type(empty_array
), "table");
19 assert_equal(#empty_array
, 0);
20 assert_equal(next(empty_array
), nil);