diff options
author | Arun Raghavan <arun@arunraghavan.net> | 2016-06-01 17:18:37 +0530 |
---|---|---|
committer | Arun Raghavan <arun@arunraghavan.net> | 2016-06-22 21:04:47 +0530 |
commit | 1879beab87db51ab29116eb5ffb2b0201f0ecfda (patch) | |
tree | 8807af00f76a4060f0c309bbe3077e44a26a1026 /src | |
parent | 0c1dbf5c799272892da6f6a6f268b2207945f1f9 (diff) |
json: Add a positive test for nested objects
Signed-off-by: Arun Raghavan <arun@arunraghavan.net>
Diffstat (limited to 'src')
-rw-r--r-- | src/tests/json-test.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/tests/json-test.c b/src/tests/json-test.c index 3f8ed92d5..4edfa0940 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 |