Warn against environmental variables not set in test.

This commit is contained in:
Alek Mosingiewicz 2018-04-03 17:51:16 +02:00
parent 903454bf05
commit 7a54464a8b

View File

@ -47,16 +47,26 @@ int main()
const char *usepath = getenv("CHAI_USE_PATH"); const char *usepath = getenv("CHAI_USE_PATH");
const char *modulepath = getenv("CHAI_MODULE_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 #ifdef CHAISCRIPT_MSVC
#pragma warning(pop) #pragma warning(pop)
#endif #endif
std::vector<std::string> usepaths; std::vector<std::string> usepaths;
usepaths.push_back(""); usepaths.emplace_back("");
if (usepath) if (usepath)
{ {
usepaths.push_back(usepath); usepaths.emplace_back(usepath);
} }
std::vector<std::string> modulepaths; std::vector<std::string> modulepaths;
@ -64,10 +74,10 @@ int main()
#ifdef CHAISCRIPT_NO_DYNLOAD #ifdef CHAISCRIPT_NO_DYNLOAD
chaiscript::ChaiScript chai(/* unused */modulepaths, usepaths); chaiscript::ChaiScript chai(/* unused */modulepaths, usepaths);
#else #else
modulepaths.push_back(""); modulepaths.emplace_back("");
if (modulepath) if (modulepath)
{ {
modulepaths.push_back(modulepath); modulepaths.emplace_back(modulepath);
} }
// For this test we are going to load the dynamic stdlib // For this test we are going to load the dynamic stdlib