tests: Port keyfile test to new style
Just noticed in passing.
This commit is contained in:
parent
25c5ae5d08
commit
0a808ffe20
|
|
@ -199,14 +199,15 @@ test_get_value_with_default_group_optional (void)
|
||||||
static void
|
static void
|
||||||
test_copy_group (void)
|
test_copy_group (void)
|
||||||
{
|
{
|
||||||
gsize length, length2, ii;
|
gsize length, length2;
|
||||||
GKeyFile *tmp = g_key_file_new ();
|
|
||||||
const char *section = "section";
|
const char *section = "section";
|
||||||
GLogLevelFlags always_fatal_mask;
|
GLogLevelFlags always_fatal_mask;
|
||||||
|
|
||||||
/* Avoid that g_return_val_if_fail causes the test to fail. */
|
/* Avoid that g_return_val_if_fail causes the test to fail. */
|
||||||
always_fatal_mask = g_log_set_always_fatal (0);
|
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 (NULL, tmp, section));
|
||||||
g_assert_false (ot_keyfile_copy_group (g_keyfile, NULL, section));
|
g_assert_false (ot_keyfile_copy_group (g_keyfile, NULL, section));
|
||||||
g_assert_false (ot_keyfile_copy_group (g_keyfile, tmp, NULL));
|
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_strfreev (g_key_file_get_keys (tmp, section, &length2, NULL));
|
||||||
g_assert_cmpint(length, ==, length2);
|
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 *value = g_key_file_get_value (g_keyfile, section, keys[ii], NULL);
|
||||||
g_autofree char *value2 = NULL;
|
g_autofree char *value2 = g_key_file_get_value (g_keyfile, section, keys[ii], 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_assert_cmpstr (value, ==, value2);
|
g_assert_cmpstr (value, ==, value2);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_key_file_free (tmp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue