blob: eeb0a391a241ca55309ca7f21ff5e113627667ea (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
#include "../src/testing.c"
int
main(void) {
int rc = -1;
test_start("testing.c");
const int should_overwrite = 1;
if (unsetenv(ENVVAR_NAME)) {
perror("unsetenv(\"NO_COLOR\")");
goto out;
}
{
testing("unset NO_COLOR");
test_ok();
}
if (setenv(ENVVAR_NAME, "", should_overwrite)) {
perror("setenv(\"NO_COLOR\", \"\", 1)");
goto out;
}
{
testing("empty NO_COLOR");
test_ok();
}
if (setenv(ENVVAR_NAME, "something", should_overwrite)) {
perror("setenv(\"NO_COLOR\", \"something\", 1)");
goto out;
}
{
testing("defined NO_COLOR");
test_ok();
}
rc = 0;
out:
return !!rc;
}
|