summaryrefslogtreecommitdiff
path: root/json-glib/tests
diff options
context:
space:
mode:
authorEmmanuele Bassi <ebassi@openedhand.com>2008-03-05 15:46:41 +0000
committerEmmanuele Bassi <ebassi@openedhand.com>2008-03-05 15:46:41 +0000
commit7eab612d9b200aef197fa1dffa4f89b936c76b1f (patch)
tree89801ef448284c0eb7e9f77c20b5a7dc9b6ed454 /json-glib/tests
parent6aa1ddb891594e0f567bc3ebeb3bf5d3ab8e7e0c (diff)
downloadjson-glib-7eab612d9b200aef197fa1dffa4f89b936c76b1f.tar.gz
Add element removal unit to the Array test
Remove the json_array_remove_element() call from the add-element test unit and set up a separate test case for the element removal. This keeps the test cases clean.
Diffstat (limited to 'json-glib/tests')
-rw-r--r--json-glib/tests/array-test.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/json-glib/tests/array-test.c b/json-glib/tests/array-test.c
index 1d06780..f091ecd 100644
--- a/json-glib/tests/array-test.c
+++ b/json-glib/tests/array-test.c
@@ -30,6 +30,17 @@ test_add_element (void)
node = json_array_get_element (array, 0);
g_assert_cmpint (JSON_NODE_TYPE (node), ==, JSON_NODE_NULL);
+ json_array_unref (array);
+}
+
+static void
+test_remove_element (void)
+{
+ JsonArray *array = json_array_new ();
+ JsonNode *node = json_node_new (JSON_NODE_NULL);
+
+ json_array_add_element (array, node);
+
json_array_remove_element (array, 0);
g_assert_cmpint (json_array_get_length (array), ==, 0);
@@ -45,6 +56,7 @@ main (int argc,
g_test_add_func ("/array/empty-array", test_empty_array);
g_test_add_func ("/array/add-element", test_add_element);
+ g_test_add_func ("/array/remove-element", test_remove_element);
return g_test_run ();
}