Unverified Commit 27bb844e authored by Conor Burgess's avatar Conor Burgess Committed by GitHub
Browse files

Merge branch 'master' into fix-argc

parents 8f90d46c ed8d02cf
...@@ -133,14 +133,7 @@ ...@@ -133,14 +133,7 @@
# include <sys/types.h> // NOLINT # include <sys/types.h> // NOLINT
#endif #endif
// 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
// their code.
#define GTEST_IMPLEMENTATION_ 1
#include "src/gtest-internal-inl.h" #include "src/gtest-internal-inl.h"
#undef GTEST_IMPLEMENTATION_
#if GTEST_OS_WINDOWS #if GTEST_OS_WINDOWS
# define vsnprintf _vsnprintf # define vsnprintf _vsnprintf
...@@ -635,12 +628,12 @@ extern const TypeId kTestTypeIdInGoogleTest = GetTestTypeId(); ...@@ -635,12 +628,12 @@ extern const TypeId kTestTypeIdInGoogleTest = GetTestTypeId();
// This predicate-formatter checks that 'results' contains a test part // This predicate-formatter checks that 'results' contains a test part
// failure of the given type and that the failure message contains the // failure of the given type and that the failure message contains the
// given substring. // given substring.
AssertionResult HasOneFailure(const char* /* results_expr */, static AssertionResult HasOneFailure(const char* /* results_expr */,
const char* /* type_expr */, const char* /* type_expr */,
const char* /* substr_expr */, const char* /* substr_expr */,
const TestPartResultArray& results, const TestPartResultArray& results,
TestPartResult::Type type, TestPartResult::Type type,
const std::string& substr) { const std::string& substr) {
const std::string expected(type == TestPartResult::kFatalFailure ? const std::string expected(type == TestPartResult::kFatalFailure ?
"1 fatal failure" : "1 fatal failure" :
"1 non-fatal failure"); "1 non-fatal failure");
...@@ -2143,8 +2136,9 @@ static std::string FormatWordList(const std::vector<std::string>& words) { ...@@ -2143,8 +2136,9 @@ static std::string FormatWordList(const std::vector<std::string>& words) {
return word_list.GetString(); return word_list.GetString();
} }
bool ValidateTestPropertyName(const std::string& property_name, static bool ValidateTestPropertyName(
const std::vector<std::string>& reserved_names) { const std::string& property_name,
const std::vector<std::string>& reserved_names) {
if (std::find(reserved_names.begin(), reserved_names.end(), property_name) != if (std::find(reserved_names.begin(), reserved_names.end(), property_name) !=
reserved_names.end()) { reserved_names.end()) {
ADD_FAILURE() << "Reserved key used in RecordProperty(): " << property_name ADD_FAILURE() << "Reserved key used in RecordProperty(): " << property_name
...@@ -2562,7 +2556,6 @@ TestInfo* MakeAndRegisterTestInfo( ...@@ -2562,7 +2556,6 @@ TestInfo* MakeAndRegisterTestInfo(
return test_info; return test_info;
} }
#if GTEST_HAS_PARAM_TEST
void ReportInvalidTestCaseType(const char* test_case_name, void ReportInvalidTestCaseType(const char* test_case_name,
CodeLocation code_location) { CodeLocation code_location) {
Message errors; Message errors;
...@@ -2576,12 +2569,11 @@ void ReportInvalidTestCaseType(const char* test_case_name, ...@@ -2576,12 +2569,11 @@ void ReportInvalidTestCaseType(const char* test_case_name,
<< "probably rename one of the classes to put the tests into different\n" << "probably rename one of the classes to put the tests into different\n"
<< "test cases."; << "test cases.";
GTEST_LOG_(ERROR) GTEST_LOG_(ERROR)
<< FormatFileLocation(code_location.file.c_str(), << FormatFileLocation(code_location.file.c_str(),
code_location.line) code_location.line)
<< " " << errors.GetString(); << " " << errors.GetString();
} }
#endif // GTEST_HAS_PARAM_TEST
} // namespace internal } // namespace internal
...@@ -2620,12 +2612,10 @@ namespace internal { ...@@ -2620,12 +2612,10 @@ namespace internal {
// and INSTANTIATE_TEST_CASE_P into regular tests and registers those. // and INSTANTIATE_TEST_CASE_P into regular tests and registers those.
// This will be done just once during the program runtime. // This will be done just once during the program runtime.
void UnitTestImpl::RegisterParameterizedTests() { void UnitTestImpl::RegisterParameterizedTests() {
#if GTEST_HAS_PARAM_TEST
if (!parameterized_tests_registered_) { if (!parameterized_tests_registered_) {
parameterized_test_registry_.RegisterTests(); parameterized_test_registry_.RegisterTests();
parameterized_tests_registered_ = true; parameterized_tests_registered_ = true;
} }
#endif
} }
} // namespace internal } // namespace internal
...@@ -2893,7 +2883,7 @@ enum GTestColor { ...@@ -2893,7 +2883,7 @@ enum GTestColor {
!GTEST_OS_WINDOWS_PHONE && !GTEST_OS_WINDOWS_RT && !GTEST_OS_WINDOWS_MINGW !GTEST_OS_WINDOWS_PHONE && !GTEST_OS_WINDOWS_RT && !GTEST_OS_WINDOWS_MINGW
// Returns the character attribute for the given color. // Returns the character attribute for the given color.
WORD GetColorAttribute(GTestColor color) { static WORD GetColorAttribute(GTestColor color) {
switch (color) { switch (color) {
case COLOR_RED: return FOREGROUND_RED; case COLOR_RED: return FOREGROUND_RED;
case COLOR_GREEN: return FOREGROUND_GREEN; case COLOR_GREEN: return FOREGROUND_GREEN;
...@@ -2902,7 +2892,7 @@ WORD GetColorAttribute(GTestColor color) { ...@@ -2902,7 +2892,7 @@ WORD GetColorAttribute(GTestColor color) {
} }
} }
int GetBitOffset(WORD color_mask) { static int GetBitOffset(WORD color_mask) {
if (color_mask == 0) return 0; if (color_mask == 0) return 0;
int bitOffset = 0; int bitOffset = 0;
...@@ -2913,7 +2903,7 @@ int GetBitOffset(WORD color_mask) { ...@@ -2913,7 +2903,7 @@ int GetBitOffset(WORD color_mask) {
return bitOffset; return bitOffset;
} }
WORD GetNewColor(GTestColor color, WORD old_color_attrs) { static WORD GetNewColor(GTestColor color, WORD old_color_attrs) {
// Let's reuse the BG // Let's reuse the BG
static const WORD background_mask = BACKGROUND_BLUE | BACKGROUND_GREEN | BACKGROUND_RED | BACKGROUND_INTENSITY; static const WORD background_mask = BACKGROUND_BLUE | BACKGROUND_GREEN | BACKGROUND_RED | BACKGROUND_INTENSITY;
static const WORD foreground_mask = FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_INTENSITY; static const WORD foreground_mask = FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_INTENSITY;
...@@ -2928,12 +2918,12 @@ WORD GetNewColor(GTestColor color, WORD old_color_attrs) { ...@@ -2928,12 +2918,12 @@ WORD GetNewColor(GTestColor color, WORD old_color_attrs) {
} }
return new_color; return new_color;
} }
#else #else
// Returns the ANSI color code for the given color. COLOR_DEFAULT is // Returns the ANSI color code for the given color. COLOR_DEFAULT is
// an invalid input. // an invalid input.
const char* GetAnsiColorCode(GTestColor color) { static const char* GetAnsiColorCode(GTestColor color) {
switch (color) { switch (color) {
case COLOR_RED: return "1"; case COLOR_RED: return "1";
case COLOR_GREEN: return "2"; case COLOR_GREEN: return "2";
...@@ -2986,7 +2976,7 @@ bool ShouldUseColor(bool stdout_is_tty) { ...@@ -2986,7 +2976,7 @@ bool ShouldUseColor(bool stdout_is_tty) {
// This routine must actually emit the characters rather than return a string // This routine must actually emit the characters rather than return a string
// that would be colored when printed, as can be done on Linux. // that would be colored when printed, as can be done on Linux.
GTEST_ATTRIBUTE_PRINTF_(2, 3) GTEST_ATTRIBUTE_PRINTF_(2, 3)
void ColoredPrintf(GTestColor color, const char* fmt, ...) { static void ColoredPrintf(GTestColor color, const char* fmt, ...) {
va_list args; va_list args;
va_start(args, fmt); va_start(args, fmt);
...@@ -3015,7 +3005,7 @@ void ColoredPrintf(GTestColor color, const char* fmt, ...) { ...@@ -3015,7 +3005,7 @@ void ColoredPrintf(GTestColor color, const char* fmt, ...) {
GetConsoleScreenBufferInfo(stdout_handle, &buffer_info); GetConsoleScreenBufferInfo(stdout_handle, &buffer_info);
const WORD old_color_attrs = buffer_info.wAttributes; const WORD old_color_attrs = buffer_info.wAttributes;
const WORD new_color = GetNewColor(color, old_color_attrs); const WORD new_color = GetNewColor(color, old_color_attrs);
// We need to flush the stream buffers into the console before each // We need to flush the stream buffers into the console before each
// SetConsoleTextAttribute call lest it affect the text that is already // SetConsoleTextAttribute call lest it affect the text that is already
// printed but has not yet reached the console. // printed but has not yet reached the console.
...@@ -3040,7 +3030,7 @@ void ColoredPrintf(GTestColor color, const char* fmt, ...) { ...@@ -3040,7 +3030,7 @@ void ColoredPrintf(GTestColor color, const char* fmt, ...) {
static const char kTypeParamLabel[] = "TypeParam"; static const char kTypeParamLabel[] = "TypeParam";
static const char kValueParamLabel[] = "GetParam()"; static const char kValueParamLabel[] = "GetParam()";
void PrintFullTestCommentIfPresent(const TestInfo& test_info) { static void PrintFullTestCommentIfPresent(const TestInfo& test_info) {
const char* const type_param = test_info.type_param(); const char* const type_param = test_info.type_param();
const char* const value_param = test_info.value_param(); const char* const value_param = test_info.value_param();
...@@ -3481,7 +3471,7 @@ void XmlUnitTestResultPrinter::OnTestIterationEnd(const UnitTest& unit_test, ...@@ -3481,7 +3471,7 @@ void XmlUnitTestResultPrinter::OnTestIterationEnd(const UnitTest& unit_test,
// 3. To interpret the meaning of errno in a thread-safe way, // 3. To interpret the meaning of errno in a thread-safe way,
// we need the strerror_r() function, which is not available on // we need the strerror_r() function, which is not available on
// Windows. // Windows.
GTEST_LOG_(FATAL) << "Unable to open file \"" GTEST_LOG_(FATAL) << "Unable to open file \""
<< output_file_ << "\""; << output_file_ << "\"";
} }
std::stringstream stream; std::stringstream stream;
...@@ -3855,12 +3845,11 @@ void StreamingListener::SocketWriter::MakeConnection() { ...@@ -3855,12 +3845,11 @@ void StreamingListener::SocketWriter::MakeConnection() {
// Pushes the given source file location and message onto a per-thread // Pushes the given source file location and message onto a per-thread
// trace stack maintained by Google Test. // trace stack maintained by Google Test.
ScopedTrace::ScopedTrace(const char* file, int line, const Message& message) void ScopedTrace::PushTrace(const char* file, int line, std::string message) {
GTEST_LOCK_EXCLUDED_(&UnitTest::mutex_) {
TraceInfo trace; TraceInfo trace;
trace.file = file; trace.file = file;
trace.line = line; trace.line = line;
trace.message = message.GetString(); trace.message.swap(message);
UnitTest::GetInstance()->PushGTestTrace(trace); UnitTest::GetInstance()->PushGTestTrace(trace);
} }
...@@ -4315,7 +4304,6 @@ const TestInfo* UnitTest::current_test_info() const ...@@ -4315,7 +4304,6 @@ const TestInfo* UnitTest::current_test_info() const
// Returns the random seed used at the start of the current test run. // Returns the random seed used at the start of the current test run.
int UnitTest::random_seed() const { return impl_->random_seed(); } int UnitTest::random_seed() const { return impl_->random_seed(); }
#if GTEST_HAS_PARAM_TEST
// Returns ParameterizedTestCaseRegistry object used to keep track of // Returns ParameterizedTestCaseRegistry object used to keep track of
// value-parameterized tests and instantiate and register them. // value-parameterized tests and instantiate and register them.
internal::ParameterizedTestCaseRegistry& internal::ParameterizedTestCaseRegistry&
...@@ -4323,7 +4311,6 @@ internal::ParameterizedTestCaseRegistry& ...@@ -4323,7 +4311,6 @@ internal::ParameterizedTestCaseRegistry&
GTEST_LOCK_EXCLUDED_(mutex_) { GTEST_LOCK_EXCLUDED_(mutex_) {
return impl_->parameterized_test_registry(); return impl_->parameterized_test_registry();
} }
#endif // GTEST_HAS_PARAM_TEST
// Creates an empty UnitTest. // Creates an empty UnitTest.
UnitTest::UnitTest() { UnitTest::UnitTest() {
...@@ -4362,10 +4349,8 @@ UnitTestImpl::UnitTestImpl(UnitTest* parent) ...@@ -4362,10 +4349,8 @@ UnitTestImpl::UnitTestImpl(UnitTest* parent)
&default_global_test_part_result_reporter_), &default_global_test_part_result_reporter_),
per_thread_test_part_result_reporter_( per_thread_test_part_result_reporter_(
&default_per_thread_test_part_result_reporter_), &default_per_thread_test_part_result_reporter_),
#if GTEST_HAS_PARAM_TEST
parameterized_test_registry_(), parameterized_test_registry_(),
parameterized_tests_registered_(false), parameterized_tests_registered_(false),
#endif // GTEST_HAS_PARAM_TEST
last_death_test_case_(-1), last_death_test_case_(-1),
current_test_case_(NULL), current_test_case_(NULL),
current_test_info_(NULL), current_test_info_(NULL),
...@@ -4433,8 +4418,8 @@ void UnitTestImpl::ConfigureXmlOutput() { ...@@ -4433,8 +4418,8 @@ void UnitTestImpl::ConfigureXmlOutput() {
listeners()->SetDefaultXmlGenerator(new XmlUnitTestResultPrinter( listeners()->SetDefaultXmlGenerator(new XmlUnitTestResultPrinter(
UnitTestOptions::GetAbsolutePathToOutputFile().c_str())); UnitTestOptions::GetAbsolutePathToOutputFile().c_str()));
} else if (output_format != "") { } else if (output_format != "") {
GTEST_LOG_(WARNING) << "WARNING: unrecognized output format \"" GTEST_LOG_(WARNING) << "WARNING: unrecognized output format \""
<< output_format << output_format
<< "\" ignored."; << "\" ignored.";
} }
} }
...@@ -4450,8 +4435,8 @@ void UnitTestImpl::ConfigureStreamingOutput() { ...@@ -4450,8 +4435,8 @@ void UnitTestImpl::ConfigureStreamingOutput() {
listeners()->Append(new StreamingListener(target.substr(0, pos), listeners()->Append(new StreamingListener(target.substr(0, pos),
target.substr(pos+1))); target.substr(pos+1)));
} else { } else {
GTEST_LOG_(WARNING) << "unrecognized streaming target \"" GTEST_LOG_(WARNING) << "unrecognized streaming target \""
<< target << target
<< "\" ignored."; << "\" ignored.";
} }
} }
...@@ -4581,7 +4566,7 @@ static void TearDownEnvironment(Environment* env) { env->TearDown(); } ...@@ -4581,7 +4566,7 @@ static void TearDownEnvironment(Environment* env) { env->TearDown(); }
bool UnitTestImpl::RunAllTests() { bool UnitTestImpl::RunAllTests() {
// Makes sure InitGoogleTest() was called. // Makes sure InitGoogleTest() was called.
if (!GTestIsInitialized()) { if (!GTestIsInitialized()) {
GTEST_LOG_(ERROR) << GTEST_LOG_(ERROR) <<
"\nThis test program did NOT call ::testing::InitGoogleTest " "\nThis test program did NOT call ::testing::InitGoogleTest "
"before calling RUN_ALL_TESTS(). Please fix it."; "before calling RUN_ALL_TESTS(). Please fix it.";
return false; return false;
...@@ -5042,9 +5027,9 @@ bool SkipPrefix(const char* prefix, const char** pstr) { ...@@ -5042,9 +5027,9 @@ bool SkipPrefix(const char* prefix, const char** pstr) {
// part can be omitted. // part can be omitted.
// //
// Returns the value of the flag, or NULL if the parsing failed. // Returns the value of the flag, or NULL if the parsing failed.
const char* ParseFlagValue(const char* str, static const char* ParseFlagValue(const char* str,
const char* flag, const char* flag,
bool def_optional) { bool def_optional) {
// str and flag must not be NULL. // str and flag must not be NULL.
if (str == NULL || flag == NULL) return NULL; if (str == NULL || flag == NULL) return NULL;
...@@ -5080,7 +5065,7 @@ const char* ParseFlagValue(const char* str, ...@@ -5080,7 +5065,7 @@ const char* ParseFlagValue(const char* str,
// //
// On success, stores the value of the flag in *value, and returns // On success, stores the value of the flag in *value, and returns
// true. On failure, returns false without changing *value. // true. On failure, returns false without changing *value.
bool ParseBoolFlag(const char* str, const char* flag, bool* value) { static bool ParseBoolFlag(const char* str, const char* flag, bool* value) {
// Gets the value of the flag as a string. // Gets the value of the flag as a string.
const char* const value_str = ParseFlagValue(str, flag, true); const char* const value_str = ParseFlagValue(str, flag, true);
...@@ -5114,7 +5099,9 @@ bool ParseInt32Flag(const char* str, const char* flag, Int32* value) { ...@@ -5114,7 +5099,9 @@ bool ParseInt32Flag(const char* str, const char* flag, Int32* value) {
// //
// On success, stores the value of the flag in *value, and returns // On success, stores the value of the flag in *value, and returns
// true. On failure, returns false without changing *value. // true. On failure, returns false without changing *value.
bool ParseStringFlag(const char* str, const char* flag, std::string* value) { static bool ParseStringFlag(const char* str,
const char* flag,
std::string* value) {
// Gets the value of the flag as a string. // Gets the value of the flag as a string.
const char* const value_str = ParseFlagValue(str, flag, false); const char* const value_str = ParseFlagValue(str, flag, false);
...@@ -5250,7 +5237,7 @@ static const char kColorEncodedHelpMessage[] = ...@@ -5250,7 +5237,7 @@ static const char kColorEncodedHelpMessage[] =
"(not one in your own code or tests), please report it to\n" "(not one in your own code or tests), please report it to\n"
"@G<" GTEST_DEV_EMAIL_ ">@D.\n"; "@G<" GTEST_DEV_EMAIL_ ">@D.\n";
bool ParseGoogleTestFlag(const char* const arg) { static bool ParseGoogleTestFlag(const char* const arg) {
return ParseBoolFlag(arg, kAlsoRunDisabledTestsFlag, return ParseBoolFlag(arg, kAlsoRunDisabledTestsFlag,
&GTEST_FLAG(also_run_disabled_tests)) || &GTEST_FLAG(also_run_disabled_tests)) ||
ParseBoolFlag(arg, kBreakOnFailureFlag, ParseBoolFlag(arg, kBreakOnFailureFlag,
...@@ -5280,11 +5267,11 @@ bool ParseGoogleTestFlag(const char* const arg) { ...@@ -5280,11 +5267,11 @@ bool ParseGoogleTestFlag(const char* const arg) {
} }
#if GTEST_USE_OWN_FLAGFILE_FLAG_ #if GTEST_USE_OWN_FLAGFILE_FLAG_
void LoadFlagsFromFile(const std::string& path) { static void LoadFlagsFromFile(const std::string& path) {
FILE* flagfile = posix::FOpen(path.c_str(), "r"); FILE* flagfile = posix::FOpen(path.c_str(), "r");
if (!flagfile) { if (!flagfile) {
GTEST_LOG_(FATAL) << "Unable to open file \"" GTEST_LOG_(FATAL) << "Unable to open file \""
<< GTEST_FLAG(flagfile) << GTEST_FLAG(flagfile)
<< "\""; << "\"";
} }
std::string contents(ReadEntireFile(flagfile)); std::string contents(ReadEntireFile(flagfile));
......
...@@ -57,13 +57,15 @@ cc_test( ...@@ -57,13 +57,15 @@ cc_test(
"gtest-param-test_test.cc", "gtest-param-test_test.cc",
], ],
) + select({ ) + select({
"//:win": [], "//:windows": [],
"//:windows_msvc": [],
"//conditions:default": [ "//conditions:default": [
"gtest-tuple_test.cc", "gtest-tuple_test.cc",
], ],
}), }),
copts = select({ copts = select({
"//:win": ["-DGTEST_USE_OWN_TR1_TUPLE=0"], "//:windows": ["-DGTEST_USE_OWN_TR1_TUPLE=0"],
"//:windows_msvc": ["-DGTEST_USE_OWN_TR1_TUPLE=0"],
"//conditions:default": ["-DGTEST_USE_OWN_TR1_TUPLE=1"], "//conditions:default": ["-DGTEST_USE_OWN_TR1_TUPLE=1"],
}), }),
includes = [ includes = [
...@@ -73,7 +75,8 @@ cc_test( ...@@ -73,7 +75,8 @@ cc_test(
"googletest/test", "googletest/test",
], ],
linkopts = select({ linkopts = select({
"//:win": [], "//:windows": [],
"//:windows_msvc": [],
"//conditions:default": [ "//conditions:default": [
"-pthread", "-pthread",
], ],
......
...@@ -56,15 +56,7 @@ using testing::internal::AlwaysTrue; ...@@ -56,15 +56,7 @@ using testing::internal::AlwaysTrue;
# endif // GTEST_OS_LINUX # endif // GTEST_OS_LINUX
# 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
// their code.
# define GTEST_IMPLEMENTATION_ 1
# include "src/gtest-internal-inl.h" # include "src/gtest-internal-inl.h"
# undef GTEST_IMPLEMENTATION_
namespace posix = ::testing::internal::posix; namespace posix = ::testing::internal::posix;
...@@ -313,14 +305,14 @@ void DieWithEmbeddedNul() { ...@@ -313,14 +305,14 @@ void DieWithEmbeddedNul() {
} }
# if GTEST_USES_PCRE # if GTEST_USES_PCRE
// Tests that EXPECT_DEATH and ASSERT_DEATH work when the error // Tests that EXPECT_DEATH and ASSERT_DEATH work when the error
// message has a NUL character in it. // message has a NUL character in it.
TEST_F(TestForDeathTest, EmbeddedNulInMessage) { TEST_F(TestForDeathTest, EmbeddedNulInMessage) {
// TODO(wan@google.com): <regex.h> doesn't support matching strings
// with embedded NUL characters - find a way to workaround it.
EXPECT_DEATH(DieWithEmbeddedNul(), "my null world"); EXPECT_DEATH(DieWithEmbeddedNul(), "my null world");
ASSERT_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 // Tests that death test macros expand to code which interacts well with switch
......
...@@ -27,28 +27,18 @@ ...@@ -27,28 +27,18 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// //
// Authors: keith.ray@gmail.com (Keith Ray)
// //
// Google Test filepath utilities // Google Test filepath utilities
// //
// This file tests classes and functions used internally by // This file tests classes and functions used internally by
// Google Test. They are subject to change without notice. // Google Test. They are subject to change without notice.
// //
// This file is #included from gtest_unittest.cc, to avoid changing // This file is #included from gtest-internal.h.
// build or make-files for some existing Google Test clients. Do not // Do not #include this file anywhere else!
// #include this file anywhere else!
#include "gtest/internal/gtest-filepath.h" #include "gtest/internal/gtest-filepath.h"
#include "gtest/gtest.h" #include "gtest/gtest.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
// their code.
#define GTEST_IMPLEMENTATION_ 1
#include "src/gtest-internal-inl.h" #include "src/gtest-internal-inl.h"
#undef GTEST_IMPLEMENTATION_
#if GTEST_OS_WINDOWS_MOBILE #if GTEST_OS_WINDOWS_MOBILE
# include <windows.h> // NOLINT # include <windows.h> // NOLINT
......
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// //
// Authors: keith.ray@gmail.com (Keith Ray)
// //
// Google Test UnitTestOptions tests // Google Test UnitTestOptions tests
// //
...@@ -46,14 +45,7 @@ ...@@ -46,14 +45,7 @@
# include <direct.h> # include <direct.h>
#endif // GTEST_OS_WINDOWS_MOBILE #endif // GTEST_OS_WINDOWS_MOBILE
// 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
// their code.
#define GTEST_IMPLEMENTATION_ 1
#include "src/gtest-internal-inl.h" #include "src/gtest-internal-inl.h"
#undef GTEST_IMPLEMENTATION_
namespace testing { namespace testing {
namespace internal { namespace internal {
......
...@@ -33,11 +33,8 @@ ...@@ -33,11 +33,8 @@
// Google Test work. // Google Test work.
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "test/gtest-param-test_test.h" #include "test/gtest-param-test_test.h"
#if GTEST_HAS_PARAM_TEST
using ::testing::Values; using ::testing::Values;
using ::testing::internal::ParamGenerator; using ::testing::internal::ParamGenerator;
...@@ -62,4 +59,3 @@ INSTANTIATE_TEST_CASE_P(Sequence2, ...@@ -62,4 +59,3 @@ INSTANTIATE_TEST_CASE_P(Sequence2,
InstantiationInMultipleTranslaionUnitsTest, InstantiationInMultipleTranslaionUnitsTest,
Values(42*3, 42*4, 42*5)); Values(42*3, 42*4, 42*5));
#endif // GTEST_HAS_PARAM_TEST
...@@ -35,19 +35,13 @@ ...@@ -35,19 +35,13 @@
#include "gtest/gtest.h" #include "gtest/gtest.h"
#if GTEST_HAS_PARAM_TEST
# include <algorithm> # include <algorithm>
# include <iostream> # include <iostream>
# include <list> # include <list>
# include <sstream> # include <sstream>
# include <string> # include <string>
# include <vector> # include <vector>
// To include gtest-internal-inl.h.
# define GTEST_IMPLEMENTATION_ 1
# include "src/gtest-internal-inl.h" // for UnitTestOptions # 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"
...@@ -1025,31 +1019,19 @@ TEST_F(ParameterizedDeathTest, GetParamDiesFromTestF) { ...@@ -1025,31 +1019,19 @@ TEST_F(ParameterizedDeathTest, GetParamDiesFromTestF) {
INSTANTIATE_TEST_CASE_P(RangeZeroToFive, ParameterizedDerivedTest, Range(0, 5)); INSTANTIATE_TEST_CASE_P(RangeZeroToFive, ParameterizedDerivedTest, Range(0, 5));
#endif // GTEST_HAS_PARAM_TEST
TEST(CompileTest, CombineIsDefinedOnlyWhenGtestHasParamTestIsDefined) {
#if GTEST_HAS_COMBINE && !GTEST_HAS_PARAM_TEST
FAIL() << "GTEST_HAS_COMBINE is defined while GTEST_HAS_PARAM_TEST is not\n"
#endif
}
int main(int argc, char **argv) { int main(int argc, char **argv) {
#if GTEST_HAS_PARAM_TEST
// Used in TestGenerationTest test case. // Used in TestGenerationTest test case.
AddGlobalTestEnvironment(TestGenerationTest::Environment::Instance()); AddGlobalTestEnvironment(TestGenerationTest::Environment::Instance());
// Used in GeneratorEvaluationTest test case. Tests that the updated value // Used in GeneratorEvaluationTest test case. Tests that the updated value
// will be picked up for instantiating tests in GeneratorEvaluationTest. // will be picked up for instantiating tests in GeneratorEvaluationTest.
GeneratorEvaluationTest::set_param_value(1); GeneratorEvaluationTest::set_param_value(1);
#endif // GTEST_HAS_PARAM_TEST
::testing::InitGoogleTest(&argc, argv); ::testing::InitGoogleTest(&argc, argv);
#if GTEST_HAS_PARAM_TEST
// Used in GeneratorEvaluationTest test case. Tests that value updated // Used in GeneratorEvaluationTest test case. Tests that value updated
// here will NOT be used for instantiating tests in // here will NOT be used for instantiating tests in
// GeneratorEvaluationTest. // GeneratorEvaluationTest.
GeneratorEvaluationTest::set_param_value(2); GeneratorEvaluationTest::set_param_value(2);
#endif // GTEST_HAS_PARAM_TEST
return RUN_ALL_TESTS(); return RUN_ALL_TESTS();
} }
...@@ -39,8 +39,6 @@ ...@@ -39,8 +39,6 @@
#include "gtest/gtest.h" #include "gtest/gtest.h"
#if GTEST_HAS_PARAM_TEST
// Test fixture for testing definition and instantiation of a test // Test fixture for testing definition and instantiation of a test
// in separate translation units. // in separate translation units.
class ExternalInstantiationTest : public ::testing::TestWithParam<int> { class ExternalInstantiationTest : public ::testing::TestWithParam<int> {
...@@ -52,6 +50,4 @@ class InstantiationInMultipleTranslaionUnitsTest ...@@ -52,6 +50,4 @@ class InstantiationInMultipleTranslaionUnitsTest
: public ::testing::TestWithParam<int> { : public ::testing::TestWithParam<int> {
}; };
#endif // GTEST_HAS_PARAM_TEST
#endif // GTEST_TEST_GTEST_PARAM_TEST_TEST_H_ #endif // GTEST_TEST_GTEST_PARAM_TEST_TEST_H_
...@@ -45,15 +45,7 @@ ...@@ -45,15 +45,7 @@
#include "gtest/gtest.h" #include "gtest/gtest.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
// their code.
#define GTEST_IMPLEMENTATION_ 1
#include "src/gtest-internal-inl.h" #include "src/gtest-internal-inl.h"
#undef GTEST_IMPLEMENTATION_
using std::make_pair; using std::make_pair;
using std::pair; using std::pair;
...@@ -75,8 +67,8 @@ TEST(IsXDigitTest, WorksForNarrowAscii) { ...@@ -75,8 +67,8 @@ TEST(IsXDigitTest, WorksForNarrowAscii) {
} }
TEST(IsXDigitTest, ReturnsFalseForNarrowNonAscii) { TEST(IsXDigitTest, ReturnsFalseForNarrowNonAscii) {
EXPECT_FALSE(IsXDigit('\x80')); EXPECT_FALSE(IsXDigit(static_cast<char>(0x80)));
EXPECT_FALSE(IsXDigit(static_cast<char>('0' | '\x80'))); EXPECT_FALSE(IsXDigit(static_cast<char>('0' | 0x80)));
} }
TEST(IsXDigitTest, WorksForWideAscii) { TEST(IsXDigitTest, WorksForWideAscii) {
......
...@@ -52,13 +52,13 @@ ...@@ -52,13 +52,13 @@
// hash_map and hash_set are available under Visual C++, or on Linux. // hash_map and hash_set are available under Visual C++, or on Linux.
#if GTEST_HAS_UNORDERED_MAP_ #if GTEST_HAS_UNORDERED_MAP_
# include <unordered_map> // NOLINT # include <unordered_map> // NOLINT
#elif GTEST_HAS_HASH_MAP_ #elif GTEST_HAS_HASH_MAP_
# include <hash_map> // NOLINT # include <hash_map> // NOLINT
#endif // GTEST_HAS_HASH_MAP_ #endif // GTEST_HAS_HASH_MAP_
#if GTEST_HAS_UNORDERED_SET_ #if GTEST_HAS_UNORDERED_SET_
# include <unordered_set> // NOLINT # include <unordered_set> // NOLINT
#elif GTEST_HAS_HASH_SET_ #elif GTEST_HAS_HASH_SET_
# include <hash_set> // NOLINT # include <hash_set> // NOLINT
#endif // GTEST_HAS_HASH_SET_ #endif // GTEST_HAS_HASH_SET_
...@@ -192,13 +192,12 @@ inline ::std::ostream& operator<<(::std::ostream& os, ...@@ -192,13 +192,12 @@ inline ::std::ostream& operator<<(::std::ostream& os,
return os << "StreamableTemplateInFoo: " << x.value(); return os << "StreamableTemplateInFoo: " << x.value();
} }
// A user-defined streamable but recursivly-defined container type in // A user-defined streamable but recursivly-defined container type in
// a user namespace, it mimics therefore std::filesystem::path or // a user namespace, it mimics therefore std::filesystem::path or
// boost::filesystem::path. // boost::filesystem::path.
class PathLike { class PathLike {
public: public:
struct iterator struct iterator {
{
typedef PathLike value_type; typedef PathLike value_type;
}; };
typedef iterator const_iterator; typedef iterator const_iterator;
...@@ -208,9 +207,7 @@ class PathLike { ...@@ -208,9 +207,7 @@ class PathLike {
iterator begin() const { return iterator(); } iterator begin() const { return iterator(); }
iterator end() const { return iterator(); } iterator end() const { return iterator(); }
friend friend ::std::ostream& operator<<(::std::ostream& os, const PathLike&) {
::std::ostream& operator<<(::std::ostream& os, const PathLike&)
{
return os << "Streamable-PathLike"; return os << "Streamable-PathLike";
} }
}; };
...@@ -250,9 +247,9 @@ using ::testing::internal::string; ...@@ -250,9 +247,9 @@ using ::testing::internal::string;
#if GTEST_HAS_UNORDERED_MAP_ #if GTEST_HAS_UNORDERED_MAP_
#define GTEST_HAS_HASH_MAP_ 1 #define GTEST_HAS_HASH_MAP_ 1
template<class Key, class T> template <class Key, class T>
using hash_map = ::std::unordered_map<Key, T>; using hash_map = ::std::unordered_map<Key, T>;
template<class Key, class T> template <class Key, class T>
using hash_multimap = ::std::unordered_multimap<Key, T>; using hash_multimap = ::std::unordered_multimap<Key, T>;
#elif GTEST_HAS_HASH_MAP_ #elif GTEST_HAS_HASH_MAP_
...@@ -270,9 +267,9 @@ using ::stdext::hash_multimap; ...@@ -270,9 +267,9 @@ using ::stdext::hash_multimap;
#if GTEST_HAS_UNORDERED_SET_ #if GTEST_HAS_UNORDERED_SET_
#define GTEST_HAS_HASH_SET_ 1 #define GTEST_HAS_HASH_SET_ 1
template<class Key> template <class Key>
using hash_set = ::std::unordered_set<Key>; using hash_set = ::std::unordered_set<Key>;
template<class Key> template <class Key>
using hash_multiset = ::std::unordered_multiset<Key>; using hash_multiset = ::std::unordered_multiset<Key>;
#elif GTEST_HAS_HASH_SET_ #elif GTEST_HAS_HASH_SET_
...@@ -1092,7 +1089,7 @@ TEST(PrintTr1TupleTest, VariousSizes) { ...@@ -1092,7 +1089,7 @@ TEST(PrintTr1TupleTest, VariousSizes) {
::std::tr1::tuple<bool, char, short, testing::internal::Int32, // NOLINT ::std::tr1::tuple<bool, char, short, testing::internal::Int32, // NOLINT
testing::internal::Int64, float, double, const char*, void*, testing::internal::Int64, float, double, const char*, void*,
std::string> std::string>
t10(false, 'a', static_cast<short>(3), 4, 5, 1.5F, -2.5, str, t10(false, 'a', static_cast<short>(3), 4, 5, 1.5F, -2.5, str, // NOLINT
ImplicitCast_<void*>(NULL), "10"); ImplicitCast_<void*>(NULL), "10");
EXPECT_EQ("(false, 'a' (97, 0x61), 3, 4, 5, 1.5, -2.5, " + PrintPointer(str) + EXPECT_EQ("(false, 'a' (97, 0x61), 3, 4, 5, 1.5, -2.5, " + PrintPointer(str) +
" pointing to \"8\", NULL, \"10\")", " pointing to \"8\", NULL, \"10\")",
...@@ -1152,7 +1149,7 @@ TEST(PrintStdTupleTest, VariousSizes) { ...@@ -1152,7 +1149,7 @@ TEST(PrintStdTupleTest, VariousSizes) {
::std::tuple<bool, char, short, testing::internal::Int32, // NOLINT ::std::tuple<bool, char, short, testing::internal::Int32, // NOLINT
testing::internal::Int64, float, double, const char*, void*, testing::internal::Int64, float, double, const char*, void*,
std::string> std::string>
t10(false, 'a', static_cast<short>(3), 4, 5, 1.5F, -2.5, str, t10(false, 'a', static_cast<short>(3), 4, 5, 1.5F, -2.5, str, // NOLINT
ImplicitCast_<void*>(NULL), "10"); ImplicitCast_<void*>(NULL), "10");
EXPECT_EQ("(false, 'a' (97, 0x61), 3, 4, 5, 1.5, -2.5, " + PrintPointer(str) + EXPECT_EQ("(false, 'a' (97, 0x61), 3, 4, 5, 1.5, -2.5, " + PrintPointer(str) +
" pointing to \"8\", NULL, \"10\")", " pointing to \"8\", NULL, \"10\")",
......
...@@ -80,8 +80,7 @@ int main(int argc, char **argv) { ...@@ -80,8 +80,7 @@ int main(int argc, char **argv) {
SetUnhandledExceptionFilter(ExitWithExceptionCode); SetUnhandledExceptionFilter(ExitWithExceptionCode);
# endif # endif
#endif #endif // GTEST_OS_WINDOWS
testing::InitGoogleTest(&argc, argv); testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS(); return RUN_ALL_TESTS();
......
...@@ -36,15 +36,7 @@ ...@@ -36,15 +36,7 @@
#include <stdio.h> #include <stdio.h>
#include "gtest/gtest.h" #include "gtest/gtest.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
// their code.
#define GTEST_IMPLEMENTATION_ 1
#include "src/gtest-internal-inl.h" #include "src/gtest-internal-inl.h"
#undef GTEST_IMPLEMENTATION_
using testing::internal::ShouldUseColor; using testing::internal::ShouldUseColor;
......
...@@ -35,10 +35,7 @@ ...@@ -35,10 +35,7 @@
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include <iostream> #include <iostream>
#define GTEST_IMPLEMENTATION_ 1
#include "src/gtest-internal-inl.h" #include "src/gtest-internal-inl.h"
#undef GTEST_IMPLEMENTATION_
using ::std::cout; using ::std::cout;
......
...@@ -34,10 +34,7 @@ ...@@ -34,10 +34,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include "gtest/gtest.h" #include "gtest/gtest.h"
#define GTEST_IMPLEMENTATION_ 1 // Required for the next #include.
#include "src/gtest-internal-inl.h" #include "src/gtest-internal-inl.h"
#undef GTEST_IMPLEMENTATION_
namespace testing { namespace testing {
GTEST_DECLARE_string_(filter); GTEST_DECLARE_string_(filter);
......
...@@ -117,7 +117,6 @@ TEST(DISABLED_FoobarbazTest, TestA) { ...@@ -117,7 +117,6 @@ TEST(DISABLED_FoobarbazTest, TestA) {
FAIL() << "Expected failure."; FAIL() << "Expected failure.";
} }
#if GTEST_HAS_PARAM_TEST
class ParamTest : public testing::TestWithParam<int> { class ParamTest : public testing::TestWithParam<int> {
}; };
...@@ -129,7 +128,6 @@ TEST_P(ParamTest, TestY) { ...@@ -129,7 +128,6 @@ TEST_P(ParamTest, TestY) {
INSTANTIATE_TEST_CASE_P(SeqP, ParamTest, testing::Values(1, 2)); INSTANTIATE_TEST_CASE_P(SeqP, ParamTest, testing::Values(1, 2));
INSTANTIATE_TEST_CASE_P(SeqQ, ParamTest, testing::Values(5, 6)); INSTANTIATE_TEST_CASE_P(SeqQ, ParamTest, testing::Values(5, 6));
#endif // GTEST_HAS_PARAM_TEST
} // namespace } // namespace
......
...@@ -37,15 +37,7 @@ ...@@ -37,15 +37,7 @@
#include "gtest/gtest-spi.h" #include "gtest/gtest-spi.h"
#include "gtest/gtest.h" #include "gtest/gtest.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
// their code.
#define GTEST_IMPLEMENTATION_ 1
#include "src/gtest-internal-inl.h" #include "src/gtest-internal-inl.h"
#undef GTEST_IMPLEMENTATION_
#include <stdlib.h> #include <stdlib.h>
...@@ -757,8 +749,6 @@ TEST(ExpectFatalFailureTest, FailsWhenStatementThrows) { ...@@ -757,8 +749,6 @@ TEST(ExpectFatalFailureTest, FailsWhenStatementThrows) {
// This #ifdef block tests the output of value-parameterized tests. // This #ifdef block tests the output of value-parameterized tests.
#if GTEST_HAS_PARAM_TEST
std::string ParamNameFunc(const testing::TestParamInfo<std::string>& info) { std::string ParamNameFunc(const testing::TestParamInfo<std::string>& info) {
return info.param; return info.param;
} }
...@@ -779,8 +769,6 @@ INSTANTIATE_TEST_CASE_P(PrintingStrings, ...@@ -779,8 +769,6 @@ INSTANTIATE_TEST_CASE_P(PrintingStrings,
testing::Values(std::string("a")), testing::Values(std::string("a")),
ParamNameFunc); ParamNameFunc);
#endif // GTEST_HAS_PARAM_TEST
// This #ifdef block tests the output of typed tests. // This #ifdef block tests the output of typed tests.
#if GTEST_HAS_TYPED_TEST #if GTEST_HAS_TYPED_TEST
......
...@@ -34,15 +34,7 @@ ...@@ -34,15 +34,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <iostream> #include <iostream>
#include "gtest/gtest.h" #include "gtest/gtest.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
// their code.
#define GTEST_IMPLEMENTATION_ 1
#include "src/gtest-internal-inl.h" #include "src/gtest-internal-inl.h"
#undef GTEST_IMPLEMENTATION_
namespace testing { namespace testing {
...@@ -119,7 +111,6 @@ TEST(BarDeathTest, ThreadSafeAndFast) { ...@@ -119,7 +111,6 @@ TEST(BarDeathTest, ThreadSafeAndFast) {
EXPECT_DEATH_IF_SUPPORTED(::testing::internal::posix::Abort(), ""); EXPECT_DEATH_IF_SUPPORTED(::testing::internal::posix::Abort(), "");
} }
#if GTEST_HAS_PARAM_TEST
int g_param_test_count = 0; int g_param_test_count = 0;
const int kNumberOfParamTests = 10; const int kNumberOfParamTests = 10;
...@@ -135,7 +126,6 @@ TEST_P(MyParamTest, ShouldPass) { ...@@ -135,7 +126,6 @@ TEST_P(MyParamTest, ShouldPass) {
INSTANTIATE_TEST_CASE_P(MyParamSequence, INSTANTIATE_TEST_CASE_P(MyParamSequence,
MyParamTest, MyParamTest,
testing::Range(0, kNumberOfParamTests)); testing::Range(0, kNumberOfParamTests));
#endif // GTEST_HAS_PARAM_TEST
// Resets the count for each test. // Resets the count for each test.
void ResetCounts() { void ResetCounts() {
...@@ -144,9 +134,7 @@ void ResetCounts() { ...@@ -144,9 +134,7 @@ void ResetCounts() {
g_should_fail_count = 0; g_should_fail_count = 0;
g_should_pass_count = 0; g_should_pass_count = 0;
g_death_test_count = 0; g_death_test_count = 0;
#if GTEST_HAS_PARAM_TEST
g_param_test_count = 0; g_param_test_count = 0;
#endif // GTEST_HAS_PARAM_TEST
} }
// Checks that the count for each test is expected. // Checks that the count for each test is expected.
...@@ -156,9 +144,7 @@ void CheckCounts(int expected) { ...@@ -156,9 +144,7 @@ void CheckCounts(int expected) {
GTEST_CHECK_INT_EQ_(expected, g_should_fail_count); GTEST_CHECK_INT_EQ_(expected, g_should_fail_count);
GTEST_CHECK_INT_EQ_(expected, g_should_pass_count); GTEST_CHECK_INT_EQ_(expected, g_should_pass_count);
GTEST_CHECK_INT_EQ_(expected, g_death_test_count); GTEST_CHECK_INT_EQ_(expected, g_death_test_count);
#if GTEST_HAS_PARAM_TEST
GTEST_CHECK_INT_EQ_(expected * kNumberOfParamTests, g_param_test_count); GTEST_CHECK_INT_EQ_(expected * kNumberOfParamTests, g_param_test_count);
#endif // GTEST_HAS_PARAM_TEST
} }
// Tests the behavior of Google Test when --gtest_repeat is not specified. // Tests the behavior of Google Test when --gtest_repeat is not specified.
...@@ -201,9 +187,7 @@ void TestRepeatWithFilterForSuccessfulTests(int repeat) { ...@@ -201,9 +187,7 @@ void TestRepeatWithFilterForSuccessfulTests(int repeat) {
GTEST_CHECK_INT_EQ_(0, g_should_fail_count); GTEST_CHECK_INT_EQ_(0, g_should_fail_count);
GTEST_CHECK_INT_EQ_(repeat, g_should_pass_count); GTEST_CHECK_INT_EQ_(repeat, g_should_pass_count);
GTEST_CHECK_INT_EQ_(repeat, g_death_test_count); GTEST_CHECK_INT_EQ_(repeat, g_death_test_count);
#if GTEST_HAS_PARAM_TEST
GTEST_CHECK_INT_EQ_(repeat * kNumberOfParamTests, g_param_test_count); GTEST_CHECK_INT_EQ_(repeat * kNumberOfParamTests, g_param_test_count);
#endif // GTEST_HAS_PARAM_TEST
} }
// Tests using --gtest_repeat when --gtest_filter specifies a set of // Tests using --gtest_repeat when --gtest_filter specifies a set of
...@@ -219,15 +203,14 @@ void TestRepeatWithFilterForFailedTests(int repeat) { ...@@ -219,15 +203,14 @@ void TestRepeatWithFilterForFailedTests(int repeat) {
GTEST_CHECK_INT_EQ_(repeat, g_should_fail_count); GTEST_CHECK_INT_EQ_(repeat, g_should_fail_count);
GTEST_CHECK_INT_EQ_(0, g_should_pass_count); GTEST_CHECK_INT_EQ_(0, g_should_pass_count);
GTEST_CHECK_INT_EQ_(0, g_death_test_count); GTEST_CHECK_INT_EQ_(0, g_death_test_count);
#if GTEST_HAS_PARAM_TEST
GTEST_CHECK_INT_EQ_(0, g_param_test_count); GTEST_CHECK_INT_EQ_(0, g_param_test_count);
#endif // GTEST_HAS_PARAM_TEST
} }
} // namespace } // namespace
int main(int argc, char **argv) { int main(int argc, char **argv) {
testing::InitGoogleTest(&argc, argv); testing::InitGoogleTest(&argc, argv);
testing::AddGlobalTestEnvironment(new MyEnvironment); testing::AddGlobalTestEnvironment(new MyEnvironment);
TestRepeatUnspecified(); TestRepeatUnspecified();
......
...@@ -34,15 +34,9 @@ ...@@ -34,15 +34,9 @@
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include <iostream>
#include <vector> #include <vector>
// We must define this macro in order to #include
// gtest-internal-inl.h. This is how Google Test prevents a user from
// accidentally depending on its internal implementation.
#define GTEST_IMPLEMENTATION_ 1
#include "src/gtest-internal-inl.h" #include "src/gtest-internal-inl.h"
#undef GTEST_IMPLEMENTATION_
#if GTEST_IS_THREADSAFE #if GTEST_IS_THREADSAFE
......
...@@ -66,15 +66,7 @@ TEST(CommandLineFlagsTest, CanBeAccessedInCodeOnceGTestHIsIncluded) { ...@@ -66,15 +66,7 @@ TEST(CommandLineFlagsTest, CanBeAccessedInCodeOnceGTestHIsIncluded) {
#include <ostream> #include <ostream>
#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
// their code.
#define GTEST_IMPLEMENTATION_ 1
#include "src/gtest-internal-inl.h" #include "src/gtest-internal-inl.h"
#undef GTEST_IMPLEMENTATION_
namespace testing { namespace testing {
namespace internal { namespace internal {
......
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// //
// Author: keith.ray@gmail.com (Keith Ray)
// //
// gtest_xml_outfile1_test_ writes some xml via TestProperty used by // gtest_xml_outfile1_test_ writes some xml via TestProperty used by
// gtest_xml_outfiles_test.py // gtest_xml_outfiles_test.py
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment