mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-10 11:26:16 +01:00
gio/tests/task: Ensure that g_task_had_error doesn't forget the error
https://bugzilla.gnome.org/show_bug.cgi?id=764163
This commit is contained in:
parent
a17e1e6d19
commit
0cd3d5741b
@ -78,6 +78,8 @@ basic_callback (GObject *object,
|
||||
*result_out = g_task_propagate_int (G_TASK (result), &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
g_assert (!g_task_had_error (G_TASK (result)));
|
||||
|
||||
g_main_loop_quit (loop);
|
||||
}
|
||||
|
||||
@ -143,6 +145,8 @@ error_callback (GObject *object,
|
||||
g_assert_error (error, G_IO_ERROR, G_IO_ERROR_FAILED);
|
||||
g_error_free (error);
|
||||
|
||||
g_assert (g_task_had_error (G_TASK (result)));
|
||||
|
||||
g_main_loop_quit (loop);
|
||||
}
|
||||
|
||||
@ -223,6 +227,8 @@ same_callback (GObject *object,
|
||||
*result_out = g_task_propagate_boolean (G_TASK (result), &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
g_assert (!g_task_had_error (G_TASK (result)));
|
||||
|
||||
g_main_loop_quit (loop);
|
||||
}
|
||||
|
||||
@ -284,6 +290,8 @@ toplevel_callback (GObject *object,
|
||||
*result_out = g_task_propagate_boolean (G_TASK (result), &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
g_assert (!g_task_had_error (G_TASK (result)));
|
||||
|
||||
g_main_loop_quit (loop);
|
||||
}
|
||||
|
||||
@ -340,6 +348,8 @@ anon_callback (GObject *object,
|
||||
*result_out = g_task_propagate_int (G_TASK (result), &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
g_assert (!g_task_had_error (G_TASK (result)));
|
||||
|
||||
g_main_loop_quit (loop);
|
||||
}
|
||||
|
||||
@ -413,6 +423,8 @@ wrong_callback (GObject *object,
|
||||
*result_out = g_task_propagate_int (G_TASK (result), &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
g_assert (!g_task_had_error (G_TASK (result)));
|
||||
|
||||
g_main_loop_quit (loop);
|
||||
}
|
||||
|
||||
@ -515,6 +527,8 @@ report_callback (GObject *object,
|
||||
g_assert_cmpint (ret, ==, -1);
|
||||
g_error_free (error);
|
||||
|
||||
g_assert (g_task_had_error (G_TASK (result)));
|
||||
|
||||
*weak_pointer = result;
|
||||
g_object_add_weak_pointer (G_OBJECT (result), weak_pointer);
|
||||
g_signal_connect (result, "notify::completed",
|
||||
@ -559,6 +573,8 @@ priority_callback (GObject *object,
|
||||
g_task_propagate_boolean (G_TASK (result), &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
g_assert (!g_task_had_error (G_TASK (result)));
|
||||
|
||||
*ret_out = ++counter;
|
||||
|
||||
if (counter == 3)
|
||||
@ -699,6 +715,8 @@ return_if_cancelled_callback (GObject *object,
|
||||
g_assert_error (error, G_IO_ERROR, G_IO_ERROR_CANCELLED);
|
||||
g_clear_error (&error);
|
||||
|
||||
g_assert (g_task_had_error (G_TASK (result)));
|
||||
|
||||
g_main_loop_quit (loop);
|
||||
}
|
||||
|
||||
@ -780,6 +798,8 @@ run_in_thread_callback (GObject *object,
|
||||
g_assert_no_error (error);
|
||||
g_assert_cmpint (ret, ==, magic);
|
||||
|
||||
g_assert (!g_task_had_error (G_TASK (result)));
|
||||
|
||||
*done = TRUE;
|
||||
g_main_loop_quit (loop);
|
||||
}
|
||||
@ -901,6 +921,8 @@ test_run_in_thread_sync (void)
|
||||
g_assert_no_error (error);
|
||||
g_assert_cmpint (ret, ==, magic);
|
||||
|
||||
g_assert (!g_task_had_error (task));
|
||||
|
||||
g_object_unref (task);
|
||||
}
|
||||
|
||||
@ -929,6 +951,8 @@ quit_main_loop_callback (GObject *object,
|
||||
g_assert_no_error (error);
|
||||
g_assert_cmpint (ret, ==, TRUE);
|
||||
|
||||
g_assert (!g_task_had_error (G_TASK (result)));
|
||||
|
||||
g_main_loop_quit (loop);
|
||||
}
|
||||
|
||||
@ -1221,6 +1245,8 @@ return_on_cancel_callback (GObject *object,
|
||||
g_clear_error (&error);
|
||||
g_assert_cmpint (ret, ==, -1);
|
||||
|
||||
g_assert (g_task_had_error (G_TASK (result)));
|
||||
|
||||
*callback_ran = TRUE;
|
||||
g_main_loop_quit (loop);
|
||||
}
|
||||
@ -1541,6 +1567,8 @@ return_on_cancel_atomic_callback (GObject *object,
|
||||
g_clear_error (&error);
|
||||
g_assert_cmpint (ret, ==, -1);
|
||||
|
||||
g_assert (g_task_had_error (G_TASK (result)));
|
||||
|
||||
*callback_ran = TRUE;
|
||||
g_main_loop_quit (loop);
|
||||
}
|
||||
@ -1805,6 +1833,8 @@ keepalive_callback (GObject *object,
|
||||
*result_out = g_task_propagate_int (G_TASK (result), &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
g_assert (!g_task_had_error (G_TASK (result)));
|
||||
|
||||
g_main_loop_quit (loop);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user