diff options
author | Ken Martin <ken.martin@kitware.com> | 2006-07-31 17:50:50 (GMT) |
---|---|---|
committer | Ken Martin <ken.martin@kitware.com> | 2006-07-31 17:50:50 (GMT) |
commit | 4f9fcad327f4f694487b183464291e93a90bfb36 (patch) | |
tree | 1047b635b4d56725a91f7730f41048c1eada2156 /Source/kwsys | |
parent | b24533f27cfc6ced9cc8c80a75453f155646186b (diff) | |
download | CMake-4f9fcad327f4f694487b183464291e93a90bfb36.zip CMake-4f9fcad327f4f694487b183464291e93a90bfb36.tar.gz CMake-4f9fcad327f4f694487b183464291e93a90bfb36.tar.bz2 |
ENH: better coverage
Diffstat (limited to 'Source/kwsys')
-rw-r--r-- | Source/kwsys/SystemTools.hxx.in | 31 | ||||
-rw-r--r-- | Source/kwsys/testSystemTools.cxx | 42 |
2 files changed, 54 insertions, 19 deletions
diff --git a/Source/kwsys/SystemTools.hxx.in b/Source/kwsys/SystemTools.hxx.in index 4649a0a..0e44e58 100644 --- a/Source/kwsys/SystemTools.hxx.in +++ b/Source/kwsys/SystemTools.hxx.in @@ -256,6 +256,20 @@ public: static kwsys_stl::string ConvertToOutputPath(const char*); /** + * Convert the path to a string that can be used in a unix makefile. + * double slashes are removed, and spaces are escaped. + */ + static kwsys_stl::string ConvertToUnixOutputPath(const char*); + + /** + * Convert the path to string that can be used in a windows project or + * makefile. Double slashes are removed if they are not at the start of + * the string, the slashes are converted to windows style backslashes, and + * if there are spaces in the string it is double quoted. + */ + static kwsys_stl::string ConvertToWindowsOutputPath(const char*); + + /** * Return true if a file exists in the current directory */ static bool FileExists(const char* filename); @@ -429,12 +443,6 @@ public: */ static bool IsSubDirectory(const char* fileOrDir, const char* dir); - /** - * Convert the path to a string that can be used in a unix makefile. - * double slashes are removed, and spaces are escaped. - */ - static kwsys_stl::string ConvertToUnixOutputPath(const char*); - /** ----------------------------------------------------------------- * File Manipulation Routines * ----------------------------------------------------------------- @@ -754,17 +762,6 @@ public: static void ConvertWindowsCommandLineToUnixArguments( const char *cmd_line, int *argc, char ***argv); -protected: - // these two functions can be called from ConvertToOutputPath - - /** - * Convert the path to string that can be used in a windows project or - * makefile. Double slashes are removed if they are not at the start of - * the string, the slashes are converted to windows style backslashes, and - * if there are spaces in the string it is double quoted. - */ - static kwsys_stl::string ConvertToWindowsOutputPath(const char*); - private: /** * Allocate the std::map that serve as the Path Translation table. diff --git a/Source/kwsys/testSystemTools.cxx b/Source/kwsys/testSystemTools.cxx index d83bd90..7faa4bf 100644 --- a/Source/kwsys/testSystemTools.cxx +++ b/Source/kwsys/testSystemTools.cxx @@ -93,7 +93,7 @@ bool CheckEscapeChars(kwsys_stl::string input, } //---------------------------------------------------------------------------- -bool CheckDetectFileType() +bool CheckFileOperations() { bool res = true; @@ -114,6 +114,14 @@ bool CheckDetectFileType() << TEST_SYSTEMTOOLS_SRC_FILE << kwsys_ios::endl; res = false; } + + if (kwsys::SystemTools::FileLength(TEST_SYSTEMTOOLS_BIN_FILE) != 766) + { + kwsys_ios::cerr + << "Problem with FileLength - incorrect length for: " + << TEST_SYSTEMTOOLS_BIN_FILE << kwsys_ios::endl; + res = false; + } return res; } @@ -264,7 +272,37 @@ bool CheckStringOperations() << TEST_SYSTEMTOOLS_SRC_FILE << kwsys_ios::endl; res = false; } + + if (kwsys::SystemTools::ConvertToWindowsOutputPath + ("L://Local Mojo/Hex Power Pack/Iffy Voodoo") != + "\"L:\\Local Mojo\\Hex Power Pack\\Iffy Voodoo\"") + { + kwsys_ios::cerr + << "Problem with ConvertToWindowsOutputPath " + << kwsys_ios::endl; + res = false; + } + if (kwsys::SystemTools::ConvertToWindowsOutputPath + ("//grayson/Local Mojo/Hex Power Pack/Iffy Voodoo") != + "\"\\\\grayson\\Local Mojo\\Hex Power Pack\\Iffy Voodoo\"") + { + kwsys_ios::cerr + << "Problem with ConvertToWindowsOutputPath " + << kwsys_ios::endl; + res = false; + } + + if (kwsys::SystemTools::ConvertToUnixOutputPath + ("//Local Mojo/Hex Power Pack/Iffy Voodoo") != + "/Local\\ Mojo/Hex\\ Power\\ Pack/Iffy\\ Voodoo") + { + kwsys_ios::cerr + << "Problem with ConvertToUnixOutputPath " + << kwsys_ios::endl; + res = false; + } + int targc; char **targv; kwsys::SystemTools::ConvertWindowsCommandLineToUnixArguments @@ -312,7 +350,7 @@ int main(/*int argc, char* argv*/) *checkEscapeChars[cc][2], checkEscapeChars[cc][3]); } - res &= CheckDetectFileType(); + res &= CheckFileOperations(); res &= CheckStringOperations(); |