Function Macro

GLibassert_error

Declaration

#define g_assert_error (
  err,
  dom,
  c
)

Description

Debugging macro to check that a method has returned the correct GError.

The effect of g_assert_error (err, dom, c) is the same as g_assert_true (err != NULL && err->domain == dom && err->code == c). The advantage of this macro is that it can produce a message that includes the incorrect error message and code.

This can only be used to test for a specific error. If you want to test that err is set, but don’t care what it’s set to, just use g_assert_nonnull (err).

Available since:2.20

Parameters

err none
 

A GError, possibly NULL.

dom none
 

The expected error domain (a GQuark)

c none
 

The expected error code.