diff options
Diffstat (limited to 'Source/kwsys/testDirectory.cxx')
-rw-r--r-- | Source/kwsys/testDirectory.cxx | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/Source/kwsys/testDirectory.cxx b/Source/kwsys/testDirectory.cxx index 983f2c6..62a0986 100644 --- a/Source/kwsys/testDirectory.cxx +++ b/Source/kwsys/testDirectory.cxx @@ -73,7 +73,38 @@ int _doLongPathTest() return res; } +int _copyDirectoryTest() +{ + using namespace kwsys; + const std::string source(TEST_SYSTEMTOOLS_BINARY_DIR + "/directory_testing/copyDirectoryTestSrc"); + if (SystemTools::PathExists(source)) { + std::cerr << source << " shouldn't exist before test" << std::endl; + return 1; + } + const std::string destination(TEST_SYSTEMTOOLS_BINARY_DIR + "/directory_testing/copyDirectoryTestDst"); + if (SystemTools::PathExists(destination)) { + std::cerr << destination << " shouldn't exist before test" << std::endl; + return 2; + } + const bool copysuccess = SystemTools::CopyADirectory(source, destination); + const bool destinationexists = SystemTools::PathExists(destination); + if (copysuccess) { + std::cerr << "CopyADirectory should have returned false" << std::endl; + SystemTools::RemoveADirectory(destination); + return 3; + } + if (destinationexists) { + std::cerr << "CopyADirectory returned false, but destination directory" + << " has been created" << std::endl; + SystemTools::RemoveADirectory(destination); + return 4; + } + return 0; +} + int testDirectory(int, char* []) { - return _doLongPathTest(); + return _doLongPathTest() + _copyDirectoryTest(); } |