mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-12 07:26:15 +01:00
Don't g_test_assert_expected_messages for g_error
Don't allow the user to assert for expected g_error(). They need to use subprocess for this. https://bugzilla.gnome.org/show_bug.cgi?id=709615
This commit is contained in:
parent
6957004007
commit
8dfb070329
@ -1159,6 +1159,7 @@ g_test_expect_message (const gchar *log_domain,
|
||||
|
||||
g_return_if_fail (log_level != 0);
|
||||
g_return_if_fail (pattern != NULL);
|
||||
g_return_if_fail (~log_level & G_LOG_LEVEL_ERROR);
|
||||
|
||||
expected = g_new (GTestExpectedMessage, 1);
|
||||
expected->log_domain = g_strdup (log_domain);
|
||||
|
@ -380,6 +380,15 @@ test_expected_messages_null_domain (void)
|
||||
g_test_assert_expected_messages ();
|
||||
}
|
||||
|
||||
static void
|
||||
test_expected_messages_expect_error (void)
|
||||
{
|
||||
/* make sure we can't try to expect a g_error() */
|
||||
g_test_expect_message (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, "*G_LOG_LEVEL_ERROR*");
|
||||
g_test_expect_message (G_LOG_DOMAIN, G_LOG_LEVEL_ERROR, "this won't work");
|
||||
g_test_assert_expected_messages ();
|
||||
}
|
||||
|
||||
static void
|
||||
test_expected_messages_extra_warning (void)
|
||||
{
|
||||
@ -590,6 +599,7 @@ main (int argc,
|
||||
g_test_add_func ("/misc/expected-messages/subprocess/null-domain", test_expected_messages_null_domain);
|
||||
g_test_add_func ("/misc/expected-messages/subprocess/extra-warning", test_expected_messages_extra_warning);
|
||||
g_test_add_func ("/misc/expected-messages/subprocess/unexpected-extra-warning", test_expected_messages_unexpected_extra_warning);
|
||||
g_test_add_func ("/misc/expected-messages/expect-error", test_expected_messages_expect_error);
|
||||
|
||||
g_test_add_func ("/misc/dash-p", test_dash_p);
|
||||
g_test_add_func ("/misc/dash-p/child", test_dash_p_child);
|
||||
|
Loading…
Reference in New Issue
Block a user