summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2019-10-18 14:48:44 +0000
committerColin Walters <walters@verbum.org>2019-10-18 15:07:39 +0000
commit0a808ffe20ebae0550399101b42af0bcc5bf7380 (patch)
tree6d7b547563b390779f2d888f1a944dda6c07750e
parent25c5ae5d08727c4eb689ef7bd4b2a5096662fea2 (diff)
downloadostree-0a808ffe20ebae0550399101b42af0bcc5bf7380.tar.gz
tests: Port keyfile test to new style
Just noticed in passing.
-rw-r--r--tests/test-keyfile-utils.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/tests/test-keyfile-utils.c b/tests/test-keyfile-utils.c
index 3e4f8257..c580f81c 100644
--- a/tests/test-keyfile-utils.c
+++ b/tests/test-keyfile-utils.c
@@ -199,14 +199,15 @@ test_get_value_with_default_group_optional (void)
static void
test_copy_group (void)
{
- gsize length, length2, ii;
- GKeyFile *tmp = g_key_file_new ();
+ gsize length, length2;
const char *section = "section";
GLogLevelFlags always_fatal_mask;
/* Avoid that g_return_val_if_fail causes the test to fail. */
always_fatal_mask = g_log_set_always_fatal (0);
+ g_autoptr(GKeyFile) tmp = g_key_file_new ();
+
g_assert_false (ot_keyfile_copy_group (NULL, tmp, section));
g_assert_false (ot_keyfile_copy_group (g_keyfile, NULL, section));
g_assert_false (ot_keyfile_copy_group (g_keyfile, tmp, NULL));
@@ -220,17 +221,13 @@ test_copy_group (void)
g_strfreev (g_key_file_get_keys (tmp, section, &length2, NULL));
g_assert_cmpint(length, ==, length2);
- for (ii = 0; ii < length; ii++)
+ for (gsize ii = 0; ii < length; ii++)
{
- g_autofree char *value = NULL;
- g_autofree char *value2 = NULL;
-
- value = g_key_file_get_value (g_keyfile, section, keys[ii], NULL);
- value2 = g_key_file_get_value (g_keyfile, section, keys[ii], NULL);
+ g_autofree char *value = g_key_file_get_value (g_keyfile, section, keys[ii], NULL);
+ g_autofree char *value2 = g_key_file_get_value (g_keyfile, section, keys[ii], NULL);
g_assert_cmpstr (value, ==, value2);
}
- g_key_file_free (tmp);
}
static void