mirror of
				https://gitlab.gnome.org/GNOME/glib.git
				synced 2025-11-04 10:08:56 +01:00 
			
		
		
		
	Misc test coverage improvements
https://bugzilla.gnome.org/show_bug.cgi?id=660849
This commit is contained in:
		@@ -396,6 +396,8 @@ pointer_array_free_func (void)
 | 
				
			|||||||
  s = g_strdup ("frob");
 | 
					  s = g_strdup ("frob");
 | 
				
			||||||
  g_ptr_array_add (gparray, s);
 | 
					  g_ptr_array_add (gparray, s);
 | 
				
			||||||
  g_assert (g_ptr_array_remove (gparray, s));
 | 
					  g_assert (g_ptr_array_remove (gparray, s));
 | 
				
			||||||
 | 
					  g_assert (!g_ptr_array_remove (gparray, "nuun"));
 | 
				
			||||||
 | 
					  g_assert (!g_ptr_array_remove_fast (gparray, "mlo"));
 | 
				
			||||||
  g_assert_cmpint (num_free_func_invocations, ==, 2);
 | 
					  g_assert_cmpint (num_free_func_invocations, ==, 2);
 | 
				
			||||||
  g_ptr_array_set_size (gparray, 1);
 | 
					  g_ptr_array_set_size (gparray, 1);
 | 
				
			||||||
  g_assert_cmpint (num_free_func_invocations, ==, 3);
 | 
					  g_assert_cmpint (num_free_func_invocations, ==, 3);
 | 
				
			||||||
@@ -406,10 +408,11 @@ pointer_array_free_func (void)
 | 
				
			|||||||
  g_assert_cmpint (num_free_func_invocations, ==, 4);
 | 
					  g_assert_cmpint (num_free_func_invocations, ==, 4);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  num_free_func_invocations = 0;
 | 
					  num_free_func_invocations = 0;
 | 
				
			||||||
  gparray = g_ptr_array_new_with_free_func (my_free_func);
 | 
					  gparray = g_ptr_array_new_full (10, my_free_func);
 | 
				
			||||||
  g_ptr_array_add (gparray, g_strdup ("foo"));
 | 
					  g_ptr_array_add (gparray, g_strdup ("foo"));
 | 
				
			||||||
  g_ptr_array_add (gparray, g_strdup ("bar"));
 | 
					  g_ptr_array_add (gparray, g_strdup ("bar"));
 | 
				
			||||||
  g_ptr_array_add (gparray, g_strdup ("baz"));
 | 
					  g_ptr_array_add (gparray, g_strdup ("baz"));
 | 
				
			||||||
 | 
					  g_ptr_array_set_size (gparray, 20);
 | 
				
			||||||
  g_ptr_array_add (gparray, NULL);
 | 
					  g_ptr_array_add (gparray, NULL);
 | 
				
			||||||
  gparray2 = g_ptr_array_ref (gparray);
 | 
					  gparray2 = g_ptr_array_ref (gparray);
 | 
				
			||||||
  strv = (gchar **) g_ptr_array_free (gparray, FALSE);
 | 
					  strv = (gchar **) g_ptr_array_free (gparray, FALSE);
 | 
				
			||||||
@@ -423,6 +426,7 @@ pointer_array_free_func (void)
 | 
				
			|||||||
  g_ptr_array_add (gparray, g_strdup ("foo"));
 | 
					  g_ptr_array_add (gparray, g_strdup ("foo"));
 | 
				
			||||||
  g_ptr_array_add (gparray, g_strdup ("bar"));
 | 
					  g_ptr_array_add (gparray, g_strdup ("bar"));
 | 
				
			||||||
  g_ptr_array_add (gparray, g_strdup ("baz"));
 | 
					  g_ptr_array_add (gparray, g_strdup ("baz"));
 | 
				
			||||||
 | 
					  g_ptr_array_remove_range (gparray, 1, 1);
 | 
				
			||||||
  g_ptr_array_unref (gparray);
 | 
					  g_ptr_array_unref (gparray);
 | 
				
			||||||
  g_assert_cmpint (num_free_func_invocations, ==, 3);
 | 
					  g_assert_cmpint (num_free_func_invocations, ==, 3);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -478,6 +478,9 @@ test_mkdir_with_parents (void)
 | 
				
			|||||||
    g_print ("checking g_mkdir_with_parents() in cwd: %s", cwd);
 | 
					    g_print ("checking g_mkdir_with_parents() in cwd: %s", cwd);
 | 
				
			||||||
  test_mkdir_with_parents_1 (cwd);
 | 
					  test_mkdir_with_parents_1 (cwd);
 | 
				
			||||||
  g_free (cwd);
 | 
					  g_free (cwd);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  g_assert (g_mkdir_with_parents (NULL, 0) == -1);
 | 
				
			||||||
 | 
					  g_assert (errno == EINVAL);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void
 | 
					static void
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -276,6 +276,8 @@ test_strconcat (void)
 | 
				
			|||||||
  g_assert (str != NULL);
 | 
					  g_assert (str != NULL);
 | 
				
			||||||
  g_assert_cmpstr (str, ==, GLIB_TEST_STRING GLIB_TEST_STRING GLIB_TEST_STRING);
 | 
					  g_assert_cmpstr (str, ==, GLIB_TEST_STRING GLIB_TEST_STRING GLIB_TEST_STRING);
 | 
				
			||||||
  g_free (str);
 | 
					  g_free (str);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  g_assert (g_strconcat (NULL, "bla", NULL) == NULL);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void
 | 
					static void
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user