tests: consider macOS behaviour in g_getenv tests

This change adds the macOS behaviour to assertions when testing g_getenv
with `=` in key names.

environment tests for Darwin were also re-enabled
This commit is contained in:
André Barnabá Silva
2025-11-05 21:30:18 -03:00
parent c44555d2a4
commit 6ea3ce88c3
2 changed files with 7 additions and 6 deletions

View File

@@ -127,10 +127,14 @@ test_getenv (void)
g_assert_true (g_setenv ("foo", "bar=baz", TRUE));
/* Different OSs return different values; some return NULL because the key
* is invalid, but some are happy to return what we set above. */
* is invalid, but some are happy to return what we set above. macOS clips
* the key when it contains `=` */
data = g_getenv ("foo=bar");
if (data != NULL)
g_assert_cmpstr (data, ==, "baz");
{
g_assert_true (g_strcmp0 (data, "bar=baz") == 0 ||
g_strcmp0 (data, "baz") == 0);
}
else
{
data = g_getenv ("foo");

View File

@@ -33,10 +33,7 @@ glib_tests = {
'can_fail' : host_system == 'darwin' or linux_libc == 'musl',
},
'dir' : {},
'environment' : {
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1392
'can_fail' : host_system == 'darwin',
},
'environment' : {},
'error' : {},
'fileutils' : {},
'gdatetime' : {