MCPcopy Create free account
hub / github.com/Kitware/CMake / CheckGetPath

Function CheckGetPath

Source/kwsys/testSystemTools.cxx:832–871  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

830}
831
832static bool CheckGetPath()
833{
834 char const* envName = "S";
835#ifdef _WIN32
836 char const* envValue = "C:\\Somewhere\\something;D:\\Temp";
837#else
838 char const* envValue = "/Somewhere/something:/tmp";
839#endif
840 char const* registryPath = "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MyApp; MyKey]";
841
842 std::vector<std::string> originalPaths;
843 originalPaths.emplace_back(registryPath);
844
845 std::vector<std::string> expectedPaths;
846 expectedPaths.emplace_back(registryPath);
847#ifdef _WIN32
848 expectedPaths.push_back("C:/Somewhere/something");
849 expectedPaths.push_back("D:/Temp");
850#else
851 expectedPaths.emplace_back("/Somewhere/something");
852 expectedPaths.emplace_back("/tmp");
853#endif
854
855 bool res = true;
856 res &= CheckPutEnv(std::string(envName) + "=" + envValue, envName, envValue);
857
858 std::vector<std::string> paths = originalPaths;
859 kwsys::SystemTools::GetPath(paths, envName);
860
861 if (paths != expectedPaths) {
862 std::cerr << "GetPath(" << StringVectorToString(originalPaths) << ", "
863 << envName << ") yielded " << StringVectorToString(paths)
864 << " instead of " << StringVectorToString(expectedPaths)
865 << std::endl;
866 res = false;
867 }
868
869 res &= CheckUnPutEnv(envName, envName);
870 return res;
871}
872
873static bool CheckGetFilenameName()
874{

Callers 1

testSystemToolsFunction · 0.85

Calls 6

CheckPutEnvFunction · 0.85
GetPathFunction · 0.85
StringVectorToStringFunction · 0.85
CheckUnPutEnvFunction · 0.85
emplace_backMethod · 0.80
push_backMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…