Skip to content
Snippets Groups Projects
Commit 9e9c8ae3 authored by Rolf Eike Beer's avatar Rolf Eike Beer
Browse files

SystemTools: extend test coverage of SystemTools::MakeDirectory()

Change-Id: I45efddc1638965d17f0207cdf900a44aef8bf0e8
parent 9596e98d
No related branches found
No related tags found
No related merge requests found
......@@ -172,6 +172,46 @@ static bool CheckFileOperations()
<< testNewDir << std::endl;
res = false;
}
// calling it again should just return true
if (!kwsys::SystemTools::MakeDirectory(testNewDir))
{
std::cerr
<< "Problem with second call to MakeDirectory for: "
<< testNewDir << std::endl;
res = false;
}
// calling with 0 pointer should return false
if (kwsys::SystemTools::MakeDirectory(0))
{
std::cerr
<< "Problem with MakeDirectory(0)"
<< std::endl;
res = false;
}
// calling with an empty string should return false
if (kwsys::SystemTools::MakeDirectory(std::string()))
{
std::cerr
<< "Problem with MakeDirectory(std::string())"
<< std::endl;
res = false;
}
// remove it
if (!kwsys::SystemTools::RemoveADirectory(testNewDir))
{
std::cerr
<< "Problem with RemoveADirectory for: "
<< testNewDir << std::endl;
res = false;
}
// create it using the char* version
if (!kwsys::SystemTools::MakeDirectory(testNewDir.c_str()))
{
std::cerr
<< "Problem with second call to MakeDirectory as C string for: "
<< testNewDir << std::endl;
res = false;
}
if (!kwsys::SystemTools::Touch(testNewFile.c_str(), true))
{
......@@ -180,6 +220,14 @@ static bool CheckFileOperations()
<< testNewFile << std::endl;
res = false;
}
// calling MakeDirectory with something that is no file should fail
if (kwsys::SystemTools::MakeDirectory(testNewFile))
{
std::cerr
<< "Problem with to MakeDirectory for: "
<< testNewFile << std::endl;
res = false;
}
// Reset umask
#if defined(_WIN32) && !defined(__CYGWIN__)
......
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