added simple test case for epicsEnvUnset
This commit is contained in:
@@ -62,6 +62,11 @@ epicsEnvTest_SRCS += epicsEnvTest.c
|
||||
testHarness_SRCS += epicsEnvTest.c
|
||||
TESTS += epicsEnvTest
|
||||
|
||||
TESTPROD_HOST += epicsEnvUnsetTest
|
||||
epicsEnvUnsetTest_SRCS += epicsEnvUnsetTest.c
|
||||
testHarness_SRCS += epicsEnvUnsetTest.c
|
||||
TESTS += epicsEnvUnsetTest
|
||||
|
||||
TESTPROD_HOST += epicsErrlogTest
|
||||
epicsErrlogTest_SRCS += epicsErrlogTest.c
|
||||
testHarness_SRCS += epicsErrlogTest.c
|
||||
|
||||
38
src/libCom/test/epicsEnvUnsetTest.c
Normal file
38
src/libCom/test/epicsEnvUnsetTest.c
Normal file
@@ -0,0 +1,38 @@
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "macLib.h"
|
||||
#include "envDefs.h"
|
||||
#include "errlog.h"
|
||||
#include "epicsUnitTest.h"
|
||||
#include "testMain.h"
|
||||
|
||||
static void check(const char* variable, const char* expected)
|
||||
{
|
||||
const char* value;
|
||||
|
||||
value = getenv(variable);
|
||||
if (!testOk((!expected && !value) || (expected && value && strcmp(expected, value) == 0),
|
||||
"%s = \"%s\"", variable, value))
|
||||
{
|
||||
testDiag("should have been \"%s\"", expected);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
MAIN(epicsEnvUnsetTest)
|
||||
{
|
||||
eltc(0);
|
||||
testPlan(3);
|
||||
|
||||
check("TEST_VAR_A",NULL);
|
||||
epicsEnvSet("TEST_VAR_A","test value");
|
||||
check("TEST_VAR_A","test value");
|
||||
epicsEnvUnset("TEST_VAR_A");
|
||||
check("TEST_VAR_A",NULL);
|
||||
|
||||
testDone();
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user