[pulseaudio-discuss] [PATCH v2 7/9] json: Add a positive test for nested objects
Arun Raghavan
arun at arunraghavan.net
Wed Jun 1 11:48:37 UTC 2016
Signed-off-by: Arun Raghavan <arun at arunraghavan.net>
---
src/tests/json-test.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/src/tests/json-test.c b/src/tests/json-test.c
index 3f8ed92..4edfa09 100644
--- a/src/tests/json-test.c
+++ b/src/tests/json-test.c
@@ -162,6 +162,19 @@ START_TEST(object_test) {
fail_unless(pa_json_object_get_bool(v) == true);
pa_json_object_unref(o);
+
+ o = pa_json_parse("{ \"parent\": { \"child\": false } }");
+ fail_unless(o != NULL);
+ fail_unless(pa_json_object_get_type(o) == PA_JSON_TYPE_OBJECT);
+
+ v = pa_json_object_get_object_member(o, "parent");
+ fail_unless(v != NULL);
+ fail_unless(pa_json_object_get_type(v) == PA_JSON_TYPE_OBJECT);
+ v = pa_json_object_get_object_member(v, "child");
+ fail_unless(pa_json_object_get_type(v) == PA_JSON_TYPE_BOOL);
+ fail_unless(pa_json_object_get_bool(v) == false);
+
+ pa_json_object_unref(o);
}
END_TEST
--
2.5.5
More information about the pulseaudio-discuss
mailing list