aboutsummaryrefslogtreecommitdiff
path: root/test/suites
diff options
context:
space:
mode:
authorPhilipp Stephani <phst@google.com>2017-12-20 18:27:04 +0100
committerPhilipp Stephani <phst@google.com>2017-12-20 18:27:04 +0100
commit45228cada4c379fc1a290b1a0866f51e24396b47 (patch)
tree412bc473764978723841a320bdb4db2b59688e74 /test/suites
parent9e5af7c3b77f81a7d1720073dca600e51fe9962d (diff)
downloadjansson-45228cada4c379fc1a290b1a0866f51e24396b47.zip
jansson-45228cada4c379fc1a290b1a0866f51e24396b47.tar.gz
jansson-45228cada4c379fc1a290b1a0866f51e24396b47.tar.bz2
Use a more specific error code for premature end of input
Diffstat (limited to 'test/suites')
-rw-r--r--test/suites/api/test_load.c8
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()