mirror of https://github.com/google/googletest.git
Remove obsolete Borland C++ workarounds in googletest
Classic Borland C++ (bcc32) only supported up to C++98/C++03 before Embarcadero transitioned C++Builder to Clang-based compilers (bcc32c/bcc64, which define __clang__) and is long obsolete. PiperOrigin-RevId: 974883761 Change-Id: I220f736485710f37fe4a2b922bda3116304e3812
This commit is contained in:
parent
3b49a56fe3
commit
5f31f20eda
|
|
@ -448,14 +448,6 @@ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION;
|
||||||
#if defined(_MSC_VER) && defined(_CPPUNWIND)
|
#if defined(_MSC_VER) && defined(_CPPUNWIND)
|
||||||
// MSVC defines _CPPUNWIND to 1 if and only if exceptions are enabled.
|
// MSVC defines _CPPUNWIND to 1 if and only if exceptions are enabled.
|
||||||
#define GTEST_HAS_EXCEPTIONS 1
|
#define GTEST_HAS_EXCEPTIONS 1
|
||||||
#elif defined(__BORLANDC__)
|
|
||||||
// C++Builder's implementation of the STL uses the _HAS_EXCEPTIONS
|
|
||||||
// macro to enable exceptions, so we'll do the same.
|
|
||||||
// Assumes that exceptions are enabled by default.
|
|
||||||
#ifndef _HAS_EXCEPTIONS
|
|
||||||
#define _HAS_EXCEPTIONS 1
|
|
||||||
#endif // _HAS_EXCEPTIONS
|
|
||||||
#define GTEST_HAS_EXCEPTIONS _HAS_EXCEPTIONS
|
|
||||||
#elif defined(__clang__)
|
#elif defined(__clang__)
|
||||||
// clang defines __EXCEPTIONS if and only if exceptions are enabled before clang
|
// clang defines __EXCEPTIONS if and only if exceptions are enabled before clang
|
||||||
// 220714, but if and only if cleanups are enabled after that. In Obj-C++ files,
|
// 220714, but if and only if cleanups are enabled after that. In Obj-C++ files,
|
||||||
|
|
@ -480,7 +472,7 @@ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION;
|
||||||
// For other compilers, we assume exceptions are disabled to be
|
// For other compilers, we assume exceptions are disabled to be
|
||||||
// conservative.
|
// conservative.
|
||||||
#define GTEST_HAS_EXCEPTIONS 0
|
#define GTEST_HAS_EXCEPTIONS 0
|
||||||
#endif // defined(_MSC_VER) || defined(__BORLANDC__)
|
#endif // defined(_MSC_VER) && defined(_CPPUNWIND)
|
||||||
#endif // GTEST_HAS_EXCEPTIONS
|
#endif // GTEST_HAS_EXCEPTIONS
|
||||||
|
|
||||||
// MSVC either defines wchar_t as a typedef of unsigned short, or as a native
|
// MSVC either defines wchar_t as a typedef of unsigned short, or as a native
|
||||||
|
|
@ -849,8 +841,7 @@ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION;
|
||||||
#ifndef GTEST_HAS_SEH
|
#ifndef GTEST_HAS_SEH
|
||||||
// The user didn't tell us, so we need to figure it out.
|
// The user didn't tell us, so we need to figure it out.
|
||||||
|
|
||||||
#if defined(_MSC_VER) || defined(__BORLANDC__)
|
#ifdef _MSC_VER
|
||||||
// These two compilers are known to support SEH.
|
|
||||||
#define GTEST_HAS_SEH 1
|
#define GTEST_HAS_SEH 1
|
||||||
#else
|
#else
|
||||||
// Assume no SEH.
|
// Assume no SEH.
|
||||||
|
|
@ -2128,12 +2119,6 @@ inline bool IsDir(const StatStruct& st) { return S_ISDIR(st.st_mode); }
|
||||||
|
|
||||||
#ifdef GTEST_OS_WINDOWS
|
#ifdef GTEST_OS_WINDOWS
|
||||||
|
|
||||||
#ifdef __BORLANDC__
|
|
||||||
inline int DoIsATTY(int fd) { return isatty(fd); }
|
|
||||||
inline int StrCaseCmp(const char* s1, const char* s2) {
|
|
||||||
return stricmp(s1, s2);
|
|
||||||
}
|
|
||||||
#else // !__BORLANDC__
|
|
||||||
#if defined(GTEST_OS_WINDOWS_MOBILE) || defined(GTEST_OS_ZOS) || \
|
#if defined(GTEST_OS_WINDOWS_MOBILE) || defined(GTEST_OS_ZOS) || \
|
||||||
defined(GTEST_OS_IOS) || defined(GTEST_OS_WINDOWS_PHONE) || \
|
defined(GTEST_OS_IOS) || defined(GTEST_OS_WINDOWS_PHONE) || \
|
||||||
defined(GTEST_OS_WINDOWS_RT) || defined(ESP_PLATFORM)
|
defined(GTEST_OS_WINDOWS_RT) || defined(ESP_PLATFORM)
|
||||||
|
|
@ -2144,7 +2129,6 @@ inline int DoIsATTY(int fd) { return _isatty(fd); }
|
||||||
inline int StrCaseCmp(const char* s1, const char* s2) {
|
inline int StrCaseCmp(const char* s1, const char* s2) {
|
||||||
return _stricmp(s1, s2);
|
return _stricmp(s1, s2);
|
||||||
}
|
}
|
||||||
#endif // __BORLANDC__
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
|
@ -2246,11 +2230,6 @@ inline const char* GetEnv(const char* name) {
|
||||||
// We are on an embedded platform, which has no environment variables.
|
// We are on an embedded platform, which has no environment variables.
|
||||||
static_cast<void>(name); // To prevent 'unused argument' warning.
|
static_cast<void>(name); // To prevent 'unused argument' warning.
|
||||||
return nullptr;
|
return nullptr;
|
||||||
#elif defined(__BORLANDC__)
|
|
||||||
// Environment variables which we programmatically clear will be set to the
|
|
||||||
// empty string rather than unset (NULL). Handle that case.
|
|
||||||
const char* const env = getenv(name);
|
|
||||||
return (env != nullptr && env[0] != '\0') ? env : nullptr;
|
|
||||||
#else
|
#else
|
||||||
return getenv(name);
|
return getenv(name);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -43,11 +43,6 @@
|
||||||
#ifndef GOOGLETEST_INCLUDE_GTEST_INTERNAL_GTEST_STRING_H_
|
#ifndef GOOGLETEST_INCLUDE_GTEST_INTERNAL_GTEST_STRING_H_
|
||||||
#define GOOGLETEST_INCLUDE_GTEST_INTERNAL_GTEST_STRING_H_
|
#define GOOGLETEST_INCLUDE_GTEST_INTERNAL_GTEST_STRING_H_
|
||||||
|
|
||||||
#ifdef __BORLANDC__
|
|
||||||
// string.h is not guaranteed to provide strcpy on C++ Builder.
|
|
||||||
#include <mem.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
|
||||||
|
|
@ -1242,14 +1242,14 @@ static std::string GetCapturedStream(CapturedStream** captured_stream) {
|
||||||
return content;
|
return content;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(_MSC_VER) || defined(__BORLANDC__)
|
#if defined(_MSC_VER)
|
||||||
// MSVC and C++Builder do not provide a definition of STDERR_FILENO.
|
// MSVC does not provide a definition of STDERR_FILENO.
|
||||||
const int kStdOutFileno = 1;
|
const int kStdOutFileno = 1;
|
||||||
const int kStdErrFileno = 2;
|
const int kStdErrFileno = 2;
|
||||||
#else
|
#else
|
||||||
const int kStdOutFileno = STDOUT_FILENO;
|
const int kStdOutFileno = STDOUT_FILENO;
|
||||||
const int kStdErrFileno = STDERR_FILENO;
|
const int kStdErrFileno = STDERR_FILENO;
|
||||||
#endif // defined(_MSC_VER) || defined(__BORLANDC__)
|
#endif // defined(_MSC_VER)
|
||||||
|
|
||||||
// Starts capturing stdout.
|
// Starts capturing stdout.
|
||||||
void CaptureStdout() {
|
void CaptureStdout() {
|
||||||
|
|
|
||||||
|
|
@ -5289,17 +5289,8 @@ void TestEventListeners::SuppressEventForwarding(bool suppress) {
|
||||||
// call this before main() starts, from which point on the return
|
// call this before main() starts, from which point on the return
|
||||||
// value will never change.
|
// value will never change.
|
||||||
UnitTest* UnitTest::GetInstance() {
|
UnitTest* UnitTest::GetInstance() {
|
||||||
// CodeGear C++Builder insists on a public destructor for the
|
|
||||||
// default implementation. Use this implementation to keep good OO
|
|
||||||
// design with private destructor.
|
|
||||||
|
|
||||||
#if defined(__BORLANDC__)
|
|
||||||
static UnitTest* const instance = new UnitTest;
|
|
||||||
return instance;
|
|
||||||
#else
|
|
||||||
static UnitTest instance;
|
static UnitTest instance;
|
||||||
return &instance;
|
return &instance;
|
||||||
#endif // defined(__BORLANDC__)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Gets the number of successful test suites.
|
// Gets the number of successful test suites.
|
||||||
|
|
|
||||||
|
|
@ -537,11 +537,6 @@ TEST_F(FormatEpochTimeInMillisAsIso8601Test, PrintsEpochStart) {
|
||||||
|
|
||||||
#endif // __EMSCRIPTEN__
|
#endif // __EMSCRIPTEN__
|
||||||
|
|
||||||
#ifdef __BORLANDC__
|
|
||||||
// Silences warnings: "Condition is always true", "Unreachable code"
|
|
||||||
#pragma option push -w-ccc -w-rch
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Tests that the LHS of EXPECT_EQ or ASSERT_EQ can be used as a null literal
|
// Tests that the LHS of EXPECT_EQ or ASSERT_EQ can be used as a null literal
|
||||||
// when the RHS is a pointer type.
|
// when the RHS is a pointer type.
|
||||||
TEST(NullLiteralTest, LHSAllowsNullLiterals) {
|
TEST(NullLiteralTest, LHSAllowsNullLiterals) {
|
||||||
|
|
@ -612,11 +607,6 @@ TEST(NullLiteralTest, NoConversionNoWarning) {
|
||||||
#pragma clang diagnostic pop
|
#pragma clang diagnostic pop
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __BORLANDC__
|
|
||||||
// Restores warnings after previous "#pragma option push" suppressed them.
|
|
||||||
#pragma option pop
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Tests CodePointToUtf8().
|
// Tests CodePointToUtf8().
|
||||||
|
|
||||||
|
|
@ -1276,11 +1266,6 @@ TEST_F(ExpectFatalFailureTest, CatchesFatalFailureOnAllThreads) {
|
||||||
"Expected fatal failure.");
|
"Expected fatal failure.");
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __BORLANDC__
|
|
||||||
// Silences warnings: "Condition is always true"
|
|
||||||
#pragma option push -w-ccc
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Tests that EXPECT_FATAL_FAILURE() can be used in a non-void
|
// Tests that EXPECT_FATAL_FAILURE() can be used in a non-void
|
||||||
// function even when the statement in it contains ASSERT_*.
|
// function even when the statement in it contains ASSERT_*.
|
||||||
|
|
||||||
|
|
@ -1304,11 +1289,6 @@ void DoesNotAbortHelper(bool* aborted) {
|
||||||
*aborted = false;
|
*aborted = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __BORLANDC__
|
|
||||||
// Restores warnings after previous "#pragma option push" suppressed them.
|
|
||||||
#pragma option pop
|
|
||||||
#endif
|
|
||||||
|
|
||||||
TEST_F(ExpectFatalFailureTest, DoesNotAbort) {
|
TEST_F(ExpectFatalFailureTest, DoesNotAbort) {
|
||||||
bool aborted = true;
|
bool aborted = true;
|
||||||
DoesNotAbortHelper(&aborted);
|
DoesNotAbortHelper(&aborted);
|
||||||
|
|
@ -1323,15 +1303,12 @@ static int global_var = 0;
|
||||||
#define GTEST_USE_UNPROTECTED_COMMA_ global_var++, global_var++
|
#define GTEST_USE_UNPROTECTED_COMMA_ global_var++, global_var++
|
||||||
|
|
||||||
TEST_F(ExpectFatalFailureTest, AcceptsMacroThatExpandsToUnprotectedComma) {
|
TEST_F(ExpectFatalFailureTest, AcceptsMacroThatExpandsToUnprotectedComma) {
|
||||||
#ifndef __BORLANDC__
|
|
||||||
// ICE's in C++Builder.
|
|
||||||
EXPECT_FATAL_FAILURE(
|
EXPECT_FATAL_FAILURE(
|
||||||
{
|
{
|
||||||
GTEST_USE_UNPROTECTED_COMMA_;
|
GTEST_USE_UNPROTECTED_COMMA_;
|
||||||
AddFatalFailure();
|
AddFatalFailure();
|
||||||
},
|
},
|
||||||
"");
|
"");
|
||||||
#endif
|
|
||||||
|
|
||||||
EXPECT_FATAL_FAILURE_ON_ALL_THREADS(
|
EXPECT_FATAL_FAILURE_ON_ALL_THREADS(
|
||||||
{
|
{
|
||||||
|
|
@ -1712,26 +1689,6 @@ static void SetEnv(const char* name, const char* value) {
|
||||||
#ifdef GTEST_OS_WINDOWS_MOBILE
|
#ifdef GTEST_OS_WINDOWS_MOBILE
|
||||||
// Environment variables are not supported on Windows CE.
|
// Environment variables are not supported on Windows CE.
|
||||||
return;
|
return;
|
||||||
#elif defined(__BORLANDC__)
|
|
||||||
// C++Builder's putenv only stores a pointer to its parameter; we have to
|
|
||||||
// ensure that the string remains valid as long as it might be needed.
|
|
||||||
// We use an std::map to do so.
|
|
||||||
static std::map<std::string, std::string*> added_env;
|
|
||||||
|
|
||||||
// Because putenv stores a pointer to the string buffer, we can't delete the
|
|
||||||
// previous string (if present) until after it's replaced.
|
|
||||||
std::string* prev_env = NULL;
|
|
||||||
if (added_env.find(name) != added_env.end()) {
|
|
||||||
prev_env = added_env[name];
|
|
||||||
}
|
|
||||||
added_env[name] =
|
|
||||||
new std::string((Message() << name << "=" << value).GetString());
|
|
||||||
|
|
||||||
// The standard signature of putenv accepts a 'char*' argument. Other
|
|
||||||
// implementations, like C++Builder's, accept a 'const char*'.
|
|
||||||
// We cast away the 'const' since that would work for both variants.
|
|
||||||
putenv(const_cast<char*>(added_env[name]->c_str()));
|
|
||||||
delete prev_env;
|
|
||||||
#elif defined(GTEST_OS_WINDOWS) // If we are on Windows proper.
|
#elif defined(GTEST_OS_WINDOWS) // If we are on Windows proper.
|
||||||
_putenv((Message() << name << "=" << value).GetString().c_str());
|
_putenv((Message() << name << "=" << value).GetString().c_str());
|
||||||
#else
|
#else
|
||||||
|
|
@ -3709,11 +3666,6 @@ TEST(AssertionTest, AppendUserMessage) {
|
||||||
EXPECT_STREQ("foo\nbar", AppendUserMessage(foo, msg).c_str());
|
EXPECT_STREQ("foo\nbar", AppendUserMessage(foo, msg).c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __BORLANDC__
|
|
||||||
// Silences warnings: "Condition is always true", "Unreachable code"
|
|
||||||
#pragma option push -w-ccc -w-rch
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Tests ASSERT_TRUE.
|
// Tests ASSERT_TRUE.
|
||||||
TEST(AssertionTest, ASSERT_TRUE) {
|
TEST(AssertionTest, ASSERT_TRUE) {
|
||||||
ASSERT_TRUE(2 > 1); // NOLINT
|
ASSERT_TRUE(2 > 1); // NOLINT
|
||||||
|
|
@ -3732,13 +3684,10 @@ TEST(AssertionTest, ASSERT_TRUE) {
|
||||||
// Tests ASSERT_TRUE(predicate) for predicates returning AssertionResult.
|
// Tests ASSERT_TRUE(predicate) for predicates returning AssertionResult.
|
||||||
TEST(AssertionTest, AssertTrueWithAssertionResult) {
|
TEST(AssertionTest, AssertTrueWithAssertionResult) {
|
||||||
ASSERT_TRUE(ResultIsEven(2));
|
ASSERT_TRUE(ResultIsEven(2));
|
||||||
#ifndef __BORLANDC__
|
|
||||||
// ICE's in C++Builder.
|
|
||||||
EXPECT_FATAL_FAILURE(ASSERT_TRUE(ResultIsEven(3)),
|
EXPECT_FATAL_FAILURE(ASSERT_TRUE(ResultIsEven(3)),
|
||||||
"Value of: ResultIsEven(3)\n"
|
"Value of: ResultIsEven(3)\n"
|
||||||
" Actual: false (3 is odd)\n"
|
" Actual: false (3 is odd)\n"
|
||||||
"Expected: true");
|
"Expected: true");
|
||||||
#endif
|
|
||||||
ASSERT_TRUE(ResultIsEvenNoExplanation(2));
|
ASSERT_TRUE(ResultIsEvenNoExplanation(2));
|
||||||
EXPECT_FATAL_FAILURE(ASSERT_TRUE(ResultIsEvenNoExplanation(3)),
|
EXPECT_FATAL_FAILURE(ASSERT_TRUE(ResultIsEvenNoExplanation(3)),
|
||||||
"Value of: ResultIsEvenNoExplanation(3)\n"
|
"Value of: ResultIsEvenNoExplanation(3)\n"
|
||||||
|
|
@ -3767,13 +3716,10 @@ TEST(AssertionTest, ASSERT_FALSE) {
|
||||||
// Tests ASSERT_FALSE(predicate) for predicates returning AssertionResult.
|
// Tests ASSERT_FALSE(predicate) for predicates returning AssertionResult.
|
||||||
TEST(AssertionTest, AssertFalseWithAssertionResult) {
|
TEST(AssertionTest, AssertFalseWithAssertionResult) {
|
||||||
ASSERT_FALSE(ResultIsEven(3));
|
ASSERT_FALSE(ResultIsEven(3));
|
||||||
#ifndef __BORLANDC__
|
|
||||||
// ICE's in C++Builder.
|
|
||||||
EXPECT_FATAL_FAILURE(ASSERT_FALSE(ResultIsEven(2)),
|
EXPECT_FATAL_FAILURE(ASSERT_FALSE(ResultIsEven(2)),
|
||||||
"Value of: ResultIsEven(2)\n"
|
"Value of: ResultIsEven(2)\n"
|
||||||
" Actual: true (2 is even)\n"
|
" Actual: true (2 is even)\n"
|
||||||
"Expected: false");
|
"Expected: false");
|
||||||
#endif
|
|
||||||
ASSERT_FALSE(ResultIsEvenNoExplanation(3));
|
ASSERT_FALSE(ResultIsEvenNoExplanation(3));
|
||||||
EXPECT_FATAL_FAILURE(ASSERT_FALSE(ResultIsEvenNoExplanation(2)),
|
EXPECT_FATAL_FAILURE(ASSERT_FALSE(ResultIsEvenNoExplanation(2)),
|
||||||
"Value of: ResultIsEvenNoExplanation(2)\n"
|
"Value of: ResultIsEvenNoExplanation(2)\n"
|
||||||
|
|
@ -3781,11 +3727,6 @@ TEST(AssertionTest, AssertFalseWithAssertionResult) {
|
||||||
"Expected: false");
|
"Expected: false");
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __BORLANDC__
|
|
||||||
// Restores warnings after previous "#pragma option push" suppressed them
|
|
||||||
#pragma option pop
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Tests using ASSERT_EQ on double values. The purpose is to make
|
// Tests using ASSERT_EQ on double values. The purpose is to make
|
||||||
// sure that the specialization we did for integer and anonymous enums
|
// sure that the specialization we did for integer and anonymous enums
|
||||||
// isn't used for double arguments.
|
// isn't used for double arguments.
|
||||||
|
|
@ -3876,9 +3817,6 @@ void ThrowNothing() {}
|
||||||
TEST(AssertionTest, ASSERT_THROW) {
|
TEST(AssertionTest, ASSERT_THROW) {
|
||||||
ASSERT_THROW(ThrowAnInteger(), int);
|
ASSERT_THROW(ThrowAnInteger(), int);
|
||||||
|
|
||||||
#ifndef __BORLANDC__
|
|
||||||
|
|
||||||
// ICE's in C++Builder 2007 and 2009.
|
|
||||||
EXPECT_FATAL_FAILURE(
|
EXPECT_FATAL_FAILURE(
|
||||||
ASSERT_THROW(ThrowAnInteger(), bool),
|
ASSERT_THROW(ThrowAnInteger(), bool),
|
||||||
"Expected: ThrowAnInteger() throws an exception of type bool.\n"
|
"Expected: ThrowAnInteger() throws an exception of type bool.\n"
|
||||||
|
|
@ -3890,7 +3828,6 @@ TEST(AssertionTest, ASSERT_THROW) {
|
||||||
"Actual: it throws " ERROR_DESC
|
"Actual: it throws " ERROR_DESC
|
||||||
" "
|
" "
|
||||||
"with description \"A description\".");
|
"with description \"A description\".");
|
||||||
#endif
|
|
||||||
|
|
||||||
EXPECT_FATAL_FAILURE(
|
EXPECT_FATAL_FAILURE(
|
||||||
ASSERT_THROW(ThrowNothing(), bool),
|
ASSERT_THROW(ThrowNothing(), bool),
|
||||||
|
|
@ -4059,12 +3996,8 @@ TEST(AssertionTest, AnonymousEnum) {
|
||||||
ASSERT_GT(kCaseB, kCaseA);
|
ASSERT_GT(kCaseB, kCaseA);
|
||||||
ASSERT_GE(kCaseA, kCaseA);
|
ASSERT_GE(kCaseA, kCaseA);
|
||||||
|
|
||||||
#ifndef __BORLANDC__
|
|
||||||
|
|
||||||
// ICE's in C++Builder.
|
|
||||||
EXPECT_FATAL_FAILURE(ASSERT_EQ(kCaseA, kCaseB), " kCaseB\n Which is: ");
|
EXPECT_FATAL_FAILURE(ASSERT_EQ(kCaseA, kCaseB), " kCaseB\n Which is: ");
|
||||||
EXPECT_FATAL_FAILURE(ASSERT_EQ(kCaseA, kCaseC), "\n Which is: 42");
|
EXPECT_FATAL_FAILURE(ASSERT_EQ(kCaseA, kCaseC), "\n Which is: 42");
|
||||||
#endif
|
|
||||||
|
|
||||||
EXPECT_FATAL_FAILURE(ASSERT_EQ(kCaseA, kCaseC), "\n Which is: -1");
|
EXPECT_FATAL_FAILURE(ASSERT_EQ(kCaseA, kCaseC), "\n Which is: -1");
|
||||||
}
|
}
|
||||||
|
|
@ -4113,13 +4046,9 @@ TEST(HRESULTAssertionTest, EXPECT_HRESULT_FAILED) {
|
||||||
TEST(HRESULTAssertionTest, ASSERT_HRESULT_FAILED) {
|
TEST(HRESULTAssertionTest, ASSERT_HRESULT_FAILED) {
|
||||||
ASSERT_HRESULT_FAILED(E_UNEXPECTED);
|
ASSERT_HRESULT_FAILED(E_UNEXPECTED);
|
||||||
|
|
||||||
#ifndef __BORLANDC__
|
|
||||||
|
|
||||||
// ICE's in C++Builder 2007 and 2009.
|
|
||||||
EXPECT_FATAL_FAILURE(ASSERT_HRESULT_FAILED(OkHRESULTSuccess()),
|
EXPECT_FATAL_FAILURE(ASSERT_HRESULT_FAILED(OkHRESULTSuccess()),
|
||||||
"Expected: (OkHRESULTSuccess()) fails.\n"
|
"Expected: (OkHRESULTSuccess()) fails.\n"
|
||||||
" Actual: 0x0");
|
" Actual: 0x0");
|
||||||
#endif
|
|
||||||
|
|
||||||
EXPECT_FATAL_FAILURE(ASSERT_HRESULT_FAILED(FalseHRESULTSuccess()),
|
EXPECT_FATAL_FAILURE(ASSERT_HRESULT_FAILED(FalseHRESULTSuccess()),
|
||||||
"Expected: (FalseHRESULTSuccess()) fails.\n"
|
"Expected: (FalseHRESULTSuccess()) fails.\n"
|
||||||
|
|
@ -4137,13 +4066,9 @@ TEST(HRESULTAssertionTest, Streaming) {
|
||||||
<< "expected failure",
|
<< "expected failure",
|
||||||
"expected failure");
|
"expected failure");
|
||||||
|
|
||||||
#ifndef __BORLANDC__
|
|
||||||
|
|
||||||
// ICE's in C++Builder 2007 and 2009.
|
|
||||||
EXPECT_FATAL_FAILURE(ASSERT_HRESULT_SUCCEEDED(E_UNEXPECTED)
|
EXPECT_FATAL_FAILURE(ASSERT_HRESULT_SUCCEEDED(E_UNEXPECTED)
|
||||||
<< "expected failure",
|
<< "expected failure",
|
||||||
"expected failure");
|
"expected failure");
|
||||||
#endif
|
|
||||||
|
|
||||||
EXPECT_NONFATAL_FAILURE(EXPECT_HRESULT_FAILED(S_OK) << "expected failure",
|
EXPECT_NONFATAL_FAILURE(EXPECT_HRESULT_FAILED(S_OK) << "expected failure",
|
||||||
"expected failure");
|
"expected failure");
|
||||||
|
|
@ -4521,11 +4446,6 @@ TEST(ExpectTest, ExpectFalseWithAssertionResult) {
|
||||||
"Expected: false");
|
"Expected: false");
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __BORLANDC__
|
|
||||||
// Restores warnings after previous "#pragma option push" suppressed them
|
|
||||||
#pragma option pop
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Tests EXPECT_EQ.
|
// Tests EXPECT_EQ.
|
||||||
TEST(ExpectTest, EXPECT_EQ) {
|
TEST(ExpectTest, EXPECT_EQ) {
|
||||||
EXPECT_EQ(5, 2 + 3);
|
EXPECT_EQ(5, 2 + 3);
|
||||||
|
|
@ -5038,13 +4958,10 @@ TEST(ComparisonAssertionTest, AcceptsUnprintableArgs) {
|
||||||
|
|
||||||
// Code tested by EXPECT_FATAL_FAILURE cannot reference local
|
// Code tested by EXPECT_FATAL_FAILURE cannot reference local
|
||||||
// variables, so we have to write UnprintableChar('x') instead of x.
|
// variables, so we have to write UnprintableChar('x') instead of x.
|
||||||
#ifndef __BORLANDC__
|
|
||||||
// ICE's in C++Builder.
|
|
||||||
EXPECT_FATAL_FAILURE(ASSERT_NE(UnprintableChar('x'), UnprintableChar('x')),
|
EXPECT_FATAL_FAILURE(ASSERT_NE(UnprintableChar('x'), UnprintableChar('x')),
|
||||||
"1-byte object <78>");
|
"1-byte object <78>");
|
||||||
EXPECT_FATAL_FAILURE(ASSERT_LE(UnprintableChar('y'), UnprintableChar('x')),
|
EXPECT_FATAL_FAILURE(ASSERT_LE(UnprintableChar('y'), UnprintableChar('x')),
|
||||||
"1-byte object <78>");
|
"1-byte object <78>");
|
||||||
#endif
|
|
||||||
EXPECT_FATAL_FAILURE(ASSERT_LE(UnprintableChar('y'), UnprintableChar('x')),
|
EXPECT_FATAL_FAILURE(ASSERT_LE(UnprintableChar('y'), UnprintableChar('x')),
|
||||||
"1-byte object <79>");
|
"1-byte object <79>");
|
||||||
EXPECT_FATAL_FAILURE(ASSERT_GE(UnprintableChar('x'), UnprintableChar('y')),
|
EXPECT_FATAL_FAILURE(ASSERT_GE(UnprintableChar('x'), UnprintableChar('y')),
|
||||||
|
|
@ -6537,11 +6454,6 @@ TEST(StreamingAssertionsTest, Unconditional) {
|
||||||
EXPECT_FATAL_FAILURE(FAIL() << "expected failure", "expected failure");
|
EXPECT_FATAL_FAILURE(FAIL() << "expected failure", "expected failure");
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __BORLANDC__
|
|
||||||
// Silences warnings: "Condition is always true", "Unreachable code"
|
|
||||||
#pragma option push -w-ccc -w-rch
|
|
||||||
#endif
|
|
||||||
|
|
||||||
TEST(StreamingAssertionsTest, Truth) {
|
TEST(StreamingAssertionsTest, Truth) {
|
||||||
EXPECT_TRUE(true) << "unexpected failure";
|
EXPECT_TRUE(true) << "unexpected failure";
|
||||||
ASSERT_TRUE(true) << "unexpected failure";
|
ASSERT_TRUE(true) << "unexpected failure";
|
||||||
|
|
@ -6560,11 +6472,6 @@ TEST(StreamingAssertionsTest, Truth2) {
|
||||||
"expected failure");
|
"expected failure");
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __BORLANDC__
|
|
||||||
// Restores warnings after previous "#pragma option push" suppressed them
|
|
||||||
#pragma option pop
|
|
||||||
#endif
|
|
||||||
|
|
||||||
TEST(StreamingAssertionsTest, IntegerEquals) {
|
TEST(StreamingAssertionsTest, IntegerEquals) {
|
||||||
EXPECT_EQ(1, 1) << "unexpected failure";
|
EXPECT_EQ(1, 1) << "unexpected failure";
|
||||||
ASSERT_EQ(1, 1) << "unexpected failure";
|
ASSERT_EQ(1, 1) << "unexpected failure";
|
||||||
|
|
@ -7488,10 +7395,8 @@ TEST(CopyArrayTest, WorksForDegeneratedArrays) {
|
||||||
TEST(CopyArrayTest, WorksForOneDimensionalArrays) {
|
TEST(CopyArrayTest, WorksForOneDimensionalArrays) {
|
||||||
const char a[3] = "hi";
|
const char a[3] = "hi";
|
||||||
int b[3];
|
int b[3];
|
||||||
#ifndef __BORLANDC__ // C++Builder cannot compile some array size deductions.
|
|
||||||
CopyArray(a, &b);
|
CopyArray(a, &b);
|
||||||
EXPECT_TRUE(ArrayEq(a, b));
|
EXPECT_TRUE(ArrayEq(a, b));
|
||||||
#endif
|
|
||||||
|
|
||||||
int c[3];
|
int c[3];
|
||||||
CopyArray(a, 3, c);
|
CopyArray(a, 3, c);
|
||||||
|
|
@ -7501,10 +7406,8 @@ TEST(CopyArrayTest, WorksForOneDimensionalArrays) {
|
||||||
TEST(CopyArrayTest, WorksForTwoDimensionalArrays) {
|
TEST(CopyArrayTest, WorksForTwoDimensionalArrays) {
|
||||||
const int a[2][3] = {{0, 1, 2}, {3, 4, 5}};
|
const int a[2][3] = {{0, 1, 2}, {3, 4, 5}};
|
||||||
int b[2][3];
|
int b[2][3];
|
||||||
#ifndef __BORLANDC__ // C++Builder cannot compile some array size deductions.
|
|
||||||
CopyArray(a, &b);
|
CopyArray(a, &b);
|
||||||
EXPECT_TRUE(ArrayEq(a, b));
|
EXPECT_TRUE(ArrayEq(a, b));
|
||||||
#endif
|
|
||||||
|
|
||||||
int c[2][3];
|
int c[2][3];
|
||||||
CopyArray(a, 2, c);
|
CopyArray(a, 2, c);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue