diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2021-08-27 20:24:08 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2021-08-27 20:24:08 +0100 |
commit | c563ec757954012b99bbda15f8136d0f2657c63f (patch) | |
tree | 4c9ac50a7855211097c92dff9dc23ff0fb99574f /test | |
parent | Fix Misc test module name (diff) | |
download | mygrate-c563ec757954012b99bbda15f8136d0f2657c63f.tar.bz2 mygrate-c563ec757954012b99bbda15f8136d0f2657c63f.tar.xz mygrate-c563ec757954012b99bbda15f8136d0f2657c63f.zip |
Test of getenv wrapper
Diffstat (limited to 'test')
-rw-r--r-- | test/test-misc.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/test-misc.cpp b/test/test-misc.cpp index f519dda..aef2694 100644 --- a/test/test-misc.cpp +++ b/test/test-misc.cpp @@ -134,3 +134,14 @@ BOOST_DATA_TEST_CASE(convert_time, { BOOST_CHECK_EQUAL(MyGrate::MySQL::time2From24bit(tint), time); } + +BOOST_AUTO_TEST_CASE(getenv_with_default) +{ + const char * tenv {"mygrate_something"}; + ::unsetenv(tenv); + BOOST_CHECK_EQUAL(MyGrate::getenv(tenv, ""), ""); + BOOST_CHECK_EQUAL(MyGrate::getenv(tenv, "default"), "default"); + ::setenv(tenv, "something else", 1); + BOOST_CHECK_EQUAL(MyGrate::getenv(tenv, "default"), "something else"); + ::unsetenv(tenv); +} |