summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorIan Osgood <iano@quirkster.com>2006-11-26 09:26:32 -0800
committerIan Osgood <iano@quirkster.com>2006-11-26 09:27:37 -0800
commit19dfaf93ac1b5e9d3ce09b1f8e2338e53a5d7324 (patch)
tree9a21215576caf33d80aed30a2ce6116a2b80caf8 /tests
parent98e2a5617ef1c9955b3b5553224c34f55c7c5d29 (diff)
Fix unit tests for FreeBSD
putenv() string must contain '=' environment failure test is invalid if argument is NULL
Diffstat (limited to 'tests')
-rw-r--r--tests/check_public.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/tests/check_public.c b/tests/check_public.c
index e222221..2094bfe 100644
--- a/tests/check_public.c
+++ b/tests/check_public.c
@@ -25,7 +25,7 @@ static void parse_display_pass(const char *name, const char *host, const int dis
if(test_type == TEST_ARGUMENT)
{
argument = name;
- putenv("DISPLAY");
+ putenv("DISPLAY=");
}
else if(test_type == TEST_ENVIRONMENT)
{
@@ -50,7 +50,7 @@ static void parse_display_pass(const char *name, const char *host, const int dis
fail_unless(strcmp(host, got_host) == 0, "screenless parse %sproduced unexpected hostname '%s' for '%s': expected '%s'", test_string[test_type], got_host, name, host);
fail_unless(display == got_display, "screenless parse %sproduced unexpected display '%d' for '%s': expected '%d'", test_string[test_type], got_display, name, display);
}
- putenv("DISPLAY");
+ putenv("DISPLAY=");
}
static void parse_display_fail(const char *name)
@@ -66,10 +66,11 @@ static void parse_display_fail(const char *name)
if(test_type == TEST_ARGUMENT)
{
argument = name;
- putenv("DISPLAY");
+ putenv("DISPLAY=");
}
else if(test_type == TEST_ENVIRONMENT)
{
+ if (!name) break;
argument = 0;
setenv("DISPLAY", name, 1);
}
@@ -91,7 +92,7 @@ static void parse_display_fail(const char *name)
fail_unless(got_host == (char *) -1, "host changed on parse failure %sfor '%s': got %p", test_string[test_type], name, got_host);
fail_unless(got_display == -42, "display changed on parse failure %sfor '%s': got %d", test_string[test_type], name, got_display);
}
- putenv("DISPLAY");
+ putenv("DISPLAY=");
}
START_TEST(parse_display_unix)
@@ -205,7 +206,7 @@ END_TEST
Suite *public_suite(void)
{
Suite *s = suite_create("Public API");
- putenv("DISPLAY");
+ putenv("DISPLAY=");
suite_add_test(s, parse_display_unix, "xcb_parse_display unix");
suite_add_test(s, parse_display_ip, "xcb_parse_display ip");
suite_add_test(s, parse_display_ipv4, "xcb_parse_display ipv4");