mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-27 19:10:20 +01:00
SF [2851052] Poco::DirectoryIterator copy constructor is broken
added testCreateFile() to the test suite
This commit is contained in:
@@ -66,11 +66,9 @@ DirectoryIterator::DirectoryIterator(const std::string& path): _path(path), _pIm
|
|||||||
|
|
||||||
DirectoryIterator::DirectoryIterator(const DirectoryIterator& iterator): _path(iterator._path), _pImpl(iterator._pImpl)
|
DirectoryIterator::DirectoryIterator(const DirectoryIterator& iterator): _path(iterator._path), _pImpl(iterator._pImpl)
|
||||||
{
|
{
|
||||||
_path.makeDirectory();
|
|
||||||
if (_pImpl)
|
if (_pImpl)
|
||||||
{
|
{
|
||||||
_pImpl->duplicate();
|
_pImpl->duplicate();
|
||||||
_path.setFileName(_pImpl->get());
|
|
||||||
_file = _path;
|
_file = _path;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,6 +60,17 @@ FileTest::~FileTest()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void FileTest::testCreateFile()
|
||||||
|
{
|
||||||
|
File f("testfile.dat");
|
||||||
|
bool created = f.createFile();
|
||||||
|
assert (created);
|
||||||
|
assert (!f.isHidden());
|
||||||
|
created = f.createFile();
|
||||||
|
assert (!created);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void FileTest::testFileAttributes1()
|
void FileTest::testFileAttributes1()
|
||||||
{
|
{
|
||||||
File f("testfile.dat");
|
File f("testfile.dat");
|
||||||
@@ -203,17 +214,6 @@ void FileTest::testFileAttributes1()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void FileTest::testCreateFile()
|
|
||||||
{
|
|
||||||
File f("testfile.dat");
|
|
||||||
bool created = f.createFile();
|
|
||||||
assert (created);
|
|
||||||
assert (!f.isHidden());
|
|
||||||
created = f.createFile();
|
|
||||||
assert (!created);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void FileTest::testFileAttributes2()
|
void FileTest::testFileAttributes2()
|
||||||
{
|
{
|
||||||
TemporaryFile f;
|
TemporaryFile f;
|
||||||
@@ -524,6 +524,7 @@ CppUnit::Test* FileTest::suite()
|
|||||||
{
|
{
|
||||||
CppUnit::TestSuite* pSuite = new CppUnit::TestSuite("FileTest");
|
CppUnit::TestSuite* pSuite = new CppUnit::TestSuite("FileTest");
|
||||||
|
|
||||||
|
CppUnit_addTest(pSuite, FileTest, testCreateFile);
|
||||||
CppUnit_addTest(pSuite, FileTest, testFileAttributes1);
|
CppUnit_addTest(pSuite, FileTest, testFileAttributes1);
|
||||||
CppUnit_addTest(pSuite, FileTest, testFileAttributes2);
|
CppUnit_addTest(pSuite, FileTest, testFileAttributes2);
|
||||||
CppUnit_addTest(pSuite, FileTest, testFileAttributes3);
|
CppUnit_addTest(pSuite, FileTest, testFileAttributes3);
|
||||||
|
|||||||
Reference in New Issue
Block a user