From 52b43151c62f52cff557f126fcd7062559b09e0e Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Mon, 5 Nov 2007 15:13:55 +0000 Subject: 2007-11-06 Tatsuhiro Tsujikawa Now a file is stored in the directory specified in .metalnk file (file[@name]). * src/Metalink2RequestGroup.cc Create the directory structure when opening the file if it doesn't exist. * src/AbstractDiskWriter.cc * src/Util.{h, cc} * src/File.h * test/UtilTest.cc Removed file name comparison * src/Metalink2RequestGroup.cc * src/HttpResponseCommand.cc Rewritten using Util::mkdirs() * src/FileEntry.cc (setupDir) * test/FileEntryTest.cc Updated doc * src/SingleFileDownloadContext.h --- test/FileEntryTest.cc | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 test/FileEntryTest.cc (limited to 'test/FileEntryTest.cc') diff --git a/test/FileEntryTest.cc b/test/FileEntryTest.cc new file mode 100644 index 00000000..af1c3fd7 --- /dev/null +++ b/test/FileEntryTest.cc @@ -0,0 +1,34 @@ +#include "FileEntry.h" +#include + +class FileEntryTest : public CppUnit::TestFixture { + + CPPUNIT_TEST_SUITE(FileEntryTest); + CPPUNIT_TEST(testSetupDir); + CPPUNIT_TEST_SUITE_END(); +public: + void setUp() {} + + void testSetupDir(); +}; + + +CPPUNIT_TEST_SUITE_REGISTRATION( FileEntryTest ); + +void FileEntryTest::testSetupDir() +{ + string topDir = "/tmp"; + string dir = "aria2-FileEntryTest-testSetupDir"; + string filename = "filename"; + string path = topDir+"/"+dir+"/"+filename; + File d(topDir+"/"+dir); + if(d.exists()) { + CPPUNIT_ASSERT(d.remove()); + } + CPPUNIT_ASSERT(!d.exists()); + FileEntry fileEntry(dir+"/"+filename, 0, 0); + fileEntry.setupDir(topDir); + CPPUNIT_ASSERT(d.isDir()); + File f(path); + CPPUNIT_ASSERT(!f.exists()); +} -- cgit