From 7e13e0f5dd2f9458e0a613e0a91c894eb80126fc Mon Sep 17 00:00:00 2001 From: "zhanyong.wan" Date: Tue, 10 Nov 2009 19:17:35 +0000 Subject: [PATCH] Fixes the code to work with fuse_gtest.py. --- include/gtest/gtest-param-test.h | 7 +++++-- include/gtest/gtest-param-test.h.pump | 18 +++++++++++------- .../internal/gtest-param-util-generated.h | 6 ++++-- .../internal/gtest-param-util-generated.h.pump | 6 ++++-- include/gtest/internal/gtest-param-util.h | 10 ++++++---- src/gtest-all.cc | 6 ++++++ 6 files changed, 36 insertions(+), 17 deletions(-) diff --git a/include/gtest/gtest-param-test.h b/include/gtest/gtest-param-test.h index 6c8622a6..c0c85e3e 100644 --- a/include/gtest/gtest-param-test.h +++ b/include/gtest/gtest-param-test.h @@ -152,12 +152,15 @@ INSTANTIATE_TEST_CASE_P(AnotherInstantiationName, FooTest, ValuesIn(pets)); #include #endif -#if GTEST_HAS_PARAM_TEST - +// scripts/fuse_gtest.py depends on gtest's own header being #included +// *unconditionally*. Therefore these #includes cannot be moved +// inside #if GTEST_HAS_PARAM_TEST. #include #include #include +#if GTEST_HAS_PARAM_TEST + namespace testing { // Functions producing parameter generators. diff --git a/include/gtest/gtest-param-test.h.pump b/include/gtest/gtest-param-test.h.pump index c761f125..a2311882 100644 --- a/include/gtest/gtest-param-test.h.pump +++ b/include/gtest/gtest-param-test.h.pump @@ -52,7 +52,7 @@ $var maxtuple = 10 $$ Maximum number of Combine arguments we want to support. // class. It must be derived from testing::TestWithParam, where T is // the type of your parameter values. TestWithParam is itself derived // from testing::Test. T can be any copyable type. If it's a raw pointer, -// you are responsible for managing the lifespan of the pointed values. +// you are responsible for managing the lifespan of the pointed values. class FooTest : public ::testing::TestWithParam { // You can implement all the usual class fixture members here. @@ -60,7 +60,7 @@ class FooTest : public ::testing::TestWithParam { // Then, use the TEST_P macro to define as many parameterized tests // for this fixture as you want. The _P suffix is for "parameterized" -// or "pattern", whichever you prefer to think. +// or "pattern", whichever you prefer to think. TEST_P(FooTest, DoesBlah) { // Inside a test, access the test parameter with the GetParam() method @@ -124,7 +124,7 @@ const char* pets[] = {"cat", "dog"}; INSTANTIATE_TEST_CASE_P(AnotherInstantiationName, FooTest, ValuesIn(pets)); // The tests from the instantiation above will have these names: -// +// // * AnotherInstantiationName/FooTest.DoesBlah/0 for "cat" // * AnotherInstantiationName/FooTest.DoesBlah/1 for "dog" // * AnotherInstantiationName/FooTest.HasBlahBlah/0 for "cat" @@ -147,17 +147,21 @@ INSTANTIATE_TEST_CASE_P(AnotherInstantiationName, FooTest, ValuesIn(pets)); #endif // 0 - -#include - #include -#if GTEST_HAS_PARAM_TEST +#if !GTEST_OS_SYMBIAN +#include +#endif +// scripts/fuse_gtest.py depends on gtest's own header being #included +// *unconditionally*. Therefore these #includes cannot be moved +// inside #if GTEST_HAS_PARAM_TEST. #include #include #include +#if GTEST_HAS_PARAM_TEST + namespace testing { // Functions producing parameter generators. diff --git a/include/gtest/internal/gtest-param-util-generated.h b/include/gtest/internal/gtest-param-util-generated.h index 1358c329..04f4c3ac 100644 --- a/include/gtest/internal/gtest-param-util-generated.h +++ b/include/gtest/internal/gtest-param-util-generated.h @@ -44,12 +44,14 @@ #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_ #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_ +// scripts/fuse_gtest.py depends on gtest's own header being #included +// *unconditionally*. Therefore these #includes cannot be moved +// inside #if GTEST_HAS_PARAM_TEST. +#include #include #if GTEST_HAS_PARAM_TEST -#include - namespace testing { namespace internal { diff --git a/include/gtest/internal/gtest-param-util-generated.h.pump b/include/gtest/internal/gtest-param-util-generated.h.pump index 2da2872a..8cfcf0bf 100644 --- a/include/gtest/internal/gtest-param-util-generated.h.pump +++ b/include/gtest/internal/gtest-param-util-generated.h.pump @@ -45,12 +45,14 @@ $var maxtuple = 10 $$ Maximum number of Combine arguments we want to support. #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_ #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_ +// scripts/fuse_gtest.py depends on gtest's own header being #included +// *unconditionally*. Therefore these #includes cannot be moved +// inside #if GTEST_HAS_PARAM_TEST. +#include #include #if GTEST_HAS_PARAM_TEST -#include - namespace testing { namespace internal { diff --git a/include/gtest/internal/gtest-param-util.h b/include/gtest/internal/gtest-param-util.h index dcc54947..19295d77 100644 --- a/include/gtest/internal/gtest-param-util.h +++ b/include/gtest/internal/gtest-param-util.h @@ -38,17 +38,19 @@ #include #include +// scripts/fuse_gtest.py depends on gtest's own header being #included +// *unconditionally*. Therefore these #includes cannot be moved +// inside #if GTEST_HAS_PARAM_TEST. +#include +#include #include #if GTEST_HAS_PARAM_TEST #if GTEST_HAS_RTTI -#include +#include // NOLINT #endif // GTEST_HAS_RTTI -#include -#include - namespace testing { namespace internal { diff --git a/src/gtest-all.cc b/src/gtest-all.cc index a67ea0fa..fe34765f 100644 --- a/src/gtest-all.cc +++ b/src/gtest-all.cc @@ -33,6 +33,12 @@ // // Sometimes it's desirable to build Google Test by compiling a single file. // This file serves this purpose. + +// This line ensures that gtest.h can be compiled on its own, even +// when it's fused. +#include + +// The following lines pull in the real gtest *.cc files. #include "src/gtest.cc" #include "src/gtest-death-test.cc" #include "src/gtest-filepath.cc"