Modified MimeTypeTestSuite slightly so as to not remove the copied

mime database directory if it already existed in the first place.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@791 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Tyler Dauwalder 2002-08-16 23:21:48 +00:00
parent dda17c0010
commit 75120765af

View File

@ -117,7 +117,7 @@ void FillWithMimeTypes(ContainerAdapter &container, BMessage &typeMessage, const
// before running all the BMimeType tests // before running all the BMimeType tests
class MimeTypeTestSuite : public CppUnit::TestSuite { class MimeTypeTestSuite : public CppUnit::TestSuite {
public: public:
MimeTypeTestSuite() : CppUnit::TestSuite() {} MimeTypeTestSuite() : CppUnit::TestSuite(), fMimeDirExisted(false) {}
virtual void setUp() virtual void setUp()
{ {
// If we're using a directory other than the R5 MIME database directory, make // If we're using a directory other than the R5 MIME database directory, make
@ -132,6 +132,7 @@ public:
+ " " + mimeDatabaseDir; + " " + mimeDatabaseDir;
ExecCommand(cmd.c_str()); ExecCommand(cmd.c_str());
} else { } else {
fMimeDirExisted = true;
if (BTestShell::GlobalBeVerbose()) if (BTestShell::GlobalBeVerbose())
cout << "(Using existing copy of MIME database in '" + mimeDatabaseDir + "')" << endl; cout << "(Using existing copy of MIME database in '" + mimeDatabaseDir + "')" << endl;
} }
@ -140,7 +141,7 @@ public:
virtual void tearDown() virtual void tearDown()
{ {
if (mimeDatabaseDir != R5DatabaseDir) { if (mimeDatabaseDir != R5DatabaseDir && !fMimeDirExisted) {
if (BTestShell::GlobalBeVerbose()) if (BTestShell::GlobalBeVerbose())
cout << "(Removing copy of MIME database in '" + mimeDatabaseDir + "')" << endl; cout << "(Removing copy of MIME database in '" + mimeDatabaseDir + "')" << endl;
std::string cmd = std::string("rm -rf ") + mimeDatabaseDir; std::string cmd = std::string("rm -rf ") + mimeDatabaseDir;
@ -153,7 +154,9 @@ public:
setUp(); setUp();
CppUnit::TestSuite::run(result); CppUnit::TestSuite::run(result);
tearDown(); tearDown();
} }
private:
bool fMimeDirExisted;
}; };
// Suite // Suite