@@ -42,28 +42,8 @@ TEST(strError, returnSuccessAfterClosingFile)
4242 std::string tmpFile (" tmp.dat" );
4343 std::ofstream auxFile (tmpFile.c_str ());
4444 auxFile.close ();
45- bool useExactString{true };
46- #if defined(_WIN32) || defined(__CYGWIN__) || defined(__MINGW__) || defined(__MSYS__)
47- const char * expectedString = " No error (errno = 0)" ;
48- #elif defined(__APPLE__)
49- const char * expectedString = " Undefined error: 0 (errno = 0)" ;
50- #elif defined(__sun__)
51- const char * expectedString = " Error 0 (errno = 0)" ;
52- #elif defined(__FreeBSD__)
53- const char * expectedString = " No error: 0 (errno = 0)" ;
54- #elif defined(__NetBSD__)
55- const char * expectedString = " Undefined error: 0 (errno = 0)" ;
56- #else
57- // On Alpine we get 'No error information (errno = 0)' instead of 'Success (errno = 0)'
58- const char * expectedString = " (errno = 0)" ;
59- useExactString = false ;
60- #endif
6145 std::remove (tmpFile.c_str ());
62- if (useExactString) {
63- ASSERT_STREQ (expectedString, strError ().c_str ());
64- } else {
65- ASSERT_TRUE (strError ().find (expectedString) != std::string::npos);
66- }
46+ ASSERT_TRUE (strError ().find (" (errno = 0)" ) != std::string::npos);
6747}
6848
6949TEST (strError, returnNoSuchFileOrDirectoryWhenTryingToOpenNonExistingFile)
@@ -75,29 +55,7 @@ TEST(strError, returnNoSuchFileOrDirectoryWhenTryingToOpenNonExistingFile)
7555TEST (strError, doNotRecognizeUnknownError)
7656{
7757 errno = 9999 ;
78- bool useExactString{true };
79- #if defined(__MINGW__) || defined(__MSYS__) || defined(__CYGWIN__)
80- const char * expectedString = " Unknown error 9999 (errno = 9999)" ;
81- #elif defined(_WIN32)
82- const char * expectedString = " Unknown error (errno = 9999)" ;
83- #elif defined(__APPLE__)
84- const char * expectedString = " Unknown error: 9999 (errno = 9999)" ;
85- #elif defined(__sun__)
86- const char * expectedString = " Unknown error (errno = 9999)" ;
87- #elif defined(__FreeBSD__)
88- const char * expectedString = " Unknown error: 9999 (errno = 9999)" ;
89- #elif defined(__NetBSD__)
90- const char * expectedString = " Unknown error: 9999 (errno = 9999)" ;
91- #else
92- // On Alpine we get 'No error information (errno = 9999)' instead of 'Unknown error 9999 (errno = 9999)'
93- const char * expectedString = " (errno = 9999)" ;
94- useExactString = false ;
95- #endif
96- if (useExactString) {
97- ASSERT_STREQ (expectedString, strError ().c_str ());
98- } else {
99- ASSERT_TRUE (strError ().find (expectedString) != std::string::npos);
100- }
58+ ASSERT_TRUE (strError ().find (" (errno = 9999)" ) != std::string::npos);
10159}
10260
10361TEST (getEnv, getsDefaultValueWhenExpectedEnvVariableDoesNotExist)
0 commit comments