Merge branch 'xclaesse/glib-meson-cross-doc'
Closes #1363
See merge request GNOME/glib!232
diff --git a/gio/gdbusmessage.c b/gio/gdbusmessage.c
index 6812238..8de836b 100644
--- a/gio/gdbusmessage.c
+++ b/gio/gdbusmessage.c
@@ -1994,7 +1994,7 @@
/**
* g_dbus_message_new_from_blob:
- * @blob: (array length=blob_len) (element-type guint8): A blob represent a binary D-Bus message.
+ * @blob: (array length=blob_len) (element-type guint8): A blob representing a binary D-Bus message.
* @blob_len: The length of @blob.
* @capabilities: A #GDBusCapabilityFlags describing what protocol features are supported.
* @error: Return location for error or %NULL.
diff --git a/glib/gtestutils.c b/glib/gtestutils.c
index 5290572..7b29c27 100644
--- a/glib/gtestutils.c
+++ b/glib/gtestutils.c
@@ -1284,6 +1284,12 @@
*
* - `--debug-log`: Debug test logging output.
*
+ * Since 2.58, if tests are compiled with `G_DISABLE_ASSERT` defined,
+ * g_test_init() will print an error and exit. This is to prevent no-op tests
+ * from being executed, as g_assert() is commonly (erroneously) used in unit
+ * tests, and is a no-op when compiled with `G_DISABLE_ASSERT`. Ensure your
+ * tests are compiled without `G_DISABLE_ASSERT` defined.
+ *
* Since: 2.16
*/
void
diff --git a/glib/tests/timer.c b/glib/tests/timer.c
index f40a278..c0b9ba8 100644
--- a/glib/tests/timer.c
+++ b/glib/tests/timer.c
@@ -115,6 +115,14 @@
g_time_val_add (&time, 1000);
g_assert_cmpint (time.tv_sec, ==, 1);
g_assert_cmpint (time.tv_usec, ==, 510);
+
+ g_time_val_add (&time, 0);
+ g_assert_cmpint (time.tv_sec, ==, 1);
+ g_assert_cmpint (time.tv_usec, ==, 510);
+
+ g_time_val_add (&time, -210);
+ g_assert_cmpint (time.tv_sec, ==, 1);
+ g_assert_cmpint (time.tv_usec, ==, 300);
}
typedef struct {
@@ -230,6 +238,22 @@
}
}
+/* Test error handling for g_time_val_to_iso8601() on dates which are too large. */
+static void
+test_timeval_to_iso8601_overflow (void)
+{
+ GTimeVal val;
+ gchar *out = NULL;
+
+ g_unsetenv ("TZ");
+
+ val.tv_sec = G_MAXLONG;
+ val.tv_usec = G_USEC_PER_SEC - 1;
+
+ out = g_time_val_to_iso8601 (&val);
+ g_assert_null (out);
+}
+
int
main (int argc, char *argv[])
{
@@ -242,6 +266,7 @@
g_test_add_func ("/timeval/add", test_timeval_add);
g_test_add_func ("/timeval/from-iso8601", test_timeval_from_iso8601);
g_test_add_func ("/timeval/to-iso8601", test_timeval_to_iso8601);
+ g_test_add_func ("/timeval/to-iso8601/overflow", test_timeval_to_iso8601_overflow);
return g_test_run ();
}