summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorzhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925>2011-02-22 22:08:59 +0000
committerzhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925>2011-02-22 22:08:59 +0000
commit733a54a398766289b74cf3daebe083d7115cf388 (patch)
treefd0c02c85dbd0a7a96f6791f00bf11a3f0e5eba2 /test
parent22d36b42fbb9db2e0c814a7a1cc9279153fdfa31 (diff)
downloadgoogletest-733a54a398766289b74cf3daebe083d7115cf388.tar.gz
Indents preprocessor directives.
git-svn-id: http://googletest.googlecode.com/svn/trunk@544 861a406c-534a-0410-8894-cb66d6ee9925
Diffstat (limited to 'test')
-rw-r--r--test/gtest-death-test_ex_test.cc18
-rw-r--r--test/gtest-death-test_test.cc128
-rw-r--r--test/gtest-filepath_test.cc20
-rw-r--r--test/gtest-options_test.cc4
-rw-r--r--test/gtest-param-test_test.cc32
-rw-r--r--test/gtest-port_test.cc14
-rw-r--r--test/gtest-printers_test.cc8
-rw-r--r--test/gtest_break_on_failure_unittest_.cc10
-rw-r--r--test/gtest_catch_exceptions_test_.cc6
-rw-r--r--test/gtest_output_test_.cc14
-rw-r--r--test/gtest_unittest.cc74
11 files changed, 187 insertions, 141 deletions
diff --git a/test/gtest-death-test_ex_test.cc b/test/gtest-death-test_ex_test.cc
index 71cc7a3..b50a13d 100644
--- a/test/gtest-death-test_ex_test.cc
+++ b/test/gtest-death-test_ex_test.cc
@@ -36,15 +36,15 @@
#if GTEST_HAS_DEATH_TEST
-#if GTEST_HAS_SEH
-#include <windows.h> // For RaiseException().
-#endif
+# if GTEST_HAS_SEH
+# include <windows.h> // For RaiseException().
+# endif
-#include "gtest/gtest-spi.h"
+# include "gtest/gtest-spi.h"
-#if GTEST_HAS_EXCEPTIONS
+# if GTEST_HAS_EXCEPTIONS
-#include <exception> // For std::exception.
+# include <exception> // For std::exception.
// Tests that death tests report thrown exceptions as failures and that the
// exceptions do not escape death test macros.
@@ -71,9 +71,9 @@ TEST(CxxExceptionDeathTest, PrintsMessageForStdExceptions) {
EXPECT_NONFATAL_FAILURE(EXPECT_DEATH(throw TestException(), ""),
"gtest-death-test_ex_test.cc");
}
-#endif // GTEST_HAS_EXCEPTIONS
+# endif // GTEST_HAS_EXCEPTIONS
-#if GTEST_HAS_SEH
+# if GTEST_HAS_SEH
// Tests that enabling interception of SEH exceptions with the
// catch_exceptions flag does not interfere with SEH exceptions being
// treated as death by death tests.
@@ -82,7 +82,7 @@ TEST(SehExceptionDeasTest, CatchExceptionsDoesNotInterfere) {
<< "with catch_exceptions "
<< (testing::GTEST_FLAG(catch_exceptions) ? "enabled" : "disabled");
}
-#endif
+# endif
#endif // GTEST_HAS_DEATH_TEST
diff --git a/test/gtest-death-test_test.cc b/test/gtest-death-test_test.cc
index 6cc017b..bcf8e2a 100644
--- a/test/gtest-death-test_test.cc
+++ b/test/gtest-death-test_test.cc
@@ -40,28 +40,28 @@ using testing::internal::AlwaysTrue;
#if GTEST_HAS_DEATH_TEST
-#if GTEST_OS_WINDOWS
-#include <direct.h> // For chdir().
-#else
-#include <unistd.h>
-#include <sys/wait.h> // For waitpid.
-#include <limits> // For std::numeric_limits.
-#endif // GTEST_OS_WINDOWS
+# if GTEST_OS_WINDOWS
+# include <direct.h> // For chdir().
+# else
+# include <unistd.h>
+# include <sys/wait.h> // For waitpid.
+# include <limits> // For std::numeric_limits.
+# endif // GTEST_OS_WINDOWS
-#include <limits.h>
-#include <signal.h>
-#include <stdio.h>
+# include <limits.h>
+# include <signal.h>
+# include <stdio.h>
-#include "gtest/gtest-spi.h"
+# include "gtest/gtest-spi.h"
// Indicates that this translation unit is part of Google Test's
// implementation. It must come before gtest-internal-inl.h is
// included, or there will be a compiler error. This trick is to
// prevent a user from accidentally including gtest-internal-inl.h in
// his code.
-#define GTEST_IMPLEMENTATION_ 1
-#include "src/gtest-internal-inl.h"
-#undef GTEST_IMPLEMENTATION_
+# define GTEST_IMPLEMENTATION_ 1
+# include "src/gtest-internal-inl.h"
+# undef GTEST_IMPLEMENTATION_
namespace posix = ::testing::internal::posix;
@@ -195,13 +195,17 @@ void DeathTestSubroutine() {
// Death in dbg, not opt.
int DieInDebugElse12(int* sideeffect) {
if (sideeffect) *sideeffect = 12;
-#ifndef NDEBUG
+
+# ifndef NDEBUG
+
DieInside("DieInDebugElse12");
-#endif // NDEBUG
+
+# endif // NDEBUG
+
return 12;
}
-#if GTEST_OS_WINDOWS
+# if GTEST_OS_WINDOWS
// Tests the ExitedWithCode predicate.
TEST(ExitStatusPredicateTest, ExitedWithCode) {
@@ -214,7 +218,7 @@ TEST(ExitStatusPredicateTest, ExitedWithCode) {
EXPECT_FALSE(testing::ExitedWithCode(1)(0));
}
-#else
+# else
// Returns the exit status of a process that calls _exit(2) with a
// given exit code. This is a helper function for the
@@ -273,7 +277,7 @@ TEST(ExitStatusPredicateTest, KilledBySignal) {
EXPECT_FALSE(pred_kill(status_segv));
}
-#endif // GTEST_OS_WINDOWS
+# endif // GTEST_OS_WINDOWS
// Tests that the death test macros expand to code which may or may not
// be followed by operator<<, and that in either case the complete text
@@ -305,7 +309,7 @@ void DieWithEmbeddedNul() {
_exit(1);
}
-#if GTEST_USES_PCRE
+# if GTEST_USES_PCRE
// Tests that EXPECT_DEATH and ASSERT_DEATH work when the error
// message has a NUL character in it.
TEST_F(TestForDeathTest, EmbeddedNulInMessage) {
@@ -314,17 +318,17 @@ TEST_F(TestForDeathTest, EmbeddedNulInMessage) {
EXPECT_DEATH(DieWithEmbeddedNul(), "my null world");
ASSERT_DEATH(DieWithEmbeddedNul(), "my null world");
}
-#endif // GTEST_USES_PCRE
+# endif // GTEST_USES_PCRE
// Tests that death test macros expand to code which interacts well with switch
// statements.
TEST_F(TestForDeathTest, SwitchStatement) {
// Microsoft compiler usually complains about switch statements without
// case labels. We suppress that warning for this test.
-#ifdef _MSC_VER
-#pragma warning(push)
-#pragma warning(disable: 4065)
-#endif // _MSC_VER
+# ifdef _MSC_VER
+# pragma warning(push)
+# pragma warning(disable: 4065)
+# endif // _MSC_VER
switch (0)
default:
@@ -334,9 +338,9 @@ TEST_F(TestForDeathTest, SwitchStatement) {
case 0:
EXPECT_DEATH(_exit(1), "") << "exit in switch case";
-#ifdef _MSC_VER
-#pragma warning(pop)
-#endif // _MSC_VER
+# ifdef _MSC_VER
+# pragma warning(pop)
+# endif // _MSC_VER
}
// Tests that a static member function can be used in a "fast" style
@@ -415,7 +419,7 @@ void SetPthreadFlag() {
} // namespace
-#if GTEST_HAS_CLONE && GTEST_HAS_PTHREAD
+# if GTEST_HAS_CLONE && GTEST_HAS_PTHREAD
TEST_F(TestForDeathTest, DoesNotExecuteAtforkHooks) {
if (!testing::GTEST_FLAG(death_test_use_fork)) {
@@ -427,7 +431,7 @@ TEST_F(TestForDeathTest, DoesNotExecuteAtforkHooks) {
}
}
-#endif // GTEST_HAS_CLONE && GTEST_HAS_PTHREAD
+# endif // GTEST_HAS_CLONE && GTEST_HAS_PTHREAD
// Tests that a method of another class can be used in a death test.
TEST_F(TestForDeathTest, MethodOfAnotherClass) {
@@ -449,10 +453,12 @@ TEST_F(TestForDeathTest, AcceptsAnythingConvertibleToRE) {
const testing::internal::RE regex(regex_c_str);
EXPECT_DEATH(GlobalFunction(), regex);
-#if GTEST_HAS_GLOBAL_STRING
+# if GTEST_HAS_GLOBAL_STRING
+
const string regex_str(regex_c_str);
EXPECT_DEATH(GlobalFunction(), regex_str);
-#endif // GTEST_HAS_GLOBAL_STRING
+
+# endif // GTEST_HAS_GLOBAL_STRING
const ::std::string regex_std_str(regex_c_str);
EXPECT_DEATH(GlobalFunction(), regex_std_str);
@@ -568,13 +574,17 @@ TEST_F(TestForDeathTest, TestExpectDebugDeath) {
EXPECT_DEBUG_DEATH(DieInDebugElse12(&sideeffect),
"death.*DieInDebugElse12");
-#ifdef NDEBUG
+# ifdef NDEBUG
+
// Checks that the assignment occurs in opt mode (sideeffect).
EXPECT_EQ(12, sideeffect);
-#else
+
+# else
+
// Checks that the assignment does not occur in dbg mode (no sideeffect).
EXPECT_EQ(0, sideeffect);
-#endif
+
+# endif
}
// Tests that ASSERT_DEBUG_DEATH works as expected
@@ -594,16 +604,20 @@ TEST_F(TestForDeathTest, TestAssertDebugDeath) {
EXPECT_EQ(12, sideeffect);
}, "death.*DieInDebugElse12");
-#ifdef NDEBUG
+# ifdef NDEBUG
+
// Checks that the assignment occurs in opt mode (sideeffect).
EXPECT_EQ(12, sideeffect);
-#else
+
+# else
+
// Checks that the assignment does not occur in dbg mode (no sideeffect).
EXPECT_EQ(0, sideeffect);
-#endif
+
+# endif
}
-#ifndef NDEBUG
+# ifndef NDEBUG
void ExpectDebugDeathHelper(bool* aborted) {
*aborted = true;
@@ -611,7 +625,7 @@ void ExpectDebugDeathHelper(bool* aborted) {
*aborted = false;
}
-#if GTEST_OS_WINDOWS
+# if GTEST_OS_WINDOWS
TEST(PopUpDeathTest, DoesNotShowPopUpOnAbort) {
printf("This test should be considered failing if it shows "
"any pop-up dialogs.\n");
@@ -622,7 +636,7 @@ TEST(PopUpDeathTest, DoesNotShowPopUpOnAbort) {
abort();
}, "");
}
-#endif // GTEST_OS_WINDOWS
+# endif // GTEST_OS_WINDOWS
// Tests that EXPECT_DEBUG_DEATH in debug mode does not abort
// the function.
@@ -647,19 +661,22 @@ TEST_F(TestForDeathTest, AssertDebugDeathAborts) {
EXPECT_TRUE(aborted);
}
-#endif // _NDEBUG
+# endif // _NDEBUG
// Tests the *_EXIT family of macros, using a variety of predicates.
static void TestExitMacros() {
EXPECT_EXIT(_exit(1), testing::ExitedWithCode(1), "");
ASSERT_EXIT(_exit(42), testing::ExitedWithCode(42), "");
-#if GTEST_OS_WINDOWS
+# if GTEST_OS_WINDOWS
+
// Of all signals effects on the process exit code, only those of SIGABRT
// are documented on Windows.
// See http://msdn.microsoft.com/en-us/library/dwwzkt4c(VS.71).aspx.
EXPECT_EXIT(raise(SIGABRT), testing::ExitedWithCode(3), "");
-#else
+
+# else
+
EXPECT_EXIT(raise(SIGKILL), testing::KilledBySignal(SIGKILL), "") << "foo";
ASSERT_EXIT(raise(SIGUSR2), testing::KilledBySignal(SIGUSR2), "") << "bar";
@@ -667,7 +684,8 @@ static void TestExitMacros() {
ASSERT_EXIT(_exit(0), testing::KilledBySignal(SIGSEGV), "")
<< "This failure is expected, too.";
}, "This failure is expected, too.");
-#endif // GTEST_OS_WINDOWS
+
+# endif // GTEST_OS_WINDOWS
EXPECT_NONFATAL_FAILURE({ // NOLINT
EXPECT_EXIT(raise(SIGSEGV), testing::ExitedWithCode(0), "")
@@ -1022,7 +1040,7 @@ TEST(GetLastErrnoDescription, GetLastErrnoDescriptionWorks) {
EXPECT_STREQ("", GetLastErrnoDescription().c_str());
}
-#if GTEST_OS_WINDOWS
+# if GTEST_OS_WINDOWS
TEST(AutoHandleTest, AutoHandleWorks) {
HANDLE handle = ::CreateEvent(NULL, FALSE, FALSE, NULL);
ASSERT_NE(INVALID_HANDLE_VALUE, handle);
@@ -1047,21 +1065,21 @@ TEST(AutoHandleTest, AutoHandleWorks) {
testing::internal::AutoHandle auto_handle2;
EXPECT_EQ(INVALID_HANDLE_VALUE, auto_handle2.Get());
}
-#endif // GTEST_OS_WINDOWS
+# endif // GTEST_OS_WINDOWS
-#if GTEST_OS_WINDOWS
+# if GTEST_OS_WINDOWS
typedef unsigned __int64 BiggestParsable;
typedef signed __int64 BiggestSignedParsable;
const BiggestParsable kBiggestParsableMax = ULLONG_MAX;
const BiggestSignedParsable kBiggestSignedParsableMax = LLONG_MAX;
-#else
+# else
typedef unsigned long long BiggestParsable;
typedef signed long long BiggestSignedParsable;
const BiggestParsable kBiggestParsableMax =
::std::numeric_limits<BiggestParsable>::max();
const BiggestSignedParsable kBiggestSignedParsableMax =
::std::numeric_limits<BiggestSignedParsable>::max();
-#endif // GTEST_OS_WINDOWS
+# endif // GTEST_OS_WINDOWS
TEST(ParseNaturalNumberTest, RejectsInvalidFormat) {
BiggestParsable result = 0;
@@ -1147,14 +1165,14 @@ TEST(ParseNaturalNumberTest, WorksForShorterIntegers) {
EXPECT_EQ(123, char_result);
}
-#if GTEST_OS_WINDOWS
+# if GTEST_OS_WINDOWS
TEST(EnvironmentTest, HandleFitsIntoSizeT) {
// TODO(vladl@google.com): Remove this test after this condition is verified
// in a static assertion in gtest-death-test.cc in the function
// GetStatusFileDescriptor.
ASSERT_TRUE(sizeof(HANDLE) <= sizeof(size_t));
}
-#endif // GTEST_OS_WINDOWS
+# endif // GTEST_OS_WINDOWS
// Tests that EXPECT_DEATH_IF_SUPPORTED/ASSERT_DEATH_IF_SUPPORTED trigger
// failures when death tests are available on the system.
@@ -1253,8 +1271,8 @@ TEST(ConditionalDeathMacrosSyntaxDeathTest, SwitchStatement) {
// Microsoft compiler usually complains about switch statements without
// case labels. We suppress that warning for this test.
#ifdef _MSC_VER
-#pragma warning(push)
-#pragma warning(disable: 4065)
+# pragma warning(push)
+# pragma warning(disable: 4065)
#endif // _MSC_VER
switch (0)
@@ -1267,7 +1285,7 @@ TEST(ConditionalDeathMacrosSyntaxDeathTest, SwitchStatement) {
EXPECT_DEATH_IF_SUPPORTED(_exit(1), "") << "exit in switch case";
#ifdef _MSC_VER
-#pragma warning(pop)
+# pragma warning(pop)
#endif // _MSC_VER
}
diff --git a/test/gtest-filepath_test.cc b/test/gtest-filepath_test.cc
index 549dcef..66d4118 100644
--- a/test/gtest-filepath_test.cc
+++ b/test/gtest-filepath_test.cc
@@ -51,9 +51,9 @@
#undef GTEST_IMPLEMENTATION_
#if GTEST_OS_WINDOWS_MOBILE
-#include <windows.h> // NOLINT
+# include <windows.h> // NOLINT
#elif GTEST_OS_WINDOWS
-#include <direct.h> // NOLINT
+# include <direct.h> // NOLINT
#endif // GTEST_OS_WINDOWS_MOBILE
namespace testing {
@@ -91,14 +91,18 @@ TEST(GetCurrentDirTest, ReturnsCurrentDir) {
const FilePath cwd = FilePath::GetCurrentDir();
posix::ChDir(original_dir.c_str());
-#if GTEST_OS_WINDOWS
+# if GTEST_OS_WINDOWS
+
// Skips the ":".
const char* const cwd_without_drive = strchr(cwd.c_str(), ':');
ASSERT_TRUE(cwd_without_drive != NULL);
EXPECT_STREQ(GTEST_PATH_SEP_, cwd_without_drive + 1);
-#else
+
+# else
+
EXPECT_STREQ(GTEST_PATH_SEP_, cwd.c_str());
-#endif
+
+# endif
}
#endif // GTEST_OS_WINDOWS_MOBILE
@@ -415,10 +419,12 @@ TEST(DirectoryTest, EmptyPathDirectoryDoesNotExist) {
TEST(DirectoryTest, CurrentDirectoryExists) {
#if GTEST_OS_WINDOWS // We are on Windows.
-#ifndef _WIN32_CE // Windows CE doesn't have a current directory.
+# ifndef _WIN32_CE // Windows CE doesn't have a current directory.
+
EXPECT_TRUE(FilePath(".").DirectoryExists());
EXPECT_TRUE(FilePath(".\\").DirectoryExists());
-#endif // _WIN32_CE
+
+# endif // _WIN32_CE
#else
EXPECT_TRUE(FilePath(".").DirectoryExists());
EXPECT_TRUE(FilePath("./").DirectoryExists());
diff --git a/test/gtest-options_test.cc b/test/gtest-options_test.cc
index 30b82f3..9e98f3f 100644
--- a/test/gtest-options_test.cc
+++ b/test/gtest-options_test.cc
@@ -41,9 +41,9 @@
#include "gtest/gtest.h"
#if GTEST_OS_WINDOWS_MOBILE
-#include <windows.h>
+# include <windows.h>
#elif GTEST_OS_WINDOWS
-#include <direct.h>
+# include <direct.h>
#endif // GTEST_OS_WINDOWS_MOBILE
// Indicates that this translation unit is part of Google Test's
diff --git a/test/gtest-param-test_test.cc b/test/gtest-param-test_test.cc
index 5a681d8..94a53d9 100644
--- a/test/gtest-param-test_test.cc
+++ b/test/gtest-param-test_test.cc
@@ -37,19 +37,19 @@
#if GTEST_HAS_PARAM_TEST
-#include <algorithm>
-#include <iostream>
-#include <list>
-#include <sstream>
-#include <string>
-#include <vector>
+# include <algorithm>
+# include <iostream>
+# include <list>
+# include <sstream>
+# include <string>
+# include <vector>
// To include gtest-internal-inl.h.
-#define GTEST_IMPLEMENTATION_ 1
-#include "src/gtest-internal-inl.h" // for UnitTestOptions
-#undef GTEST_IMPLEMENTATION_
+# define GTEST_IMPLEMENTATION_ 1
+# include "src/gtest-internal-inl.h" // for UnitTestOptions
+# undef GTEST_IMPLEMENTATION_
-#include "test/gtest-param-test_test.h"
+# include "test/gtest-param-test_test.h"
using ::std::vector;
using ::std::sort;
@@ -62,12 +62,12 @@ using ::testing::TestWithParam;
using ::testing::Values;
using ::testing::ValuesIn;
-#if GTEST_HAS_COMBINE
+# if GTEST_HAS_COMBINE
using ::testing::Combine;
using ::std::tr1::get;
using ::std::tr1::make_tuple;
using ::std::tr1::tuple;
-#endif // GTEST_HAS_COMBINE
+# endif // GTEST_HAS_COMBINE
using ::testing::internal::ParamGenerator;
using ::testing::internal::UnitTestOptions;
@@ -85,7 +85,7 @@ template <typename T>
return stream.str();
}
-#if GTEST_HAS_COMBINE
+# if GTEST_HAS_COMBINE
// These overloads allow printing tuples in our tests. We cannot
// define an operator<< for tuples, as that definition needs to be in
@@ -121,7 +121,7 @@ template <typename T1, typename T2, typename T3, typename T4, typename T5,
return stream.str();
}
-#endif // GTEST_HAS_COMBINE
+# endif // GTEST_HAS_COMBINE
// Verifies that a sequence generated by the generator and accessed
// via the iterator object matches the expected one using Google Test
@@ -457,7 +457,7 @@ TEST(BoolTest, BoolWorks) {
VerifyGenerator(gen, expected_values);
}
-#if GTEST_HAS_COMBINE
+# if GTEST_HAS_COMBINE
// Tests that Combine() with two parameters generates the expected sequence.
TEST(CombineTest, CombineWithTwoParameters) {
@@ -542,7 +542,7 @@ TEST(CombineTest, CombineWithMaxNumberOfParameters) {
VerifyGenerator(gen, expected_values);
}
-#endif // GTEST_HAS_COMBINE
+# endif // GTEST_HAS_COMBINE
// Tests that an generator produces correct sequence after being
// assigned from another generator.
diff --git a/test/gtest-port_test.cc b/test/gtest-port_test.cc
index be0f8b0..ff0165f 100644
--- a/test/gtest-port_test.cc
+++ b/test/gtest-port_test.cc
@@ -36,7 +36,7 @@
#include <stdio.h>
#if GTEST_OS_MAC
-#include <time.h>
+# include <time.h>
#endif // GTEST_OS_MAC
#include <utility> // For std::pair and std::make_pair.
@@ -328,15 +328,19 @@ TEST(GtestCheckDeathTest, LivesSilentlyOnSuccess) {
// For simplicity, we only cover the most important platforms here.
TEST(RegexEngineSelectionTest, SelectsCorrectRegexEngine) {
#if GTEST_HAS_POSIX_RE
+
EXPECT_TRUE(GTEST_USES_POSIX_RE);
+
#else
+
EXPECT_TRUE(GTEST_USES_SIMPLE_RE);
+
#endif
}
#if GTEST_USES_POSIX_RE
-#if GTEST_HAS_TYPED_TEST
+# if GTEST_HAS_TYPED_TEST
template <typename Str>
class RETest : public ::testing::Test {};
@@ -345,9 +349,9 @@ class RETest : public ::testing::Test {};
// supports.
typedef testing::Types<
::std::string,
-#if GTEST_HAS_GLOBAL_STRING
+# if GTEST_HAS_GLOBAL_STRING
::string,
-#endif // GTEST_HAS_GLOBAL_STRING
+# endif // GTEST_HAS_GLOBAL_STRING
const char*> StringTypes;
TYPED_TEST_CASE(RETest, StringTypes);
@@ -398,7 +402,7 @@ TYPED_TEST(RETest, PartialMatchWorks) {
EXPECT_FALSE(RE::PartialMatch(TypeParam("zza"), re));
}
-#endif // GTEST_HAS_TYPED_TEST
+# endif // GTEST_HAS_TYPED_TEST
#elif GTEST_USES_SIMPLE_RE
diff --git a/test/gtest-printers_test.cc b/test/gtest-printers_test.cc
index da1fbc2..e11662f 100644
--- a/test/gtest-printers_test.cc
+++ b/test/gtest-printers_test.cc
@@ -52,10 +52,10 @@
// hash_map and hash_set are available under Visual C++.
#if _MSC_VER
-#define GTEST_HAS_HASH_MAP_ 1 // Indicates that hash_map is available.
-#include <hash_map> // NOLINT
-#define GTEST_HAS_HASH_SET_ 1 // Indicates that hash_set is available.
-#include <hash_set> // NOLINT
+# define GTEST_HAS_HASH_MAP_ 1 // Indicates that hash_map is available.
+# include <hash_map> // NOLINT
+# define GTEST_HAS_HASH_SET_ 1 // Indicates that hash_set is available.
+# include <hash_set> // NOLINT
#endif // GTEST_OS_WINDOWS
// Some user-defined types for testing the universal value printer.
diff --git a/test/gtest_break_on_failure_unittest_.cc b/test/gtest_break_on_failure_unittest_.cc
index 3075509..dd07478 100644
--- a/test/gtest_break_on_failure_unittest_.cc
+++ b/test/gtest_break_on_failure_unittest_.cc
@@ -42,8 +42,8 @@
#include "gtest/gtest.h"
#if GTEST_OS_WINDOWS
-#include <windows.h>
-#include <stdlib.h>
+# include <windows.h>
+# include <stdlib.h>
#endif
namespace {
@@ -69,7 +69,8 @@ int main(int argc, char **argv) {
// a general protection fault (segment violation).
SetErrorMode(SEM_NOGPFAULTERRORBOX | SEM_FAILCRITICALERRORS);
-#if GTEST_HAS_SEH && !GTEST_OS_WINDOWS_MOBILE
+# if GTEST_HAS_SEH && !GTEST_OS_WINDOWS_MOBILE
+
// The default unhandled exception filter does not always exit
// with the exception code as exit code - for example it exits with
// 0 for EXCEPTION_ACCESS_VIOLATION and 1 for EXCEPTION_BREAKPOINT
@@ -77,7 +78,8 @@ int main(int argc, char **argv) {
// filter which always exits with the exception code for unhandled
// exceptions.
SetUnhandledExceptionFilter(ExitWithExceptionCode);
-#endif
+
+# endif
#endif
testing::InitGoogleTest(&argc, argv);
diff --git a/test/gtest_catch_exceptions_test_.cc b/test/gtest_catch_exceptions_test_.cc
index 3cf7532..a35103f 100644
--- a/test/gtest_catch_exceptions_test_.cc
+++ b/test/gtest_catch_exceptions_test_.cc
@@ -38,12 +38,12 @@
#include <stdlib.h> // For exit().
#if GTEST_HAS_SEH
-#include <windows.h>
+# include <windows.h>
#endif
#if GTEST_HAS_EXCEPTIONS
-#include <exception> // For set_terminate().
-#include <stdexcept>
+# include <exception> // For set_terminate().
+# include <stdexcept>
#endif
using testing::Test;
diff --git a/test/gtest_output_test_.cc b/test/gtest_output_test_.cc
index 47343e5..13dbec4 100644
--- a/test/gtest_output_test_.cc
+++ b/test/gtest_output_test_.cc
@@ -788,7 +788,7 @@ INSTANTIATE_TYPED_TEST_CASE_P(Unsigned, TypedTestP, UnsignedTypes);
TEST(ADeathTest, ShouldRunFirst) {
}
-#if GTEST_HAS_TYPED_TEST
+# if GTEST_HAS_TYPED_TEST
// We rely on the golden file to verify that typed tests whose test
// case name ends with DeathTest are run first.
@@ -803,9 +803,9 @@ TYPED_TEST_CASE(ATypedDeathTest, NumericTypes);
TYPED_TEST(ATypedDeathTest, ShouldRunFirst) {
}
-#endif // GTEST_HAS_TYPED_TEST
+# endif // GTEST_HAS_TYPED_TEST
-#if GTEST_HAS_TYPED_TEST_P
+# if GTEST_HAS_TYPED_TEST_P
// We rely on the golden file to verify that type-parameterized tests
@@ -824,7 +824,7 @@ REGISTER_TYPED_TEST_CASE_P(ATypeParamDeathTest, ShouldRunFirst);
INSTANTIATE_TYPED_TEST_CASE_P(My, ATypeParamDeathTest, NumericTypes);
-#endif // GTEST_HAS_TYPED_TEST_P
+# endif // GTEST_HAS_TYPED_TEST_P
#endif // GTEST_HAS_DEATH_TEST
@@ -998,11 +998,11 @@ int main(int argc, char **argv) {
if (testing::internal::GTEST_FLAG(internal_run_death_test) != "") {
// Skip the usual output capturing if we're running as the child
// process of an threadsafe-style death test.
-#if GTEST_OS_WINDOWS
+# if GTEST_OS_WINDOWS
posix::FReopen("nul:", "w", stdout);
-#else
+# else
posix::FReopen("/dev/null", "w", stdout);
-#endif // GTEST_OS_WINDOWS
+# endif // GTEST_OS_WINDOWS
return RUN_ALL_TESTS();
}
#endif // GTEST_HAS_DEATH_TEST
diff --git a/test/gtest_unittest.cc b/test/gtest_unittest.cc
index 1069ecf..3f0456e 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) {