summaryrefslogtreecommitdiffstats
path: root/Source/kwsys/testSystemTools.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2018-02-01 13:15:44 (GMT)
committerBrad King <brad.king@kitware.com>2018-02-01 13:15:44 (GMT)
commitbe46f9fb6e9fc0b33198ccf5396e0188e56940e4 (patch)
tree10bb92d3e382eb459c619f2320a01b66c9fead62 /Source/kwsys/testSystemTools.cxx
parent5a16e762e21e22e7a212acc7e2bc7bd027d66166 (diff)
parent854feacc60c5d1dcf53652a764841e1d9d602ac3 (diff)
downloadCMake-be46f9fb6e9fc0b33198ccf5396e0188e56940e4.zip
CMake-be46f9fb6e9fc0b33198ccf5396e0188e56940e4.tar.gz
CMake-be46f9fb6e9fc0b33198ccf5396e0188e56940e4.tar.bz2
Merge branch 'upstream-KWSys' into update-kwsys
* upstream-KWSys: KWSys 2018-02-01 (04fcc449)
Diffstat (limited to 'Source/kwsys/testSystemTools.cxx')
-rw-r--r--Source/kwsys/testSystemTools.cxx36
1 files changed, 26 insertions, 10 deletions
diff --git a/Source/kwsys/testSystemTools.cxx b/Source/kwsys/testSystemTools.cxx
index f1321e5..e436a2b 100644
--- a/Source/kwsys/testSystemTools.cxx
+++ b/Source/kwsys/testSystemTools.cxx
@@ -39,19 +39,19 @@ typedef unsigned short mode_t;
static const char* toUnixPaths[][2] = {
{ "/usr/local/bin/passwd", "/usr/local/bin/passwd" },
{ "/usr/lo cal/bin/pa sswd", "/usr/lo cal/bin/pa sswd" },
- { "/usr/lo\\ cal/bin/pa\\ sswd", "/usr/lo\\ cal/bin/pa\\ sswd" },
+ { "/usr/lo\\ cal/bin/pa\\ sswd", "/usr/lo/ cal/bin/pa/ sswd" },
{ "c:/usr/local/bin/passwd", "c:/usr/local/bin/passwd" },
{ "c:/usr/lo cal/bin/pa sswd", "c:/usr/lo cal/bin/pa sswd" },
- { "c:/usr/lo\\ cal/bin/pa\\ sswd", "c:/usr/lo\\ cal/bin/pa\\ sswd" },
+ { "c:/usr/lo\\ cal/bin/pa\\ sswd", "c:/usr/lo/ cal/bin/pa/ sswd" },
{ "\\usr\\local\\bin\\passwd", "/usr/local/bin/passwd" },
{ "\\usr\\lo cal\\bin\\pa sswd", "/usr/lo cal/bin/pa sswd" },
- { "\\usr\\lo\\ cal\\bin\\pa\\ sswd", "/usr/lo\\ cal/bin/pa\\ sswd" },
+ { "\\usr\\lo\\ cal\\bin\\pa\\ sswd", "/usr/lo/ cal/bin/pa/ sswd" },
{ "c:\\usr\\local\\bin\\passwd", "c:/usr/local/bin/passwd" },
{ "c:\\usr\\lo cal\\bin\\pa sswd", "c:/usr/lo cal/bin/pa sswd" },
- { "c:\\usr\\lo\\ cal\\bin\\pa\\ sswd", "c:/usr/lo\\ cal/bin/pa\\ sswd" },
+ { "c:\\usr\\lo\\ cal\\bin\\pa\\ sswd", "c:/usr/lo/ cal/bin/pa/ sswd" },
{ "\\\\usr\\local\\bin\\passwd", "//usr/local/bin/passwd" },
{ "\\\\usr\\lo cal\\bin\\pa sswd", "//usr/lo cal/bin/pa sswd" },
- { "\\\\usr\\lo\\ cal\\bin\\pa\\ sswd", "//usr/lo\\ cal/bin/pa\\ sswd" },
+ { "\\\\usr\\lo\\ cal\\bin\\pa\\ sswd", "//usr/lo/ cal/bin/pa/ sswd" },
{ KWSYS_NULLPTR, KWSYS_NULLPTR }
};
@@ -700,6 +700,16 @@ static bool CheckCollapsePath()
bool res = true;
res &= CheckCollapsePath("/usr/share/*", "/usr/share/*");
res &= CheckCollapsePath("C:/Windows/*", "C:/Windows/*");
+ res &= CheckCollapsePath("/usr/share/../lib", "/usr/lib");
+ res &= CheckCollapsePath("/usr/share/./lib", "/usr/share/lib");
+ res &= CheckCollapsePath("/usr/share/../../lib", "/lib");
+ res &= CheckCollapsePath("/usr/share/.././../lib", "/lib");
+ res &= CheckCollapsePath("/../lib", "/lib");
+ res &= CheckCollapsePath("/../lib/", "/lib");
+ res &= CheckCollapsePath("/", "/");
+ res &= CheckCollapsePath("C:/", "C:/");
+ res &= CheckCollapsePath("C:/../", "C:/");
+ res &= CheckCollapsePath("C:/../../", "C:/");
return res;
}
@@ -764,20 +774,26 @@ static bool CheckGetFilenameName()
const char* windowsFilepath = "C:\\somewhere\\something";
const char* unixFilepath = "/somewhere/something";
- std::string expectedFilename = "something";
+#if defined(_WIN32) || defined(KWSYS_SYSTEMTOOLS_SUPPORT_WINDOWS_SLASHES)
+ std::string expectedWindowsFilename = "something";
+#else
+ std::string expectedWindowsFilename = "C:\\somewhere\\something";
+#endif
+ std::string expectedUnixFilename = "something";
bool res = true;
std::string filename = kwsys::SystemTools::GetFilenameName(windowsFilepath);
- if (filename != expectedFilename) {
+ if (filename != expectedWindowsFilename) {
std::cerr << "GetFilenameName(" << windowsFilepath << ") yielded "
- << filename << " instead of " << expectedFilename << std::endl;
+ << filename << " instead of " << expectedWindowsFilename
+ << std::endl;
res = false;
}
filename = kwsys::SystemTools::GetFilenameName(unixFilepath);
- if (filename != expectedFilename) {
+ if (filename != expectedUnixFilename) {
std::cerr << "GetFilenameName(" << unixFilepath << ") yielded " << filename
- << " instead of " << expectedFilename << std::endl;
+ << " instead of " << expectedUnixFilename << std::endl;
res = false;
}
return res;