diff options
author | Jason Choy <jjwchoy@gmail.com> | 2013-06-09 15:34:30 +0100 |
---|---|---|
committer | Jason Choy <jjwchoy@gmail.com> | 2013-06-09 15:34:30 +0100 |
commit | e6bd0aba9ddd086ac76d239c6854cc845a89cddd (patch) | |
tree | 86df9b2b515bd3ed1be5da6f48eaf3f70b317480 | |
parent | 9e7f11a8478d0cf61945ba00db03048d47730ba4 (diff) | |
download | jansson-e6bd0aba9ddd086ac76d239c6854cc845a89cddd.zip jansson-e6bd0aba9ddd086ac76d239c6854cc845a89cddd.tar.gz jansson-e6bd0aba9ddd086ac76d239c6854cc845a89cddd.tar.bz2 |
Added a simple test for the JSON_DECODE_NO_INT option
-rw-r--r-- | test/suites/api/test_load.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/suites/api/test_load.c b/test/suites/api/test_load.c index 30ba65c..328462f 100644 --- a/test/suites/api/test_load.c +++ b/test/suites/api/test_load.c @@ -87,6 +87,17 @@ static void decode_any() json_decref(json); } +static void decode_no_int() +{ + json_t *json; + json_error_t error; + + json = json_loads("42", JSON_DECODE_NO_INT | JSON_DECODE_ANY, &error); + if (!json || !json_is_real(json) || json_real_value(json) != 42.0) + fail("json_load decode no int failed - int"); + json_decref(json); +} + static void load_wrong_args() { json_t *json; @@ -132,6 +143,7 @@ static void run_tests() reject_duplicates(); disable_eof_check(); decode_any(); + decode_no_int(); load_wrong_args(); position(); } |