#ifndef __G_TEST_UTILS_H__
#define __G_TEST_UTILS_H__
-#include <glib.h>
+#include <glib/gmessages.h>
+#include <glib/gstring.h>
+#include <glib/gtypes.h>
+#include <glib/gerror.h>
+#include <glib/gslist.h>
G_BEGIN_DECLS
if (__n1 cmp __n2) ; else \
g_assertion_message_cmpnum (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \
#n1 " " #cmp " " #n2, __n1, #cmp, __n2, 'f'); } while (0)
+#define g_assert_no_error(err) do { if (err) \
+ g_assertion_message_error (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \
+ #err, err, 0, 0); } while (0)
+#define g_assert_error(err, dom, c) do { if (!err || (err)->domain != dom || (err)->code != c) \
+ g_assertion_message_error (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \
+ #err, err, dom, c); } while (0)
#ifdef G_DISABLE_ASSERT
#define g_assert_not_reached() do { (void) 0; } while (0)
#define g_assert(expr) do { (void) 0; } while (0)
const char *cmp,
long double arg2,
char numtype) G_GNUC_NORETURN;
+void g_assertion_message_error (const char *domain,
+ const char *file,
+ int line,
+ const char *func,
+ const char *expr,
+ GError *error,
+ GQuark error_domain,
+ int error_code) G_GNUC_NORETURN;
void g_test_add_vtable (const char *testpath,
gsize data_size,
gconstpointer test_data,
GTestLogMsg* g_test_log_buffer_pop (GTestLogBuffer *tbuffer);
void g_test_log_msg_free (GTestLogMsg *tmsg);
+/**
+ * GTestLogFatalFunc:
+ * @log_domain: the log domain of the message
+ * @log_level: the log level of the message (including the fatal and recursion flags)
+ * @message: the message to process
+ * @user_data: user data, set in g_test_log_set_fatal_handler()
+ *
+ * Specifies the prototype of fatal log handler functions.
+ *
+ * Return value: %TRUE if the program should abort, %FALSE otherwise
+ *
+ * Since: 2.22
+ */
+typedef gboolean (*GTestLogFatalFunc) (const gchar *log_domain,
+ GLogLevelFlags log_level,
+ const gchar *message,
+ gpointer user_data);
+void
+g_test_log_set_fatal_handler (GTestLogFatalFunc log_func,
+ gpointer user_data);
+
G_END_DECLS
#endif /* __G_TEST_UTILS_H__ */