Remove workingCopyPathMode()

This commit is contained in:
Martchus 2019-05-11 18:59:35 +02:00
parent f0c6035609
commit f16703ffc0
3 changed files with 6 additions and 25 deletions

View File

@ -328,12 +328,12 @@ void IoTests::testIniFile()
// write values to another file
fstream outputFile;
outputFile.exceptions(ios_base::failbit | ios_base::badbit);
outputFile.open(workingCopyPathMode("output.ini", WorkingCopyMode::NoCopy), ios_base::out | ios_base::trunc);
outputFile.open(workingCopyPath("output.ini", WorkingCopyMode::NoCopy), ios_base::out | ios_base::trunc);
ini.make(outputFile);
// parse written values (again)
outputFile.close();
outputFile.open(workingCopyPathMode("output.ini", WorkingCopyMode::NoCopy), ios_base::in);
outputFile.open(workingCopyPath("output.ini", WorkingCopyMode::NoCopy), ios_base::in);
IniFile ini2;
ini2.parse(outputFile);
CPPUNIT_ASSERT(ini.data() == ini2.data());

View File

@ -253,20 +253,11 @@ string TestApplication::testFilePath(const string &relativeTestFilePath) const
*
* \remarks The test file is located using testFilePath().
*/
string TestApplication::workingCopyPathMode(const string &relativeTestFilePath, WorkingCopyMode mode) const
string TestApplication::workingCopyPath(const string &relativeTestFilePath, WorkingCopyMode mode) const
{
return workingCopyPathAs(relativeTestFilePath, relativeTestFilePath, mode);
}
/*!
* \brief Returns the full path to a working copy of the test file with the specified \a relativeTestFilePath.
* \remarks The test file is located using testFilePath().
*/
string TestApplication::workingCopyPath(const string &relativeTestFilePath) const
{
return workingCopyPathAs(relativeTestFilePath, relativeTestFilePath, WorkingCopyMode::CreateCopy);
}
/*!
* \brief Returns the full path to a working copy of the test file with the specified \a relativeTestFilePath.
*

View File

@ -11,7 +11,7 @@
namespace TestUtilities {
/*!
* \brief The WorkingCopyMode enum specifies additional options to influence behavior of TestApplication::workingCopyPathMode().
* \brief The WorkingCopyMode enum specifies additional options to influence behavior of TestApplication::workingCopyPath().
*/
enum class WorkingCopyMode {
CreateCopy, /**< a working copy of the test file is created */
@ -26,8 +26,7 @@ public:
operator bool() const;
std::string testFilePath(const std::string &relativeTestFilePath) const;
std::string workingCopyPathMode(const std::string &relativeTestFilePath, WorkingCopyMode mode) const;
std::string workingCopyPath(const std::string &relativeTestFilePath) const;
std::string workingCopyPath(const std::string &relativeTestFilePath, WorkingCopyMode mode = WorkingCopyMode::CreateCopy) const;
std::string workingCopyPathAs(const std::string &relativeTestFilePath, const std::string &relativeWorkingCopyPath,
WorkingCopyMode mode = WorkingCopyMode::CreateCopy) const;
#ifdef PLATFORM_UNIX
@ -110,16 +109,7 @@ inline CPP_UTILITIES_EXPORT std::string testFilePath(const std::string &relative
* \brief Convenience function to invoke TestApplication::workingCopyPath().
* \remarks A TestApplication must be present.
*/
inline CPP_UTILITIES_EXPORT std::string workingCopyPath(const std::string &relativeTestFilePath)
{
return TestApplication::instance()->workingCopyPathAs(relativeTestFilePath, relativeTestFilePath, WorkingCopyMode::CreateCopy);
}
/*!
* \brief Convenience function to invoke TestApplication::workingCopyPathMode().
* \remarks A TestApplication must be present.
*/
inline CPP_UTILITIES_EXPORT std::string workingCopyPathMode(const std::string &relativeTestFilePath, WorkingCopyMode mode)
inline CPP_UTILITIES_EXPORT std::string workingCopyPath(const std::string &relativeTestFilePath, WorkingCopyMode mode = WorkingCopyMode::CreateCopy)
{
return TestApplication::instance()->workingCopyPathAs(relativeTestFilePath, relativeTestFilePath, mode);
}