tests: Fix environment test on FreeBSD

Fix for commit 20c8ea1bc651bc4b79d39b80d42b468f6e7a2dc8; while Linux
seems happy to return the value for the invalid key we set above, BSD
returns NULL (which is probably a more valid thing to do).

Accept both.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
This commit is contained in:
Philip Withnall 2021-12-23 13:04:49 +00:00
parent eaa52ddfc5
commit 4bb9e20fff

View File

@ -103,8 +103,11 @@ 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. */
data = g_getenv ("foo=bar");
g_assert_cmpstr (data, ==, "baz");
if (data != NULL)
g_assert_cmpstr (data, ==, "baz");
data = g_getenv ("foo");
g_assert_cmpstr (data, ==, "bar=baz");