summaryrefslogtreecommitdiff
path: root/test_json.c
diff options
context:
space:
mode:
authorChristian Gagneraud <chris@techworks.ie>2012-06-06 13:33:39 +0100
committerChristian Gagneraud <chris@techworks.ie>2012-06-20 10:05:41 +0100
commit6f34d11aae04a9a9d47c3a4f6af3d5a55774b53e (patch)
treeac75981344656674334d6f0a00252e75567305b0 /test_json.c
parenta307361e9942df5be76c1498007c296f6ea5b1fd (diff)
downloadgpsd-6f34d11aae04a9a9d47c3a4f6af3d5a55774b53e.tar.gz
json parser: fix empty array bug
Diffstat (limited to 'test_json.c')
-rw-r--r--test_json.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/test_json.c b/test_json.c
index 2c365e6e..85059f83 100644
--- a/test_json.c
+++ b/test_json.c
@@ -206,6 +206,11 @@ static const struct json_attr_t json_attrs_8[] = {
{"foe", t_integer, .addr.integer = &foe, .map=enum_table},
{NULL},
};
+
+/* Case 9: Like case 6 but w/ an empty array */
+
+static const char *json_str9 = "{\"parts\":[]}";
+
/*@ +fullinitblock @*/
/* *INDENT-ON* */
@@ -303,6 +308,10 @@ int main(int argc UNUSED, char *argv[]UNUSED)
assert_integer("fie", fie, 6);
assert_integer("foe", foe, 14);
+ status = json_read_object(json_str9, json_attrs_6, NULL);
+ assert_case(9, status);
+ assert_integer("dumbcount", dumbcount, 0);
+
(void)fprintf(stderr, "succeeded.\n");
exit(0);