diff options
| author | Mark Pulford <mark@kyne.com.au> | 2012-01-16 19:56:52 +1030 |
|---|---|---|
| committer | Mark Pulford <mark@kyne.com.au> | 2012-03-04 18:54:34 +1030 |
| commit | 1c1adf1f43b78ac73617437d97d191546d9d6ab7 (patch) | |
| tree | 0b7b116aa72f99eff96f431b66fe809ba7f3b2b4 | |
| parent | efed00e617c5ff68d672a148190dcb7c0bbacaa7 (diff) | |
| download | lua-cjson-1c1adf1f43b78ac73617437d97d191546d9d6ab7.tar.gz lua-cjson-1c1adf1f43b78ac73617437d97d191546d9d6ab7.tar.bz2 lua-cjson-1c1adf1f43b78ac73617437d97d191546d9d6ab7.zip | |
Place nested data structure inline with tests
Make the tests more explicit, the nested data structure doesn't need to
be generated in advance.
| -rwxr-xr-x | tests/test.lua | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/tests/test.lua b/tests/test.lua index 424a630..43f48ad 100755 --- a/tests/test.lua +++ b/tests/test.lua | |||
| @@ -64,8 +64,6 @@ function load_testdata() | |||
| 64 | data.utf8_raw = "Failed to load utf8.dat" | 64 | data.utf8_raw = "Failed to load utf8.dat" |
| 65 | end | 65 | end |
| 66 | 66 | ||
| 67 | data.nested5 = {{{{{ "nested" }}}}} | ||
| 68 | |||
| 69 | data.table_cycle = {} | 67 | data.table_cycle = {} |
| 70 | data.table_cycle[1] = data.table_cycle | 68 | data.table_cycle[1] = data.table_cycle |
| 71 | 69 | ||
| @@ -219,9 +217,9 @@ local all_tests = { | |||
| 219 | true, { '{"2":"numeric string key test"}' } }, | 217 | true, { '{"2":"numeric string key test"}' } }, |
| 220 | 218 | ||
| 221 | { "Encode nested table", | 219 | { "Encode nested table", |
| 222 | json.encode, { testdata.nested5 }, true, { '[[[[["nested"]]]]]' } }, | 220 | json.encode, { {{{{{"nested"}}}}} }, true, { '[[[[["nested"]]]]]' } }, |
| 223 | { "Encode nested table (throw error)", | 221 | { "Encode nested table (throw error)", |
| 224 | json.encode, { { testdata.nested5 } }, | 222 | json.encode, { { {{{{{"nested"}}}}} } }, |
| 225 | false, { "Cannot serialise, excessive nesting (6)" } }, | 223 | false, { "Cannot serialise, excessive nesting (6)" } }, |
| 226 | { "Encode table with cycle", | 224 | { "Encode table with cycle", |
| 227 | json.encode, { testdata.table_cycle }, | 225 | json.encode, { testdata.table_cycle }, |
