mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-24 14:36:13 +01:00
tests: Tweak the task tests
Tweak the g_task_set_name test to use a non-literal string, so we don't test g_task_set_static_name twice.
This commit is contained in:
parent
525e3953ef
commit
13e48ff963
@ -625,18 +625,40 @@ static void
|
||||
test_name (void)
|
||||
{
|
||||
GTask *t1 = NULL;
|
||||
char *orig = g_strdup ("some task");
|
||||
gchar *name1 = NULL;
|
||||
|
||||
t1 = g_task_new (NULL, NULL, name_callback, &name1);
|
||||
g_task_set_name (t1, "some task");
|
||||
(g_task_set_name) (t1, orig);
|
||||
g_task_return_boolean (t1, TRUE);
|
||||
g_object_unref (t1);
|
||||
|
||||
g_main_loop_run (loop);
|
||||
|
||||
g_assert_cmpstr (name1, ==, "some task");
|
||||
g_assert_cmpstr (name1, ==, orig);
|
||||
|
||||
g_free (name1);
|
||||
g_free (orig);
|
||||
}
|
||||
|
||||
static void
|
||||
test_name_macro_wrapper (void)
|
||||
{
|
||||
GTask *t1 = NULL;
|
||||
char *orig = g_strdup ("some task");
|
||||
gchar *name1 = NULL;
|
||||
|
||||
t1 = g_task_new (NULL, NULL, name_callback, &name1);
|
||||
g_task_set_name (t1, orig);
|
||||
g_task_return_boolean (t1, TRUE);
|
||||
g_object_unref (t1);
|
||||
|
||||
g_main_loop_run (loop);
|
||||
|
||||
g_assert_cmpstr (name1, ==, orig);
|
||||
|
||||
g_free (name1);
|
||||
g_free (orig);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -664,8 +686,8 @@ static void
|
||||
test_static_name (void)
|
||||
{
|
||||
GTask *t1 = NULL;
|
||||
char *name1 = NULL;
|
||||
char *orig = "some task";
|
||||
char *name1 = NULL;
|
||||
|
||||
t1 = g_task_new (NULL, NULL, static_name_callback, &name1);
|
||||
g_task_set_static_name (t1, orig);
|
||||
@ -2450,6 +2472,7 @@ main (int argc, char **argv)
|
||||
g_test_add_func ("/gtask/report-error", test_report_error);
|
||||
g_test_add_func ("/gtask/priority", test_priority);
|
||||
g_test_add_func ("/gtask/name", test_name);
|
||||
g_test_add_func ("/gtask/name/macro-wrapper", test_name_macro_wrapper);
|
||||
g_test_add_func ("/gtask/static-name", test_static_name);
|
||||
g_test_add_func ("/gtask/asynchronous-cancellation", test_asynchronous_cancellation);
|
||||
g_test_add_func ("/gtask/check-cancellable", test_check_cancellable);
|
||||
|
Loading…
Reference in New Issue
Block a user