Skip to content

Commit 1bf1274

Browse files
Merge pull request #47 from synesissoftware/tests-ignore-env
Ensure environment variables cannot disrupt tests
2 parents a7d7a21 + dae3603 commit 1bf1274

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

test/unit/test.unit.utility.cmdline/entry.cpp

+8-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* Purpose: Unit-tests for utility functions.
55
*
66
* Created: 30th December 2024
7-
* Updated: 30th December 2024
7+
* Updated: 31st December 2024
88
*
99
* ////////////////////////////////////////////////////////////////////// */
1010

@@ -34,6 +34,7 @@
3434
/* STLSoft header files */
3535
#include <platformstl/filesystem/FILE_stream.hpp>
3636
#include <platformstl/filesystem/file_lines.hpp>
37+
#include <platformstl/system/environment_variable_traits.hpp>
3738

3839
/* Standard C header files */
3940
#include <stdlib.h>
@@ -86,6 +87,12 @@ int main(int argc, char **argv)
8687

8788
if (XTESTS_START_RUNNER("test.unit.utility.cmdline", verbosity))
8889
{
90+
#ifdef PLATFORMSTL_ENVVAR_ERASE_SUPPORTED
91+
92+
platformstl::environment_variable_traits::erase_variable("TEST_VERBOSITY");
93+
platformstl::environment_variable_traits::erase_variable("XTESTS_VERBOSITY");
94+
#endif
95+
8996
XTESTS_RUN_CASE(TEST_parseHelp2_NO_ARGUMENTS);
9097
XTESTS_RUN_CASE(TEST_parseHelp2_WITH_help_FLAG);
9198
XTESTS_RUN_CASE(TEST_parseHelp2_WITH_help_FLAG_AFTER_DOUBLEDASH);

0 commit comments

Comments
 (0)