aboutsummaryrefslogtreecommitdiffstats
path: root/test/gtest_unittest.cc
diff options
context:
space:
mode:
authorzhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925>2011-03-05 08:04:01 +0000
committerzhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925>2011-03-05 08:04:01 +0000
commit603533a0a4dcfc2ef33051b9ae8237568a19adc4 (patch)
tree38e1e22186034693ba63f609100fcd1d4cd6e368 /test/gtest_unittest.cc
parent66ac4909aea5c4dc9c43e6f11518c34049c6bd5e (diff)
downloadgoogletest-603533a0a4dcfc2ef33051b9ae8237568a19adc4.tar.gz
googletest-603533a0a4dcfc2ef33051b9ae8237568a19adc4.tar.bz2
googletest-603533a0a4dcfc2ef33051b9ae8237568a19adc4.zip
Fixes compatibility with Borland C++Builder. Original patch by Josh
Kelley. Simplified by Zhanyong Wan.
Diffstat (limited to 'test/gtest_unittest.cc')
-rw-r--r--test/gtest_unittest.cc25
1 files changed, 19 insertions, 6 deletions
diff --git a/test/gtest_unittest.cc b/test/gtest_unittest.cc
index e6619d57..46db38d4 100644
--- a/test/gtest_unittest.cc
+++ b/test/gtest_unittest.cc
@@ -1416,8 +1416,8 @@ static int global_var = 0;
#define GTEST_USE_UNPROTECTED_COMMA_ global_var++, global_var++
TEST_F(ExpectFatalFailureTest, AcceptsMacroThatExpandsToUnprotectedComma) {
-#if !defined(__BORLANDC__) || __BORLANDC__ >= 0x600
- // ICE's in C++Builder 2007.
+#ifndef __BORLANDC__
+ // ICE's in C++Builder.
EXPECT_FATAL_FAILURE({
GTEST_USE_UNPROTECTED_COMMA_;
AddFatalFailure();
@@ -3550,8 +3550,8 @@ TEST(AssertionTest, ASSERT_TRUE) {
// Tests ASSERT_TRUE(predicate) for predicates returning AssertionResult.
TEST(AssertionTest, AssertTrueWithAssertionResult) {
ASSERT_TRUE(ResultIsEven(2));
-#if !defined(__BORLANDC__) || __BORLANDC__ >= 0x600
- // ICE's in C++Builder 2007.
+#ifndef __BORLANDC__
+ // ICE's in C++Builder.
EXPECT_FATAL_FAILURE(ASSERT_TRUE(ResultIsEven(3)),
"Value of: ResultIsEven(3)\n"
" Actual: false (3 is odd)\n"
@@ -3576,8 +3576,8 @@ TEST(AssertionTest, ASSERT_FALSE) {
// Tests ASSERT_FALSE(predicate) for predicates returning AssertionResult.
TEST(AssertionTest, AssertFalseWithAssertionResult) {
ASSERT_FALSE(ResultIsEven(3));
-#if !defined(__BORLANDC__) || __BORLANDC__ >= 0x600
- // ICE's in C++Builder 2007.
+#ifndef __BORLANDC__
+ // ICE's in C++Builder.
EXPECT_FATAL_FAILURE(ASSERT_FALSE(ResultIsEven(2)),
"Value of: ResultIsEven(2)\n"
" Actual: true (2 is even)\n"
@@ -3877,10 +3877,16 @@ TEST(AssertionTest, AnonymousEnum) {
ASSERT_LE(kCaseA, kCaseB);
ASSERT_GT(kCaseB, kCaseA);
ASSERT_GE(kCaseA, kCaseA);
+
+# ifndef __BORLANDC__
+
+ // ICE's in C++Builder.
EXPECT_FATAL_FAILURE(ASSERT_EQ(kCaseA, kCaseB),
"Value of: kCaseB");
EXPECT_FATAL_FAILURE(ASSERT_EQ(kCaseA, kCaseC),
"Actual: 42");
+# endif
+
EXPECT_FATAL_FAILURE(ASSERT_EQ(kCaseA, kCaseC),
"Which is: -1");
}
@@ -4791,10 +4797,13 @@ TEST(ComparisonAssertionTest, AcceptsUnprintableArgs) {
// Code tested by EXPECT_FATAL_FAILURE cannot reference local
// 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')),
"1-byte object <78>");
EXPECT_FATAL_FAILURE(ASSERT_LE(UnprintableChar('y'), UnprintableChar('x')),
"1-byte object <78>");
+#endif
EXPECT_FATAL_FAILURE(ASSERT_LE(UnprintableChar('y'), UnprintableChar('x')),
"1-byte object <79>");
EXPECT_FATAL_FAILURE(ASSERT_GE(UnprintableChar('x'), UnprintableChar('y')),
@@ -7213,8 +7222,10 @@ TEST(CopyArrayTest, WorksForDegeneratedArrays) {
TEST(CopyArrayTest, WorksForOneDimensionalArrays) {
const char a[3] = "hi";
int b[3];
+#ifndef __BORLANDC__ // C++Builder cannot compile some array size deductions.
CopyArray(a, &b);
EXPECT_TRUE(ArrayEq(a, b));
+#endif
int c[3];
CopyArray(a, 3, c);
@@ -7224,8 +7235,10 @@ TEST(CopyArrayTest, WorksForOneDimensionalArrays) {
TEST(CopyArrayTest, WorksForTwoDimensionalArrays) {
const int a[2][3] = { { 0, 1, 2 }, { 3, 4, 5 } };
int b[2][3];
+#ifndef __BORLANDC__ // C++Builder cannot compile some array size deductions.
CopyArray(a, &b);
EXPECT_TRUE(ArrayEq(a, b));
+#endif
int c[2][3];
CopyArray(a, 2, c);