tests: Add additional keyfile assertions

These slightly improve the tests but, more importantly, squash a
scan-build warning about assigning to a variable which is never
subsequently used:
```
../../../glib/tests/keyfile.c:1150:3: warning: Value stored to 'value' is never read
  value = g_key_file_get_string (keyfile, "a", "key=", &error);
  ^       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../../glib/tests/keyfile.c:1159:3: warning: Value stored to 'value' is never read
  value = g_key_file_get_string (keyfile, "a", "key[", &error);
  ^       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../../glib/tests/keyfile.c:1176:3: warning: Value stored to 'value' is never read
  value = g_key_file_get_string (keyfile, "a", " key", &error);
  ^       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3 warnings generated.
```

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
This commit is contained in:
Philip Withnall 2020-10-14 13:13:07 +01:00
parent 0544efcbb4
commit e9c4e19950

View File

@ -1151,6 +1151,7 @@ test_key_names (void)
check_error (&error,
G_KEY_FILE_ERROR,
G_KEY_FILE_ERROR_KEY_NOT_FOUND);
g_assert_null (value);
g_key_file_free (keyfile);
keyfile = g_key_file_new ();
@ -1160,6 +1161,7 @@ test_key_names (void)
check_error (&error,
G_KEY_FILE_ERROR,
G_KEY_FILE_ERROR_KEY_NOT_FOUND);
g_assert_null (value);
g_key_file_free (keyfile);
keyfile = g_key_file_new ();
@ -1177,6 +1179,7 @@ test_key_names (void)
check_error (&error,
G_KEY_FILE_ERROR,
G_KEY_FILE_ERROR_KEY_NOT_FOUND);
g_assert_null (value);
g_key_file_free (keyfile);
keyfile = g_key_file_new ();