[glib] gmain: test g_source_remove() with invalid ID



commit b9de6f04890eecb1dc9c3b70efbcde35008ba182
Author: Ryan Lortie <desrt desrt ca>
Date:   Wed Oct 23 11:04:01 2013 -0400

    gmain: test g_source_remove() with invalid ID
    
    Make sure we get the proper critical displayed.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=710724

 glib/tests/mainloop.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/glib/tests/mainloop.c b/glib/tests/mainloop.c
index 1c08ee1..2eaaa94 100644
--- a/glib/tests/mainloop.c
+++ b/glib/tests/mainloop.c
@@ -1026,6 +1026,14 @@ test_wakeup(void)
   g_main_context_unref (ctx);
 }
 
+static void
+test_remove_invalid (void)
+{
+  g_test_expect_message ("GLib", G_LOG_LEVEL_CRITICAL, "Source ID 3000000000 was not found*");
+  g_source_remove (3000000000u);
+  g_test_assert_expected_messages ();
+}
+
 #ifdef G_OS_UNIX
 
 #include <glib-unix.h>
@@ -1416,6 +1424,7 @@ main (int argc, char *argv[])
   g_test_add_func ("/mainloop/overflow", test_mainloop_overflow);
   g_test_add_func ("/mainloop/ready-time", test_ready_time);
   g_test_add_func ("/mainloop/wakeup", test_wakeup);
+  g_test_add_func ("/mainloop/remove-invalid", test_remove_invalid);
 #ifdef G_OS_UNIX
   g_test_add_func ("/mainloop/unix-fd", test_unix_fd);
   g_test_add_func ("/mainloop/unix-fd-source", test_unix_fd_source);


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