2 * Copyright (c) 2009-2012 Petri Lehtinen <petri@digip.org>
4 * Jansson is free software; you can redistribute it and/or modify
5 * it under the terms of the MIT license. See LICENSE for details.
12 static void run_tests()
16 const char str[] = "[\"A\", {\"B\": \"C\"}, 1, 2, 3]garbage";
17 size_t len = strlen(str) - strlen("garbage");
19 json = json_loadb(str, len, 0, &error);
21 fail("json_loadb failed on a valid JSON buffer");
25 json = json_loadb(str, len - 1, 0, &error);
28 fail("json_loadb should have failed on an incomplete buffer, but it didn't");
31 fail("json_loadb returned an invalid line number on fail");
33 if(strcmp(error.text, "']' expected near end of file") != 0) {
34 fail("json_loadb returned an invalid error message for an unclosed top-level array");