aboutsummaryrefslogtreecommitdiff
path: root/test
AgeCommit message (Collapse)AuthorFilesLines
2024-03-25Add more testsPetri Lehtinen6-6/+6
2024-03-25Fix testsPetri Lehtinen6-1/+14
2024-03-25Simplify tests even morePetri Lehtinen13-18/+1
Drop the useless `export` lines from `env` files.
2024-03-21Refactor tests to work better with CMakePetri Lehtinen6-175/+33
2021-11-20tests: add some cases in fixed size testMaxim Zhukov1-0/+23
Signed-off-by: Maxim Zhukov <mussitantesmortem@gmail.com>
2021-09-09Fix the check-exports tests for versioned symbolsPetri Lehtinen1-1/+1
2021-01-14GitHub ActionsPetri Lehtinen1-38/+0
2020-11-19Merge pull request #520 from Mephistophiles/getnPetri Lehtinen2-1/+208
Add support getn, setn functions
2020-11-05Use size_t to receive result from fread()/ftell().Kelvin Lee1-1/+1
2020-09-01introduce new fixed-size key APIMaxim Zhukov2-0/+207
This commit added functions working with fixed-size strings (non null-terminated also). It's helpful for the following cases: * getting key from substring without copying to separate buffer (better perfomance) * using pure UTF-8 keys for the objets * hack: set binary structs as the keys (see test_binary_keys) added functions: * json_object_getn * json_object_setn * json_object_setn_nocheck * json_object_setn_new * json_object_setn_new_nocheck * json_object_deln * json_object_iter_key_len added iterators: * json_object_keylen_foreach * json_object_keylen_foreach_safe Signed-off-by: Maxim Zhukov <mussitantesmortem@gmail.com>
2020-08-12sort tests by alpha orderMaxim Zhukov1-1/+1
Signed-off-by: Maxim Zhukov <mussitantesmortem@gmail.com>
2020-05-06add jansson_* to shared library exportsXℹ Ruoyao1-1/+1
2019-10-21Run clang-format with make checkPetri Lehtinen1-4/+0
2019-10-21Tweak clang-format configuration a bitPetri Lehtinen14-300/+249
Set ColumnLimit to 90, remove AllowShortCaseLabelsOnASingleLine.
2019-10-21Run clang-format on *.c, *.hPetri Lehtinen19-1336/+1293
2019-10-17Merge branch 'master' into fix-issue281Petri Lehtinen4-8/+103
2019-10-17Merge pull request #505 from AllenX2018/recursive_object_updatePetri Lehtinen1-0/+81
Recursive object update
2019-10-17Merge pull request #500 from AllenX2018/fix-issue426Petri Lehtinen1-0/+4
fix issue #426: fix pipe function in MinGW
2019-10-17Merge pull request #506 from AllenX2018/add-json_equal-test-casePetri Lehtinen1-4/+14
fix typo & add negative test case for test_equal_complex
2019-10-15fix typo & add negative test case for test_equal_complexallen1-4/+14
2019-10-14update the test case of json_object_update_recursiveallen1-3/+1
2019-10-12add loop check for json_object_update_recursive functionallen1-1/+32
2019-10-11Add json_object_update_recursive()Henrique Cabral1-0/+52
Support merging values nested within objects. For instance, merging: { "foo": 1, "bar": { "baz": 2 } } with { "bar": { "baz": 3 } } results in { "foo": 1, "bar": { "baz": 3 } } instead of overwriting the value for the bar key.
2019-10-08fix issue #281allen1-0/+63
2019-10-08fix issue #426AllenX20181-0/+4
2019-09-23Merge pull request #494 from luzpaz/typosPetri Lehtinen2-4/+4
Fix various typos
2019-09-20Fix various typosluz.paz2-4/+4
Found via `codespell -q 2` (v1.17.0.dev0)
2019-08-12add loop check in json deep copy #457allen1-0/+53
2019-07-26Merge pull request #487 from cmeister2/cmeister2/ossfuzzcorpusCorey Farrell1-0/+3
ossfuzz: Zip up all "input" files to use as a seed corpus
2019-07-26Merge pull request #485 from cmeister2/cmeister2/fuzzerdiagsCorey Farrell1-8/+93
ossfuzz: Improvements to json_load_dump_fuzzer
2019-07-24ossfuzz: Zip up all "input" files to use as a seed corpusMax Dymond1-0/+3
2019-07-24Depending on the dump_mode byte, dump out as a string or as a callback.Max Dymond1-7/+34
2019-07-24Use the correct branch for OSS Fuzz as well.Max Dymond1-1/+3
2019-07-24Ensure OSS fuzz travis builds work for PRsMax Dymond1-1/+11
Use the correct repository for cloning when doing a push build or a pull-request. Only do one fuzzer build!
2019-07-24ossfuzz: Improvements to json_load_dump_fuzzerMax Dymond1-6/+64
Add in diagnostics to json_load_dump_fuzzer so that if FUZZ_VERBOSE is defined in the environment, additional debug information about the current test case is output to stderr. Replace json_dumps by json_dump_callback so that memory is not exhausted by excessively nested json objects.
2019-07-22Merge pull request #480 from cmeister2/cmeister2/ossfuzzCorey Farrell8-1/+211
oss-fuzz: Create a fuzzing target for jansson
2019-07-22correct spelling mistakeallen1-1/+1
2019-07-19Move ossfuzz directory and use Makefile.amMax Dymond8-1/+211
2019-03-12Add runtime version checking functionsSean Bright3-1/+62
This patch adds two new exported functions: * `jansson_version_str` - Returns a human-readable version number * `jansson_version_cmp` - Returns an integer less than, equal to, or greater than zero if the runtime version of Jansson is found, respectively, to be less than, to match, or be greater than the provided major, minor, and micro.
2018-11-05Remove inappropriate jsonp_free which caused segmentation fault.Corey Farrell1-0/+21
pack_string should never free str on error. This wouldn't be a problem except the check for `ours` was inverted. Just remove the check for ours since the true condition is unreachable. json_vpack_ex also had an error check for s.has_error. This can never be true unless value is NULL. Expand pack_unpack testing to cover empty format string, NULL object value with non-null concatenated key, array containing a non-null object after a NULL (error) string. Fixes #444
2018-09-25More work on json_pack error reporting.Corey Farrell1-2/+52
* Remove errant line-feed from pack_object error message. * Correct error message in pack_object_inter. * Create pack_integer / pack_real to get the correct error messages on failure when packing numeric values. * Add tests for packing NAN and infinity directly, in an array and as an object value.
2018-09-25json_pack: Improve handling of formats with '?' and '*'.Corey Farrell1-3/+46
When NULL is received for an optional argument we should not set an error message as this would block later error messages. If NULL is received for a non-optional string we should set has_error. Set has_error for UTF-8 errors to ensure optional strings with UTF-8 errors are not replaced with json_null(). Use 'purpose' argument in NULL error messages of read_string. Add error handling and tests for invalid formats where '+', '#', or '%' is used on an optional string 's?' or 's*'. Fix NULL string error messages to use 'purpose'. Refactor skipping of '*' token, this is now handled by read_string and pack_object_inter. This allows invalid format strings such as 's*#' and 's*+' to produce error messages. Fixes #437
2018-03-22Fix error handling in json_packMaxim Zhukov1-0/+8
Fixed a bug where the error message was not filled if an empty object was passed to the json_pack. Fixes #271
2018-03-06More test coverage.Corey Farrell1-1/+63
* Add test_load_callback to CMakeList.txt * Add json_dump, json_load and json_unpack chaos testing.
2018-02-15Improve test coverage.Corey Farrell11-1/+436
* Test equality of different length strings. * Add tab to json_pack whitespace test. * Test json_sprintf with empty result and invalid UTF. * Test json_get_alloc_funcs with NULL arguments. * Test invalid arguments. * Add test_chaos to test allocation failure code paths. * Remove redundant json_is_string checks from json_string_equal and json_string_copy. Both functions are static and can only be called with a json string. Fixes to issues found by test_chaos: * Fix crash on OOM in pack_unpack.c:read_string(). * Unconditionally free string in string_create upon allocation failure. Update load.c:parse_value() to reflect this. This resolves a leak on allocation failure for pack_unpack.c:pack_string() and value.c:json_sprintf(). Although not visible from CodeCoverage these changes significantly increase branch coverage. Especially in src/value.c where we previously covered 67.4% of branches and now cover 96.3% of branches.
2018-02-09Merge pull request #381 from phst/end-of-file-error-codePetri Lehtinen1-0/+8
Use a more specific error code for premature end of input
2018-02-09Add json_sprintf and json_vsprintfjson_sprintfPetri Lehtinen3-1/+26
Fixes #392
2017-12-20Use a more specific error code for premature end of inputPhilipp Stephani1-0/+8
2017-12-13json_pack: Enable more complete stealing of references.Corey Farrell1-0/+9
Users of the "o" format have an expectation that the object reference will be stolen. Any error causes the collection process to end early. This patch causes json_pack and related functions to continue scanning the format and parameters so all references can be stolen to prevent leaks. This makes no attempt to continue processing if the format string is broken or missing. 'make check' still passes. Ran test_pack under valgrind and verified that the leaked reference is fixed. Added a test which uses refcounts to verify that the reference was correctly stolen after a NULL value error. Issue #135
2017-10-03Use last byte of error text as numeric error codePhilipp Stephani4-54/+79
Fixes #352