mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-04-25 16:46:52 +02:00
dataset: Rename i
as destroy_index
and move it out of destroy_func()
, so that it can be checked to confirm that destroy_func()
was called three times.
This commit is contained in:
parent
42826576a8
commit
a437a97ffd
@ -294,13 +294,13 @@ test_datalist_id_remove_multiple (void)
|
|||||||
g_assert_cmpint (count, ==, 0);
|
g_assert_cmpint (count, ==, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int destroy_index;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
destroy_func (gpointer data)
|
destroy_func (gpointer data)
|
||||||
{
|
{
|
||||||
static int i = 0;
|
destroy_index++;
|
||||||
|
g_assert_cmpint (GPOINTER_TO_INT (data), ==, destroy_index);
|
||||||
i++;
|
|
||||||
g_assert_cmpint (GPOINTER_TO_INT (data), ==, i);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -326,7 +326,10 @@ test_datalist_id_remove_multiple_destroy_order (void)
|
|||||||
g_datalist_id_set_data_full (&list, three, GINT_TO_POINTER (3), destroy_func);
|
g_datalist_id_set_data_full (&list, three, GINT_TO_POINTER (3), destroy_func);
|
||||||
g_datalist_id_set_data_full (&list, one, GINT_TO_POINTER (1), destroy_func);
|
g_datalist_id_set_data_full (&list, one, GINT_TO_POINTER (1), destroy_func);
|
||||||
|
|
||||||
|
destroy_index = 0;
|
||||||
g_datalist_id_remove_multiple (&list, keys, G_N_ELEMENTS (keys));
|
g_datalist_id_remove_multiple (&list, keys, G_N_ELEMENTS (keys));
|
||||||
|
/* This verifies that destroy_func() was called three times: */
|
||||||
|
g_assert_cmpint (destroy_index, ==, 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
Loading…
x
Reference in New Issue
Block a user