summaryrefslogtreecommitdiffstats
path: root/testSystemTools.cxx
diff options
context:
space:
mode:
authorKWSys Upstream <kwrobot@kitware.com>2017-08-11 14:12:58 (GMT)
committerBrad King <brad.king@kitware.com>2017-08-11 14:13:22 (GMT)
commit9e0026216fb81e71ecd6918294a7ff8004132f1d (patch)
tree614e4179c83fa38835eb1b7929a48af4f627f408 /testSystemTools.cxx
parenta32758782c953a333c0dd1e8553aee66a4404ee5 (diff)
downloadCMake-9e0026216fb81e71ecd6918294a7ff8004132f1d.zip
CMake-9e0026216fb81e71ecd6918294a7ff8004132f1d.tar.gz
CMake-9e0026216fb81e71ecd6918294a7ff8004132f1d.tar.bz2
KWSys 2017-08-11 (e1006189)
Code extracted from: https://gitlab.kitware.com/utils/kwsys.git at commit e100618908f7f7a41cbe623afa79ca0e4f17834a (master). Upstream Shortlog ----------------- Chuck Atkins (2): 993f0ea4 Add an option to split object and interface libs. b61faf89 Fix install rules and usage requirements for interface+object libs Justin Berger (2): 6d73752d Allow KWSYSPE_USE_SELECT macro to be overriden at compile time. da61baff Added cmake settable property to enable the macro Sean McBride (1): dfa13188 Fixed a couple of trivial clang -Wunused-macros warnings Shawn Waldon (1): da8a9e65 SystemTools: make GetFilenameName handle either kind of slash
Diffstat (limited to 'testSystemTools.cxx')
-rw-r--r--testSystemTools.cxx26
1 files changed, 26 insertions, 0 deletions
diff --git a/testSystemTools.cxx b/testSystemTools.cxx
index e6fbf6c..1871f5d 100644
--- a/testSystemTools.cxx
+++ b/testSystemTools.cxx
@@ -758,6 +758,30 @@ static bool CheckGetPath()
return res;
}
+static bool CheckGetFilenameName()
+{
+ const char* windowsFilepath = "C:\\somewhere\\something";
+ const char* unixFilepath = "/somewhere/something";
+
+ std::string expectedFilename = "something";
+
+ bool res = true;
+ std::string filename = kwsys::SystemTools::GetFilenameName(windowsFilepath);
+ if (filename != expectedFilename) {
+ std::cerr << "GetFilenameName(" << windowsFilepath << ") yielded "
+ << filename << " instead of " << expectedFilename << std::endl;
+ res = false;
+ }
+
+ filename = kwsys::SystemTools::GetFilenameName(unixFilepath);
+ if (filename != expectedFilename) {
+ std::cerr << "GetFilenameName(" << unixFilepath << ") yielded " << filename
+ << " instead of " << expectedFilename << std::endl;
+ res = false;
+ }
+ return res;
+}
+
static bool CheckFind()
{
bool res = true;
@@ -875,5 +899,7 @@ int testSystemTools(int, char* [])
res &= CheckGetLineFromStream();
+ res &= CheckGetFilenameName();
+
return res ? 0 : 1;
}