From c563ec757954012b99bbda15f8136d0f2657c63f Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Fri, 27 Aug 2021 20:24:08 +0100 Subject: Test of getenv wrapper --- test/test-misc.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'test') 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); +} -- cgit v1.2.3