diff options
Diffstat (limited to '')
-rw-r--r-- | libsimple.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/libsimple.c b/libsimple.c index f9657c2..fd7f779 100644 --- a/libsimple.c +++ b/libsimple.c @@ -629,6 +629,30 @@ main(void) fprintf(stderr, "warning: libsimple_memdupa missing\n"); #endif + unsetenv("X"); + assert(!getenv("X")); + assert(!libsimple_getenv_ne("X")); + + putenv("X=xyz"); + assert(!strcmpnul(getenv("X"), "xyz")); + assert(!strcmpnul(libsimple_getenv_ne("X"), "xyz")); + + putenv("X="); + assert(!strcmpnul(getenv("X"), "")); + assert(!libsimple_getenv_ne("X")); + + unsetenv("X"); + assert(!getenv("X")); + assert(!strcmpnul(libsimple_getenv_e("X"), "")); + + putenv("X=xyz"); + assert(!strcmpnul(getenv("X"), "xyz")); + assert(!strcmpnul(libsimple_getenv_e("X"), "xyz")); + + putenv("X="); + assert(!strcmpnul(getenv("X"), "")); + assert(!strcmpnul(libsimple_getenv_e("X"), "")); + return 0; } |