diff options
author | zhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925> | 2011-02-22 22:08:59 +0000 |
---|---|---|
committer | zhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925> | 2011-02-22 22:08:59 +0000 |
commit | ffeb11d14a890b902dbb26ff2296cda7bf2d31df (patch) | |
tree | fd0c02c85dbd0a7a96f6791f00bf11a3f0e5eba2 /test/gtest_unittest.cc | |
parent | 0980b4bd66b496074d9e34d9f05244e700e9406d (diff) | |
download | googletest-ffeb11d14a890b902dbb26ff2296cda7bf2d31df.tar.gz googletest-ffeb11d14a890b902dbb26ff2296cda7bf2d31df.tar.bz2 googletest-ffeb11d14a890b902dbb26ff2296cda7bf2d31df.zip |
Indents preprocessor directives.
Diffstat (limited to 'test/gtest_unittest.cc')
-rw-r--r-- | test/gtest_unittest.cc | 74 |
1 files changed, 45 insertions, 29 deletions
diff --git a/test/gtest_unittest.cc b/test/gtest_unittest.cc index 1069ecf8..3f0456e9 100644 --- a/test/gtest_unittest.cc +++ b/test/gtest_unittest.cc @@ -310,10 +310,10 @@ TEST(FormatTimeInMillisAsSecondsTest, FormatsNegativeNumber) { #if GTEST_CAN_COMPARE_NULL -#ifdef __BORLANDC__ +# ifdef __BORLANDC__ // Silences warnings: "Condition is always true", "Unreachable code" -#pragma option push -w-ccc -w-rch -#endif +# pragma option push -w-ccc -w-rch +# endif // Tests that GTEST_IS_NULL_LITERAL_(x) is true when x is a null // pointer literal. @@ -322,12 +322,15 @@ TEST(NullLiteralTest, IsTrueForNullLiterals) { EXPECT_TRUE(GTEST_IS_NULL_LITERAL_(0)); EXPECT_TRUE(GTEST_IS_NULL_LITERAL_(0U)); EXPECT_TRUE(GTEST_IS_NULL_LITERAL_(0L)); -#ifndef __BORLANDC__ + +# ifndef __BORLANDC__ + // Some compilers may fail to detect some null pointer literals; // as long as users of the framework don't use such literals, this // is harmless. EXPECT_TRUE(GTEST_IS_NULL_LITERAL_(1 - 1)); -#endif + +# endif } // Tests that GTEST_IS_NULL_LITERAL_(x) is false when x is not a null @@ -339,10 +342,10 @@ TEST(NullLiteralTest, IsFalseForNonNullLiterals) { EXPECT_FALSE(GTEST_IS_NULL_LITERAL_(static_cast<void*>(NULL))); } -#ifdef __BORLANDC__ +# ifdef __BORLANDC__ // Restores warnings after previous "#pragma option push" suppressed them. -#pragma option pop -#endif +# pragma option pop +# endif #endif // GTEST_CAN_COMPARE_NULL // @@ -1211,7 +1214,7 @@ TEST(StringTest, ShowWideCStringQuoted) { String::ShowWideCStringQuoted(L"foo").c_str()); } -#if GTEST_OS_WINDOWS_MOBILE +# if GTEST_OS_WINDOWS_MOBILE TEST(StringTest, AnsiAndUtf16Null) { EXPECT_EQ(NULL, String::AnsiToUtf16(NULL)); EXPECT_EQ(NULL, String::Utf16ToAnsi(NULL)); @@ -1234,7 +1237,7 @@ TEST(StringTest, AnsiAndUtf16ConvertPathChars) { EXPECT_EQ(0, wcsncmp(L".:\\ \"*?", utf16, 3)); delete [] utf16; } -#endif // GTEST_OS_WINDOWS_MOBILE +# endif // GTEST_OS_WINDOWS_MOBILE #endif // GTEST_OS_WINDOWS @@ -1368,7 +1371,7 @@ TEST_F(ExpectFatalFailureTest, CatchesFatalFailureOnAllThreads) { #ifdef __BORLANDC__ // Silences warnings: "Condition is always true" -#pragma option push -w-ccc +# pragma option push -w-ccc #endif // Tests that EXPECT_FATAL_FAILURE() can be used in a non-void @@ -1396,7 +1399,7 @@ void DoesNotAbortHelper(bool* aborted) { #ifdef __BORLANDC__ // Restores warnings after previous "#pragma option push" suppressed them. -#pragma option pop +# pragma option pop #endif TEST_F(ExpectFatalFailureTest, DoesNotAbort) { @@ -3534,7 +3537,7 @@ TEST(AssertionTest, AppendUserMessage) { #ifdef __BORLANDC__ // Silences warnings: "Condition is always true", "Unreachable code" -#pragma option push -w-ccc -w-rch +# pragma option push -w-ccc -w-rch #endif // Tests ASSERT_TRUE. @@ -3589,7 +3592,7 @@ TEST(AssertionTest, AssertFalseWithAssertionResult) { #ifdef __BORLANDC__ // Restores warnings after previous "#pragma option push" supressed them -#pragma option pop +# pragma option pop #endif // Tests using ASSERT_EQ on double values. The purpose is to make @@ -3692,13 +3695,14 @@ void ThrowNothing() {} TEST(AssertionTest, ASSERT_THROW) { ASSERT_THROW(ThrowAnInteger(), int); -#ifndef __BORLANDC__ +# ifndef __BORLANDC__ + // ICE's in C++Builder 2007 and 2009. EXPECT_FATAL_FAILURE( ASSERT_THROW(ThrowAnInteger(), bool), "Expected: ThrowAnInteger() throws an exception of type bool.\n" " Actual: it throws a different type."); -#endif +# endif EXPECT_FATAL_FAILURE( ASSERT_THROW(ThrowNothing(), bool), @@ -3826,7 +3830,9 @@ TEST(AssertionTest, NamedEnum) { // Tests using assertions with anonymous enums. enum { kCaseA = -1, -#if GTEST_OS_LINUX + +# if GTEST_OS_LINUX + // We want to test the case where the size of the anonymous enum is // larger than sizeof(int), to make sure our implementation of the // assertions doesn't truncate the enums. However, MSVC @@ -3837,16 +3843,22 @@ enum { // int size. We want to test whether this will confuse the // assertions. kCaseB = testing::internal::kMaxBiggestInt, -#else + +# else + kCaseB = INT_MAX, -#endif // GTEST_OS_LINUX + +# endif // GTEST_OS_LINUX + kCaseC = 42, }; TEST(AssertionTest, AnonymousEnum) { -#if GTEST_OS_LINUX +# if GTEST_OS_LINUX + EXPECT_EQ(static_cast<int>(kCaseA), static_cast<int>(kCaseB)); -#endif // GTEST_OS_LINUX + +# endif // GTEST_OS_LINUX EXPECT_EQ(kCaseA, kCaseA); EXPECT_NE(kCaseA, kCaseB); @@ -3925,12 +3937,14 @@ TEST(HRESULTAssertionTest, EXPECT_HRESULT_FAILED) { TEST(HRESULTAssertionTest, ASSERT_HRESULT_FAILED) { ASSERT_HRESULT_FAILED(E_UNEXPECTED); -#ifndef __BORLANDC__ +# ifndef __BORLANDC__ + // ICE's in C++Builder 2007 and 2009. EXPECT_FATAL_FAILURE(ASSERT_HRESULT_FAILED(OkHRESULTSuccess()), "Expected: (OkHRESULTSuccess()) fails.\n" " Actual: 0x00000000"); -#endif +# endif + EXPECT_FATAL_FAILURE(ASSERT_HRESULT_FAILED(FalseHRESULTSuccess()), "Expected: (FalseHRESULTSuccess()) fails.\n" " Actual: 0x00000001"); @@ -3947,12 +3961,13 @@ TEST(HRESULTAssertionTest, Streaming) { EXPECT_HRESULT_SUCCEEDED(E_UNEXPECTED) << "expected failure", "expected failure"); -#ifndef __BORLANDC__ +# ifndef __BORLANDC__ + // ICE's in C++Builder 2007 and 2009. EXPECT_FATAL_FAILURE( ASSERT_HRESULT_SUCCEEDED(E_UNEXPECTED) << "expected failure", "expected failure"); -#endif +# endif EXPECT_NONFATAL_FAILURE( EXPECT_HRESULT_FAILED(S_OK) << "expected failure", @@ -3967,7 +3982,7 @@ TEST(HRESULTAssertionTest, Streaming) { #ifdef __BORLANDC__ // Silences warnings: "Condition is always true", "Unreachable code" -#pragma option push -w-ccc -w-rch +# pragma option push -w-ccc -w-rch #endif // Tests that the assertion macros behave like single statements. @@ -4188,7 +4203,7 @@ TEST(ExpectTest, ExpectFalseWithAssertionResult) { #ifdef __BORLANDC__ // Restores warnings after previous "#pragma option push" supressed them -#pragma option pop +# pragma option pop #endif // Tests EXPECT_EQ. @@ -5426,6 +5441,7 @@ class InitGoogleTestTest : public Test { // This macro wraps TestParsingFlags s.t. the user doesn't need // to specify the array sizes. + #define GTEST_TEST_PARSING_FLAGS_(argv1, argv2, expected, should_print_help) \ TestParsingFlags(sizeof(argv1)/sizeof(*argv1) - 1, argv1, \ sizeof(argv2)/sizeof(*argv2) - 1, argv2, \ @@ -6239,7 +6255,7 @@ TEST(StreamingAssertionsTest, Unconditional) { #ifdef __BORLANDC__ // Silences warnings: "Condition is always true", "Unreachable code" -#pragma option push -w-ccc -w-rch +# pragma option push -w-ccc -w-rch #endif TEST(StreamingAssertionsTest, Truth) { @@ -6262,7 +6278,7 @@ TEST(StreamingAssertionsTest, Truth2) { #ifdef __BORLANDC__ // Restores warnings after previous "#pragma option push" supressed them -#pragma option pop +# pragma option pop #endif TEST(StreamingAssertionsTest, IntegerEquals) { |