summaryrefslogtreecommitdiffstats
path: root/Source/kwsys/testSystemTools.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2017-08-11 14:13:23 (GMT)
committerBrad King <brad.king@kitware.com>2017-08-11 14:13:23 (GMT)
commit060cef0c44300c3fa8fb655619eb7a599083ef49 (patch)
treec07205d04371047d8ec210a932465f4497d68e6e /Source/kwsys/testSystemTools.cxx
parentc47c011c77bfd1bfb8d2060511a2b957ce181c62 (diff)
parent9e0026216fb81e71ecd6918294a7ff8004132f1d (diff)
downloadCMake-060cef0c44300c3fa8fb655619eb7a599083ef49.zip
CMake-060cef0c44300c3fa8fb655619eb7a599083ef49.tar.gz
CMake-060cef0c44300c3fa8fb655619eb7a599083ef49.tar.bz2
Merge branch 'upstream-KWSys' into update-kwsys
* upstream-KWSys: KWSys 2017-08-11 (e1006189)
Diffstat (limited to 'Source/kwsys/testSystemTools.cxx')
-rw-r--r--Source/kwsys/testSystemTools.cxx26
1 files changed, 26 insertions, 0 deletions
diff --git a/Source/kwsys/testSystemTools.cxx b/Source/kwsys/testSystemTools.cxx
index e6fbf6c..1871f5d 100644
--- a/Source/kwsys/testSystemTools.cxx
+++ b/Source/kwsys/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;
}