aboutsummaryrefslogtreecommitdiff
path: root/tests (follow)
Commit message (Collapse)AuthorAgeFilesLines
* feature: Lua 5.3 + 5.4 integer support, with CI and conflicts fixed.Hisham Muhammad2024-06-112-0/+43
| | | | | | | | | | Co-Authored-By: Hisham Muhammad <hisham@gobolinux.org> Co-authored-by: Mark Pulford <mark@kyne.com.au> Co-authored-by: ichenq <ichenq@gmail.com> Co-authored-by: Cloud Wu <cloudwu@gmail.com> Co-authored-by: caijietao <t0350.prog@gmail.com> Co-authored-by: actboy168 <actboy168@gmail.com> Co-authored-by: wudeng <wudeng256@gmail.com> Co-authored-by: caiyiheng <rangercyh@qq.com>
* feature: Add option to skip invalid value types. lijunlong2023-02-221-0/+26
| | | Co-authored-by: Jesper Lundgren <jesperlundgren@exosite.com>
* bumped version to 2.1.0.11. (#86)Johnny Wang2023-01-191-1/+1
|
* bumped version to 2.1.0.10. (#79)2.1.0.10rc12.1.0.10Johnny Wang2021-12-101-1/+1
|
* bump version to 2.1.0.92.1.0.9leaf corcoran2021-02-151-1/+1
|
* write sort_json, use it on perl tests to prevent hash table ordering failuresleaf corcoran2020-04-252-5/+69
|
* attempt to run openresty perl testsleaf corcoran2020-04-251-2/+3
|
* support error message testing for modern versions of lualeaf corcoran2020-04-251-12/+56
|
* add one_of testing to avoid hash table ordering causing test to failleaf corcoran2020-04-251-1/+6
|
* feature: add option to disable forward slash escaping2.1.0.8rc12.1.0.8Jesper Lundgren2020-03-241-0/+19
| | | | Thanks @spacewander for optimization and documentation.
* bumped version to 2.1.0.6.2.1.0.6Yichun Zhang (agentzh)2018-04-191-1/+1
|
* feature: set cjson.array_mt on decoded JSON arrays.2.1.0.6rc1Thibault Charbonnier2017-11-171-6/+55
| | | | | | | this can be turned on via cjson.decode_array_with_array_mt(true). off by default. Signed-off-by: Yichun Zhang (agentzh) <agentzh@gmail.com>
* feature: added new cjson.array_mt metatable to allow enforcing JSON array ↵Thibault Charbonnier2017-11-151-4/+75
| | | | | | encoding. Signed-off-by: Yichun Zhang (agentzh) <agentzh@gmail.com>
* tests: now we use luajit to run the test suite.Yichun Zhang (agentzh)2017-11-153-3/+6
|
* bugfix: preserve 'empty_array_mt' behavior upon multiple loadings of the module.Thibault Charbonnier2016-12-171-2/+26
| | | | | | | | | | | | | Prior to this fix, when the module would be loaded several times (by-passing `package.loaded`), the `lua_cjson_new` function would override the `empty_array_mt` table in the registry with a new one. Comparison for equality between those tables would then fail, and the behavior would be broken. This was discovered after loading `cjson` *and* `cjson.safe` in the same application, resulting in two calls to `lua_cjson_new`. Signed-off-by: Yichun Zhang (agentzh) <agentzh@gmail.com>
* feat: cjson.as_array metamethod to enforce empty array encodingThibault Charbonnier2016-03-031-2/+74
| | | | | | | | | | | | | | A proposed improved patch of openresty/lua-cjson#1 (a patch commonly proposed to lua-cjson and its forks), taking into considerations comments from the original PR. - use a lightuserdata key to store the metatable in the Lua Registry (more efficient and avoiding conflicts) - provide a lightuserdata resulting in empty arrays as well - tests cases moved to t/agentzh.t, where cases for 'encode_empty_table_as_object' are already written. It seems like a better place for tests specific to the OpenResty fork's additions. - a more complex test case
* feature: now we allow up to 16 decimal places in JSON number encoding via ↵2.1.0.3Brandon2015-11-042-1/+16
| | | | | | | | cjson.encode_number_precision(). thanks lordnynex for the patch in #4. Test cases for changing precision
* tests: made the valgrind testing mode more obvious.Yichun Zhang (agentzh)2015-11-041-0/+1
|
* added one passing test.Yichun Zhang (agentzh)2014-03-311-0/+11
|
* feature: applied Jiale Zhi's patch to add the new config function ↵2.1.0.1Yichun Zhang (agentzh)2014-02-182-0/+111
| | | | encode_empty_table_as_object so that we can encode empty Lua tables into empty JSON arrays.
* Use Javascript compat values for Infinity/NaNMark Pulford2012-03-041-5/+7
| | | | | Use Javascript compatible values for Infinity/NaN when encoding invalid numbers.
* Bump version to 2.1develMark Pulford2012-03-041-1/+1
|
* Add cjson.safe module to suppress exceptionsMark Pulford2012-03-041-0/+14
| | | | Add cjson.safe module to suppress exceptions during JSON conversions.
* Bump version to 2.0develMark Pulford2012-03-041-1/+1
| | | | | Bump version to 2.0devel due to significant changes and updated API (runtime config not fully backwards compatible).
* Simplify string.format() callsMark Pulford2012-03-042-5/+5
| | | | Simply string.format() calls with OO method notation.
* Create separate tests for numbers w/leading zerosMark Pulford2012-03-041-3/+8
| | | | | | Create separate tests for numbers with leading zeros. This allows the earlier "normal" number test to pass. Also update hexadecimal test to use the "p" exponent format.
* Remove deprecated "refuse_invalid_numbers"Mark Pulford2012-03-041-2/+2
| | | | | | Remove deprecated "refuse_invalid_numbers" since the version number will be bumped to 1.1.0. Also remove "version" variable since it has been replaced by _VERSION.
* Bump development version to 1.1develMark Pulford2012-03-041-1/+1
|
* Disable registration of cjson global variableMark Pulford2012-03-041-1/+1
| | | | | | | Disable registration of cjson module table global variable in the default build. Automatically creating a variable in the global namespace can cause issues for other software and is no longer recommended with Lua.
* Return boolean values from configuration functionsMark Pulford2012-03-041-11/+11
| | | | | | Return boolean values from configuration functions to simplify usage in the common case. Eg,: if not cjson.encode_invalid_numbers() then .. end
* Add depth/index to decode depth error messageMark Pulford2012-03-041-2/+5
| | | | | | | | | Include depth and character index when throwing decode nesting errors. Pre-emptively add a test decoding a massively nested JSON array. Lua stack overflow faults are unlikely to occur on simple data structures. Valgrind can highlight stack allocation bugs with complicated JSON even if the test succeeds.
* Fix Lua C function stack overflow during encodingMark Pulford2012-03-041-0/+9
| | | | | | | | | Ensure there are enough Lua stack slots available before descending into another table during encoding. This fixes a segfault when encoding deeply nested tables. This bug wasn't noticed earlier due to the previous limit of 20 nested tables.
* Recommend genutf8.pl when utf8.dat is missingMark Pulford2012-03-041-1/+1
|
* Add "throw error" to test descriptionsMark Pulford2012-03-041-41/+41
| | | | | Add "throw error" to descriptions for tests which are intended to generate errors.
* Test config API errors and setting configurationMark Pulford2012-03-041-28/+66
| | | | | | | - Update comments - Use enumerated return values - Test various configuration API errors - Test resetting configuration to default
* Tidy tests and improve coverageMark Pulford2012-03-041-84/+112
| | | | | | | | | | | | - Rearrange test sections to keep more related tests together. - Test configuration functions for errors Add tests for more parts of the Lua CJSON API: - _NAME, _VERSION, version - encode_keep_buffer - encode_number_precision - decode_invalid_numbers - decode_max_depth
* Place nested data structure inline with testsMark Pulford2012-03-041-4/+2
| | | | | Make the tests more explicit, the nested data structure doesn't need to be generated in advance.
* Gather all test data into a tableMark Pulford2012-03-041-20/+32
| | | | Move all test data into a single data to tidy the main namespace.
* Add descriptions to all testsMark Pulford2012-03-041-143/+192
| | | | Rewrite test framework and add descriptions for all tests.
* Add tests for decode_max_depth()Mark Pulford2012-03-041-5/+13
|
* Improve benchmark stabilityMark Pulford2012-03-041-7/+36
| | | | | | | | | Update benchmark script to average the best half (round up) of the result set. Ensure the initial call rate is calculated from a run of at least 1ms. Remove garbage collection control since any variations due to garbage collection are better handled by averaging multiple results.
* Add option to encode invalid numbers as "null"Mark Pulford2012-03-041-7/+14
| | | | | Deprecate and replace refuse_invalid_numbers() with encode_invalid_numbers() and decode_invalid_numbers().
* Rename "cjson-misc" module to "cjson.util"Mark Pulford2012-03-042-19/+19
|
* Move cjson-misc and scripts to "lua" directoryMark Pulford2012-03-043-311/+0
|
* Update cjson-misc.lua file descriptionMark Pulford2012-03-041-1/+1
|
* Update bench.lua to support different JSON modulesMark Pulford2012-03-043-41/+62
| | | | | | - Select via JSON_MODULE environment variable (default "cjson") - Custom runtime configuration can be stored in bench-MODNAME.lua - Add run_script() to cjson-misc and update lua2cjson.lua
* Limit significant digits in numbers.json to 14Mark Pulford2012-03-041-6/+6
| | | | | | The dtoa.c strtod() function slows down significantly when the number of digits exceeds the accuracy of a "double". JSON containing excessive digits is an unrepresentative test, limit to 14 digits.
* Add support for Lua 5.2 environments to lua2jsonMark Pulford2012-01-031-9/+23
|
* Rename encode/decode scripts to lua2json/json2luaMark Pulford2012-01-032-6/+6
|
* Convert common.lua into cjson-misc moduleMark Pulford2012-01-035-35/+43
|