Fix #1164 (unit test failures on various platforms)
This commit is contained in:
parent
6a8bbcd21e
commit
2034c41957
@ -17,19 +17,25 @@ TEST(strError, returnSuccessAfterClosingFile)
|
|||||||
// by a successful system call
|
// by a successful system call
|
||||||
// -> reset errno so that a real failure is only detected here
|
// -> reset errno so that a real failure is only detected here
|
||||||
errno = 0;
|
errno = 0;
|
||||||
|
|
||||||
std::string tmpFile("tmp.dat");
|
std::string tmpFile("tmp.dat");
|
||||||
std::ofstream auxFile(tmpFile.c_str());
|
std::ofstream auxFile(tmpFile.c_str());
|
||||||
auxFile.close();
|
auxFile.close();
|
||||||
#ifdef _WIN32
|
#if defined(_WIN32) || defined(__CYGWIN__) || defined(__MINGW__) || defined(__MSYS__)
|
||||||
const char * expectedString = "No error (errno = 0)";
|
const char * expectedString = "No error (errno = 0)";
|
||||||
#elif __APPLE__
|
#elif defined(__APPLE__)
|
||||||
|
const char * expectedString = "Undefined error: 0 (errno = 0)";
|
||||||
|
#elif defined(__sun__)
|
||||||
|
const char * expectedString = "Error 0 (errno = 0)";
|
||||||
|
#elif defined(__FreeBSD__)
|
||||||
|
const char * expectedString = "No error: 0 (errno = 0)";
|
||||||
|
#elif defined(__NetBSD__)
|
||||||
const char * expectedString = "Undefined error: 0 (errno = 0)";
|
const char * expectedString = "Undefined error: 0 (errno = 0)";
|
||||||
#else
|
#else
|
||||||
const char * expectedString = "Success (errno = 0)";
|
const char * expectedString = "Success (errno = 0)";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ASSERT_STREQ(expectedString, strError().c_str());
|
|
||||||
std::remove(tmpFile.c_str());
|
std::remove(tmpFile.c_str());
|
||||||
|
ASSERT_STREQ(expectedString, strError().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(strError, returnNoSuchFileOrDirectoryWhenTryingToOpenNonExistingFile)
|
TEST(strError, returnNoSuchFileOrDirectoryWhenTryingToOpenNonExistingFile)
|
||||||
@ -41,9 +47,17 @@ TEST(strError, returnNoSuchFileOrDirectoryWhenTryingToOpenNonExistingFile)
|
|||||||
TEST(strError, doNotRecognizeUnknownError)
|
TEST(strError, doNotRecognizeUnknownError)
|
||||||
{
|
{
|
||||||
errno = 9999;
|
errno = 9999;
|
||||||
#ifdef _WIN32
|
#if defined(__MINGW__) || defined(__MSYS__) || defined(__CYGWIN__)
|
||||||
|
const char * expectedString = "Unknown error 9999 (errno = 9999)";
|
||||||
|
#elif defined(_WIN32)
|
||||||
const char * expectedString = "Unknown error (errno = 9999)";
|
const char * expectedString = "Unknown error (errno = 9999)";
|
||||||
#elif __APPLE__
|
#elif defined(__APPLE__)
|
||||||
|
const char * expectedString = "Unknown error: 9999 (errno = 9999)";
|
||||||
|
#elif defined(__sun__)
|
||||||
|
const char * expectedString = "Unknown error (errno = 9999)";
|
||||||
|
#elif defined(__FreeBSD__)
|
||||||
|
const char * expectedString = "Unknown error: 9999 (errno = 9999)";
|
||||||
|
#elif defined(__NetBSD__)
|
||||||
const char * expectedString = "Unknown error: 9999 (errno = 9999)";
|
const char * expectedString = "Unknown error: 9999 (errno = 9999)";
|
||||||
#else
|
#else
|
||||||
const char * expectedString = "Unknown error 9999 (errno = 9999)";
|
const char * expectedString = "Unknown error 9999 (errno = 9999)";
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user