[glib: 5/6] tests: Add additional keyfile assertions




commit e9c4e199500f73348c027f98cd83200eeb9eb00f
Author: Philip Withnall <pwithnall endlessos org>
Date:   Wed Oct 14 13:13:07 2020 +0100

    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>

 glib/tests/keyfile.c | 3 +++
 1 file changed, 3 insertions(+)
---
diff --git a/glib/tests/keyfile.c b/glib/tests/keyfile.c
index ccbdadd56..7530bc8c3 100644
--- a/glib/tests/keyfile.c
+++ b/glib/tests/keyfile.c
@@ -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 ();


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]