Skip to content
Snippets Groups Projects
Commit 6ef1cb1b authored by Ken Martin's avatar Ken Martin
Browse files

ENH: better coverage

parent 14cde762
No related branches found
No related tags found
No related merge requests found
......@@ -255,6 +255,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
*/
......@@ -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.
......
......@@ -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();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment