From 7a54464a8b8dc59a15d7ededb39e865650bbf098 Mon Sep 17 00:00:00 2001 From: Alek Mosingiewicz Date: Tue, 3 Apr 2018 17:51:16 +0200 Subject: [PATCH] Warn against environmental variables not set in test. --- unittests/multithreaded_test.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/unittests/multithreaded_test.cpp b/unittests/multithreaded_test.cpp index e2d0240b..670ccc6d 100644 --- a/unittests/multithreaded_test.cpp +++ b/unittests/multithreaded_test.cpp @@ -47,16 +47,26 @@ int main() const char *usepath = getenv("CHAI_USE_PATH"); const char *modulepath = getenv("CHAI_MODULE_PATH"); + + if(usepath == nullptr) + { + std::cout << "Warning: usepath not set!\n"; + } + + if(modulepath == nullptr) + { + std::cout << "Warning: modulepath not set!\n"; + } #ifdef CHAISCRIPT_MSVC #pragma warning(pop) #endif std::vector usepaths; - usepaths.push_back(""); + usepaths.emplace_back(""); if (usepath) { - usepaths.push_back(usepath); + usepaths.emplace_back(usepath); } std::vector modulepaths; @@ -64,10 +74,10 @@ int main() #ifdef CHAISCRIPT_NO_DYNLOAD chaiscript::ChaiScript chai(/* unused */modulepaths, usepaths); #else - modulepaths.push_back(""); + modulepaths.emplace_back(""); if (modulepath) { - modulepaths.push_back(modulepath); + modulepaths.emplace_back(modulepath); } // For this test we are going to load the dynamic stdlib