Eric Haszlakiewicz
deb9fa482d
Issue #240 : add arbitrary use of val's in foreach loops to squash warnings about unused variables.
2016-07-30 18:27:53 +00:00
Eric Haszlakiewicz
2b255d0ebf
Fix absolute paths in test_util_file that vary depending on where it is run.
2016-06-27 04:30:10 +00:00
Eric Haszlakiewicz
1071385896
Issue #113 : add "new" files to appropriate variables in Makefile, and note the need to run "make distcheck" as part of the release process.
...
Fix issues with the test script so it works under distcheck too.
2016-06-27 04:15:30 +00:00
Eric Haszlakiewicz
29ef73f21d
Issue #189 : Eliminate use of MC_ERROR from json_util.c, and add a json_util_get_last_err() function to retrieve the error for those callers that care about it.
...
Add tests and descriptions for the functions in json_util.c
2016-06-26 02:20:33 +00:00
Eric Haszlakiewicz
595891729e
Issue #236 : Add -Wcast-qual and fix casts to retain constness.
...
To better distinguish between entry->k and entry->v being const within linkhash, but non-const outside, add lh_entry_v() and lh_entry_k() accessors.
Make lh_entry->k const.
2016-06-11 18:19:39 +00:00
Matthias Schiffer
d13cfe10f6
tests/tests1: fix printf format for size_t arguments
...
Change %d to %llu and add cast to unsigned long long for size_t arguments,
otherwise compilation will fail with errors like:
test1.c:70:15: error: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘size_t {aka long unsigned int}’ [-Werror=format=]
%zu is avoided to stay compatible with old libc versions (like old Visual
Studio).
2016-06-07 10:49:42 +02:00
Matthias Schiffer
c2b004ba0e
Make default double serializer ignore userdata again
...
The user might want to use the userdata for something different, so the
serializer should ignore it by default.
Explicitly setting the serializer to json_object_double_to_json_string will
still make it interpret the userdata as a format string.
2016-05-29 11:24:55 +02:00
Eric Haszlakiewicz
996be85843
Fix a few places that needed adjustment for the size_t changes, including updating the range checks to use a calculated SIZE_T_MAX.
2016-05-23 02:10:58 +00:00
Eric Haszlakiewicz
3345b25962
Add tests for the json_object_array_del_idx() function.
2016-04-30 19:09:45 +00:00
Eric Haszlakiewicz
4e0c8b55fb
Merge pull request #220 from hschaa/master
...
Add utility function for comparing json_objects
2016-04-30 14:42:16 -04:00
chenha0
dffdee966f
Fix issue #221 : JSON_C_TO_STRING_NOSLASHESCAPE works incorrectly
...
Tests added.
2016-01-21 20:12:48 +08:00
Helmut Schaa
dec5fcd50b
Add some basic tests for verifying json_object_equal behavior
...
Do some basic checks on ints, doubles, strings, arrays and "complex" objects.
2016-01-13 15:56:39 +01:00
Eric Haszlakiewicz
316da85818
Fix issue #201 : add a JSON_C_TO_STRING_NOSLASHESCAPE flag to turn off escaping of forward slashes.
2015-11-28 20:00:30 -06:00
Eric Haszlakiewicz
80c1f69b9e
Use AX_APPEND_COMPILE_FLAGS() to check the various compile flags, such as -Wall, to ensure the compile supports.
2015-10-23 02:16:40 +00:00
Eric Haszlakiewicz
d4f8f92eb0
Squash deprecated function warning by replacing json_object_object_get calls with json_object_object_get_ex in test_cast.
2015-08-23 00:06:36 -04:00
Eric Haszlakiewicz
68d856f618
Merge pull request #168 from bugness-chl/master
...
Tightening the number parsing algorithm
2015-03-03 22:41:31 -05:00
chl
99d8fc975e
Tightening the number parsing algorithm
...
Some badly formated "numbers" could get partly parsed,
resulting in truncated results instead of raising an
error.
Examples :
'1.2.3' -> (double)1.2
'2015-01-15' -> (int)2015
This patch is not perfect (ex: input can still end with a 'E', which
is forbidden by json.org doc) but should avoid non-sensically
formated input.
Tests added.
2015-02-05 01:50:37 +01:00
Michael Vetter
fcf5ad1bd6
Remove trailing whitespace
2014-08-26 14:48:59 +02:00
Eric Haszlakiewicz
936d036ea3
Simplify the tests Makefile to avoid repeating the name of each test.
2014-03-22 21:40:37 -04:00
Eric Haszlakiewicz
e2bbb5664c
Rename the "test_case" test to "test_charcase" to make it slightly less confusing.
2014-03-22 21:15:41 -04:00
Eric Haszlakiewicz
05da316b9c
Issue #103 : allow Infinity and -Infinity to be parsed.
2014-03-22 17:28:40 -04:00
Eric Haszlakiewicz
0eedf3802f
Issue#102 - add support for parsing "NaN".
2014-03-09 16:41:33 -04:00
Andrea Faulds
cf23e7506e
Merge branch 'master' into LowercaseLiterals
2014-02-12 09:52:25 +00:00
Andrea Faulds
1d6f9140ba
Missing tests
2014-02-12 09:51:51 +00:00
Andrea Faulds
bda0540cb9
Only allow lowercase literals in STRICT mode
2013-11-14 21:13:32 +00:00
Eric Haszlakiewicz
51993c28c2
Added a json_object_new_double_s() convenience function to allow an exact string representation of a double to be specified when creating the object and use it in json_tokener_parse_ex() so a re-serialized object more exactly matches the input.
...
Add json_object_free_userdata() and json_object_userdata_to_json_string() too.
2013-09-11 20:27:39 -05:00
Eric Haszlakiewicz
e8161a11bb
Issue #15 : add a way to set a JSON_TOKENER_STRICT flag to forbid commas at the end of arrays and objects.
2013-03-31 20:05:36 -05:00
Eric Haszlakiewicz
94aeed2ecd
Include the test_locale test in the tests that run.
2013-02-26 21:14:07 -06:00
Eric Haszlakiewicz
5b36a432c8
Merge branch 'remicollet-issue-float'
...
Conflicts:
json_util.c
2013-02-26 21:09:10 -06:00
Eric Haszlakiewicz
9b64c05ff9
Mark the "val" variable in json_object_object_foreach as unused so the compiler doesn't complain. Fix warnings in the testReplaceExisting test.
2013-02-21 12:32:29 -06:00
Eric Haszlakiewicz
ca8b27d183
Enable -Werror and fix a number of minor warnings that existed.
2013-02-09 16:35:24 -06:00
Iskren Chernev
78b089bc1e
Fixed test_parse for \f
2013-01-28 19:06:49 -08:00
Eric Haszlakiewicz
2e9fef38c2
Revert the test_null test back to emitted to stdout, and update the expected output to match.
2012-12-23 10:25:03 -06:00
Alexander Klauer
57f36ed32a
Write additional test info to stderr instead of stdout so as not to mar the expected output
2012-12-19 10:52:50 +01:00
Alexander Klauer
827a4a97b9
Fixed memory leak in testReplaceExisting
2012-12-19 10:46:35 +01:00
Alexander Klauer
b1d61d10e1
Library is now called libjson-c
2012-12-18 18:46:24 +01:00
Remi Collet
32d149c8f6
probably worth an option for this
2012-12-13 11:46:04 +01:00
Remi Collet
a01b659ace
move locale change to be global for perf
2012-12-13 09:47:33 +01:00
Eric Haszlakiewicz
4e4af93d66
Fix issue #53 - ensure explicit length string are still NUL terminated, and fix json_tokener_parse() to work properly with embedded unicode \u0000 values in strings.
...
Adjust test_null to check for this case.
See also http://bugs.debian.org/687269
2012-12-09 16:32:11 -06:00
Eric Haszlakiewicz
aec876357c
Add a missing json_object_get() so we don't try to use a freed object in test1.
2012-11-29 15:06:17 -05:00
Eric Haszlakiewicz
447b88a115
Fix a memory leak in the test_printbuf test.
2012-11-29 13:29:55 -06:00
Eric Haszlakiewicz
f6b27cbb6c
Make it safe to delete keys while iterating with the json_object_object_foreach macro.
2012-10-20 20:26:37 -05:00
Eric Haszlakiewicz
c3d1d597ab
Fix a memory leak in test1 with respect to how json_object_object_del was used.
2012-09-16 20:49:22 -05:00
Eric Haszlakiewicz
c3068bfd09
Reformat the test sources. No functional change.
2012-09-16 20:43:29 -05:00
Eric Haszlakiewicz
4b1a0668a8
Update the set_serializer test to match the actual output.
2012-09-09 13:53:12 -05:00
Eric Haszlakiewicz
38f421a2e7
Add a json_set_serializer() function to allow the string output of a json_object to be customized.
2012-09-02 15:21:56 -05:00
Eric Haszlakiewicz
92f31bd99a
Handle the \f escape sequence (the two characters: backslash followed by an f, not a literal formfeed) and extend the test_parse test to check all valid escape sequences.
2012-07-29 12:31:07 -05:00
Eric Haszlakiewicz
77c6239465
Initialize errno before calling sscanf in json_parse_int64() so parsing valid numbers after parsing an out of range number works.
2012-07-29 12:13:54 -05:00
Eric Haszlakiewicz
6988f53fcb
Rewrite json_object_object_add to replace just the value if the key already exists so keys remain valid.
...
This is particularly useful when replacing values in a loop, since it allows
the key used by json_object_object_foreach to continue to be used.
2012-07-24 23:27:41 -05:00
Mateusz Loskot
984303dfe5
Added a bunch of missing HAVE_* defines tested with ./configure script to fix compilation on Linux with GCC 4.7.1. The issue likely caused by my previous commits related to Visual C++ port of the code.
2012-06-19 20:15:44 +01:00