summaryrefslogtreecommitdiff
path: root/test/FileEntryTest.cc
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2007-11-05 15:13:55 +0000
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2007-11-05 15:13:55 +0000
commit52b43151c62f52cff557f126fcd7062559b09e0e (patch)
tree0f7b8ec924b993a9770bfe6331971add42e6ce3f /test/FileEntryTest.cc
parentbcbadb3b6b5eb18f5d17797a22977b6d44c85a81 (diff)
2007-11-06 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
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
Diffstat (limited to 'test/FileEntryTest.cc')
-rw-r--r--test/FileEntryTest.cc34
1 files changed, 34 insertions, 0 deletions
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 <cppunit/extensions/HelperMacros.h>
+
+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());
+}