diff options
Diffstat (limited to 'sal/qa/osl/file/osl_File.cxx')
-rw-r--r-- | sal/qa/osl/file/osl_File.cxx | 56 |
1 files changed, 27 insertions, 29 deletions
diff --git a/sal/qa/osl/file/osl_File.cxx b/sal/qa/osl/file/osl_File.cxx index 1b32320803e9..cf8875b020ac 100644 --- a/sal/qa/osl/file/osl_File.cxx +++ b/sal/qa/osl/file/osl_File.cxx @@ -86,10 +86,9 @@ static OString errorToString(const osl::FileBase::RC _nError) static OString errorToStr(osl::FileBase::RC const& nError) { - OString suBuf; - suBuf += "The returned error is: " ; - suBuf += errorToString(nError); - suBuf += "!\n"; + OString suBuf = "The returned error is: " + + errorToString(nError) + + "!\n"; return suBuf; } @@ -263,8 +262,8 @@ static void deleteTestDirectory(const OUString& dirname) nError = Directory::remove(aPathURL); - OString strError ("In deleteTestDirectory function: remove Directory "); - strError += OUStringToOString(aPathURL, RTL_TEXTENCODING_ASCII_US); + OString strError = OString("In deleteTestDirectory function: remove Directory ") + + OUStringToOString(aPathURL, RTL_TEXTENCODING_ASCII_US); CPPUNIT_ASSERT_MESSAGE(strError.getStr(), (osl::FileBase::E_None == nError) || (nError == osl::FileBase::E_NOENT)); } @@ -368,16 +367,15 @@ static bool checkDirectory(const OUString& str, oslCheckMode nCheckMode) */ static OString outputError(const OString & returnVal, const OString & rightVal, const sal_Char * msg = "") { - OString aString; if (returnVal == rightVal) - return aString; - - aString += msg; - aString += ": the returned value is '"; - aString += returnVal; - aString += "', but the value should be '"; - aString += rightVal; - aString += "'."; + return OString(); + + OString aString = OString(msg) + + ": the returned value is '" + + returnVal + + "', but the value should be '" + + rightVal + + "'."; return aString; } @@ -969,9 +967,9 @@ namespace osl_FileBase bool bOk = compareFileName(aUStr, aUResultURL); - OString sError("test for getSystemPathFromFileURL(' "); - sError += OUStringToOString(aUNormalURL, RTL_TEXTENCODING_ASCII_US); - sError += " ') function:use an absolute file URL, "; + OString sError = "test for getSystemPathFromFileURL(' " + + OUStringToOString(aUNormalURL, RTL_TEXTENCODING_ASCII_US) + + " ') function:use an absolute file URL, "; sError += outputError(OUStringToOString(aUStr, RTL_TEXTENCODING_ASCII_US), OUStringToOString(aUResultURL, RTL_TEXTENCODING_ASCII_US)); @@ -992,9 +990,9 @@ namespace osl_FileBase bool bOk = compareFileName(aUStr, aUResultURL); - OString sError("test for getSystemPathFromFileURL(' "); - sError += OUStringToOString(aUNormalURL, RTL_TEXTENCODING_ASCII_US); - sError += " ') function:use a CJK coded absolute URL, "; + OString sError = "test for getSystemPathFromFileURL(' " + + OUStringToOString(aUNormalURL, RTL_TEXTENCODING_ASCII_US) + + " ') function:use a CJK coded absolute URL, "; sError += outputError(OUStringToOString(aUStr, RTL_TEXTENCODING_ASCII_US), OUStringToOString(aUResultURL, RTL_TEXTENCODING_ASCII_US)); deleteTestDirectory(aTmpName10); @@ -4773,9 +4771,9 @@ namespace osl_Directory CPPUNIT_ASSERT_EQUAL_MESSAGE("temp File removal failed", osl::FileBase::E_None, nError1); nError1 = Directory::create(aTmpDir); - OString sError("test for create function: create a directory '"); - sError += OUStringToOString(aTmpDir, RTL_TEXTENCODING_ASCII_US); - sError += "' and check its existence."; + OString sError = "test for create function: create a directory '" + + OUStringToOString(aTmpDir, RTL_TEXTENCODING_ASCII_US) + + "' and check its existence."; CPPUNIT_ASSERT_EQUAL_MESSAGE(sError.getStr(), osl::FileBase::E_None, nError1); osl_setFileAttributes(aTmpDir.pData, 0); // no access allowed now @@ -4789,9 +4787,9 @@ namespace osl_Directory osl_File_Attribute_OwnWrite | osl_File_Attribute_OwnExe); deleteTestDirectory(aTmpDir); - sError = OString("test for create function: create a directory under '"); - sError += OUStringToOString(aTmpDir, RTL_TEXTENCODING_ASCII_US); - sError += "' for access test."; + sError = OString("test for create function: create a directory under '") + + OUStringToOString(aTmpDir, RTL_TEXTENCODING_ASCII_US) + + "' for access test."; CPPUNIT_ASSERT_EQUAL_MESSAGE(sError.getStr(), osl::FileBase::E_ACCES, nError1); #endif } @@ -4888,8 +4886,8 @@ namespace osl_Directory nError1 = Directory::remove(aTmpName3); deleteTestFile(aTmpName4); deleteTestDirectory(aTmpName3); - OString sError = "test for remove function: try to remove a directory that is not empty."; - sError += errorToStr(nError1).getStr(); + OString sError = "test for remove function: try to remove a directory that is not empty." + + errorToStr(nError1); #if defined(__sun) // on UNX, the implementation uses rmdir(), which EEXIST is thrown on Solaris when the directory is not empty, refer to: 'man -s 2 rmdir', while on linux, ENOTEMPTY is thrown. // EEXIST The directory contains entries other than those for "." and "..". |