summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorEric Haszlakiewicz <erh+git@nimenees.com>2016-07-30 18:27:53 +0000
committerEric Haszlakiewicz <erh+git@nimenees.com>2016-07-30 18:27:53 +0000
commitdeb9fa482d7bbe8544dc3cc866aec00a17aa8ff4 (patch)
treeacd91a3c9f3b1aea3c4b80e8919859b7658bf46e /tests
parentb366750e114579c472d29c37c1c153daa06dd0cb (diff)
downloadjson-c-deb9fa482d7bbe8544dc3cc866aec00a17aa8ff4.tar.gz
Issue #240: add arbitrary use of val's in foreach loops to squash warnings about unused variables.
Diffstat (limited to 'tests')
-rw-r--r--tests/testReplaceExisting.c6
-rw-r--r--tests/testReplaceExisting.expected20
2 files changed, 13 insertions, 13 deletions
diff --git a/tests/testReplaceExisting.c b/tests/testReplaceExisting.c
index 6db7b98..79f37c5 100644
--- a/tests/testReplaceExisting.c
+++ b/tests/testReplaceExisting.c
@@ -24,7 +24,7 @@ int main(int argc, char **argv)
int orig_count = 0;
json_object_object_foreach(my_object, key0, val0)
{
- printf("Key at index %d is [%s]", orig_count, key0);
+ printf("Key at index %d is [%s] %d", orig_count, key0, (val0 == NULL));
if (strcmp(key0, "deleteme") == 0)
{
json_object_object_del(my_object, key0);
@@ -41,7 +41,7 @@ int main(int argc, char **argv)
orig_count = 0;
json_object_object_foreach(my_object, key, val)
{
- printf("Key at index %d is [%s]\n", orig_count, key);
+ printf("Key at index %d is [%s] %d\n", orig_count, key, (val == NULL));
orig_count++;
if (strcmp(key, "foo2") != 0)
continue;
@@ -56,7 +56,7 @@ int main(int argc, char **argv)
int retval = 0;
json_object_object_foreach(my_object, key2, val2)
{
- printf("Key at index %d is [%s]\n", new_count, key2);
+ printf("Key at index %d is [%s] %d\n", new_count, key2, (val2 == NULL));
new_count++;
if (strcmp(key2, "foo2") != 0)
continue;
diff --git a/tests/testReplaceExisting.expected b/tests/testReplaceExisting.expected
index b1d4461..57ef190 100644
--- a/tests/testReplaceExisting.expected
+++ b/tests/testReplaceExisting.expected
@@ -1,15 +1,15 @@
==== delete-in-loop test starting ====
-Key at index 0 is [foo1] (kept)
-Key at index 1 is [foo2] (kept)
-Key at index 2 is [deleteme] (deleted)
-Key at index 3 is [foo3] (kept)
+Key at index 0 is [foo1] 0 (kept)
+Key at index 1 is [foo2] 0 (kept)
+Key at index 2 is [deleteme] 0 (deleted)
+Key at index 3 is [foo3] 0 (kept)
==== replace-value first loop starting ====
-Key at index 0 is [foo1]
-Key at index 1 is [foo2]
+Key at index 0 is [foo1] 0
+Key at index 1 is [foo2] 0
replacing value for key [foo2]
-Key at index 2 is [foo3]
+Key at index 2 is [foo3] 0
==== second loop starting ====
-Key at index 0 is [foo1]
-Key at index 1 is [foo2]
+Key at index 0 is [foo1] 0
+Key at index 1 is [foo2] 0
pointer for key [foo2] does match
-Key at index 2 is [foo3]
+Key at index 2 is [foo3] 0