diff options
author | Petri Lehtinen <petri@digip.org> | 2018-02-09 09:40:42 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-09 09:40:42 +0200 |
commit | 46dff2737d52cfbb2927ffa65fdc263e6d3e6b39 (patch) | |
tree | 0f7de1378df2b0baae7002b54675d1f04c072ef5 /test/suites/api | |
parent | fa0b5ece9e3af5f20a8b72c5b62ce53c98ccfc71 (diff) | |
parent | 45228cada4c379fc1a290b1a0866f51e24396b47 (diff) | |
download | jansson-46dff2737d52cfbb2927ffa65fdc263e6d3e6b39.zip jansson-46dff2737d52cfbb2927ffa65fdc263e6d3e6b39.tar.gz jansson-46dff2737d52cfbb2927ffa65fdc263e6d3e6b39.tar.bz2 |
Merge pull request #381 from phst/end-of-file-error-code
Use a more specific error code for premature end of input
Diffstat (limited to 'test/suites/api')
-rw-r--r-- | test/suites/api/test_load.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/test/suites/api/test_load.c b/test/suites/api/test_load.c index a708de5..a3bdc57 100644 --- a/test/suites/api/test_load.c +++ b/test/suites/api/test_load.c @@ -221,6 +221,14 @@ static void error_code() fail("error.text longer than expected"); if(json_error_code(&error) != json_error_end_of_input_expected) fail("json_loads returned incorrect error code"); + + json = json_loads("{\"foo\": ", 0, &error); + if(json != NULL) + fail("json_loads returned not NULL"); + if(strlen(error.text) >= JSON_ERROR_TEXT_LENGTH) + fail("error.text longer than expected"); + if(json_error_code(&error) != json_error_premature_end_of_input) + fail("json_loads returned incorrect error code"); } static void run_tests() |