Commit c208d8df authored by Gennadiy Civil's avatar Gennadiy Civil Committed by GitHub
Browse files

Merge branch 'master' into master

parents 3eaba9f0 69e48e92
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
// implementation. It must come before gtest-internal-inl.h is // implementation. It must come before gtest-internal-inl.h is
// included, or there will be a compiler error. This trick is to // included, or there will be a compiler error. This trick is to
// prevent a user from accidentally including gtest-internal-inl.h in // prevent a user from accidentally including gtest-internal-inl.h in
// his code. // their code.
#define GTEST_IMPLEMENTATION_ 1 #define GTEST_IMPLEMENTATION_ 1
#include "src/gtest-internal-inl.h" #include "src/gtest-internal-inl.h"
#undef GTEST_IMPLEMENTATION_ #undef GTEST_IMPLEMENTATION_
......
...@@ -2682,7 +2682,7 @@ TEST(SynchronizationTest, CanCallMockMethodInAction) { ...@@ -2682,7 +2682,7 @@ TEST(SynchronizationTest, CanCallMockMethodInAction) {
} // namespace } // namespace
// Allows the user to define his own main and then invoke gmock_main // Allows the user to define their own main and then invoke gmock_main
// from it. This might be necessary on some platforms which require // from it. This might be necessary on some platforms which require
// specific setup and teardown. // specific setup and teardown.
#if GMOCK_RENAME_MAIN #if GMOCK_RENAME_MAIN
......
...@@ -27,6 +27,8 @@ option( ...@@ -27,6 +27,8 @@ option(
"Build gtest with internal symbols hidden in shared libraries." "Build gtest with internal symbols hidden in shared libraries."
OFF) OFF)
set(CMAKE_DEBUG_POSTFIX "d" CACHE STRING "Generate debug library name with a postfix.")
# Defines pre_project_set_up_hermetic_build() and set_up_hermetic_build(). # Defines pre_project_set_up_hermetic_build() and set_up_hermetic_build().
include(cmake/hermetic_build.cmake OPTIONAL) include(cmake/hermetic_build.cmake OPTIONAL)
...@@ -75,9 +77,6 @@ include_directories( ...@@ -75,9 +77,6 @@ include_directories(
${gtest_SOURCE_DIR}/include ${gtest_SOURCE_DIR}/include
${gtest_SOURCE_DIR}) ${gtest_SOURCE_DIR})
# Where Google Test's libraries can be found.
link_directories(${gtest_BINARY_DIR}/src)
# Summary of tuple support for Microsoft Visual Studio: # Summary of tuple support for Microsoft Visual Studio:
# Compiler version(MS) version(cmake) Support # Compiler version(MS) version(cmake) Support
# ---------- ----------- -------------- ----------------------------- # ---------- ----------- -------------- -----------------------------
......
...@@ -183,6 +183,17 @@ technique is discussed in more detail in ...@@ -183,6 +183,17 @@ technique is discussed in more detail in
which also contains a link to a fully generalized implementation which also contains a link to a fully generalized implementation
of the technique. of the technique.
##### Visual Studio Dynamic vs Static Runtimes #####
By default, new Visual Studio projects link the C runtimes dynamically
but Google Test links them statically.
This will generate an error that looks something like the following:
gtest.lib(gtest-all.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MTd_StaticDebug' doesn't match value 'MDd_DynamicDebug' in main.obj
Google Test already has a CMake option for this: `gtest_force_shared_crt`
Enabling this option will make gtest link the runtimes dynamically too,
and match the project in which it is included.
### Legacy Build Scripts ### ### Legacy Build Scripts ###
......
...@@ -48,10 +48,14 @@ endmacro() ...@@ -48,10 +48,14 @@ endmacro()
macro(config_compiler_and_linker) macro(config_compiler_and_linker)
# Note: pthreads on MinGW is not supported, even if available # Note: pthreads on MinGW is not supported, even if available
# instead, we use windows threading primitives # instead, we use windows threading primitives
unset(GTEST_HAS_PTHREAD)
if (NOT gtest_disable_pthreads AND NOT MINGW) if (NOT gtest_disable_pthreads AND NOT MINGW)
# Defines CMAKE_USE_PTHREADS_INIT and CMAKE_THREAD_LIBS_INIT. # Defines CMAKE_USE_PTHREADS_INIT and CMAKE_THREAD_LIBS_INIT.
set(THREADS_PREFER_PTHREAD_FLAG ON) set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads) find_package(Threads)
if (CMAKE_USE_PTHREADS_INIT)
set(GTEST_HAS_PTHREAD ON)
endif()
endif() endif()
fix_default_compiler_settings_() fix_default_compiler_settings_()
...@@ -94,7 +98,7 @@ macro(config_compiler_and_linker) ...@@ -94,7 +98,7 @@ macro(config_compiler_and_linker)
set(cxx_no_exception_flags "-D_HAS_EXCEPTIONS=0") set(cxx_no_exception_flags "-D_HAS_EXCEPTIONS=0")
set(cxx_no_rtti_flags "-GR-") set(cxx_no_rtti_flags "-GR-")
elseif (CMAKE_COMPILER_IS_GNUCXX) elseif (CMAKE_COMPILER_IS_GNUCXX)
set(cxx_base_flags "-Wall -Wshadow") set(cxx_base_flags "-Wall -Wshadow -Werror")
set(cxx_exception_flags "-fexceptions") set(cxx_exception_flags "-fexceptions")
set(cxx_no_exception_flags "-fno-exceptions") set(cxx_no_exception_flags "-fno-exceptions")
# Until version 4.3.2, GCC doesn't define a macro to indicate # Until version 4.3.2, GCC doesn't define a macro to indicate
...@@ -126,7 +130,8 @@ macro(config_compiler_and_linker) ...@@ -126,7 +130,8 @@ macro(config_compiler_and_linker)
set(cxx_no_rtti_flags "") set(cxx_no_rtti_flags "")
endif() endif()
if (CMAKE_USE_PTHREADS_INIT) # The pthreads library is available and allowed. # The pthreads library is available and allowed?
if (DEFINED GTEST_HAS_PTHREAD)
set(GTEST_HAS_PTHREAD_MACRO "-DGTEST_HAS_PTHREAD=1") set(GTEST_HAS_PTHREAD_MACRO "-DGTEST_HAS_PTHREAD=1")
else() else()
set(GTEST_HAS_PTHREAD_MACRO "-DGTEST_HAS_PTHREAD=0") set(GTEST_HAS_PTHREAD_MACRO "-DGTEST_HAS_PTHREAD=0")
...@@ -159,7 +164,7 @@ function(cxx_library_with_type name type cxx_flags) ...@@ -159,7 +164,7 @@ function(cxx_library_with_type name type cxx_flags)
PROPERTIES PROPERTIES
COMPILE_DEFINITIONS "GTEST_CREATE_SHARED_LIBRARY=1") COMPILE_DEFINITIONS "GTEST_CREATE_SHARED_LIBRARY=1")
endif() endif()
if (CMAKE_USE_PTHREADS_INIT) if (DEFINED GTEST_HAS_PTHREAD)
target_link_libraries(${name} ${CMAKE_THREAD_LIBS_INIT}) target_link_libraries(${name} ${CMAKE_THREAD_LIBS_INIT})
endif() endif()
endfunction() endfunction()
...@@ -236,23 +241,33 @@ endfunction() ...@@ -236,23 +241,33 @@ endfunction()
# creates a Python test with the given name whose main module is in # creates a Python test with the given name whose main module is in
# test/name.py. It does nothing if Python is not installed. # test/name.py. It does nothing if Python is not installed.
function(py_test name) function(py_test name)
# We are not supporting Python tests on Linux yet as they consider
# all Linux environments to be google3 and try to use google3 features.
if (PYTHONINTERP_FOUND) if (PYTHONINTERP_FOUND)
# ${CMAKE_BINARY_DIR} is known at configuration time, so we can
# directly bind it from cmake. ${CTEST_CONFIGURATION_TYPE} is known
# only at ctest runtime (by calling ctest -c <Configuration>), so
# we have to escape $ to delay variable substitution here.
if (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 3.1) if (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 3.1)
add_test( if (CMAKE_CONFIGURATION_TYPES)
NAME ${name} # Multi-configuration build generators as for Visual Studio save
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test/${name}.py # output in a subdirectory of CMAKE_CURRENT_BINARY_DIR (Debug,
--build_dir=${CMAKE_CURRENT_BINARY_DIR}/$<CONFIGURATION>) # Release etc.), so we have to provide it here.
add_test(
NAME ${name}
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test/${name}.py
--build_dir=${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>)
else (CMAKE_CONFIGURATION_TYPES)
# Single-configuration build generators like Makefile generators
# don't have subdirs below CMAKE_CURRENT_BINARY_DIR.
add_test(
NAME ${name}
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test/${name}.py
--build_dir=${CMAKE_CURRENT_BINARY_DIR})
endif (CMAKE_CONFIGURATION_TYPES)
else (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 3.1) else (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 3.1)
# ${CMAKE_CURRENT_BINARY_DIR} is known at configuration time, so we can
# directly bind it from cmake. ${CTEST_CONFIGURATION_TYPE} is known
# only at ctest runtime (by calling ctest -c <Configuration>), so
# we have to escape $ to delay variable substitution here.
add_test( add_test(
${name} ${name}
${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test/${name}.py ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test/${name}.py
--build_dir=${CMAKE_CURRENT_BINARY_DIR}/\${CTEST_CONFIGURATION_TYPE}) --build_dir=${CMAKE_CURRENT_BINARY_DIR}/\${CTEST_CONFIGURATION_TYPE})
endif (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 3.1) endif (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 3.1)
endif() endif(PYTHONINTERP_FOUND)
endfunction() endfunction()
...@@ -5,7 +5,7 @@ m4_include(m4/acx_pthread.m4) ...@@ -5,7 +5,7 @@ m4_include(m4/acx_pthread.m4)
# "[1.0.1]"). It also asumes that there won't be any closing parenthesis # "[1.0.1]"). It also asumes that there won't be any closing parenthesis
# between "AC_INIT(" and the closing ")" including comments and strings. # between "AC_INIT(" and the closing ")" including comments and strings.
AC_INIT([Google C++ Testing Framework], AC_INIT([Google C++ Testing Framework],
[1.7.0], [1.8.0],
[googletestframework@googlegroups.com], [googletestframework@googlegroups.com],
[gtest]) [gtest])
......
...@@ -1263,7 +1263,7 @@ known as <i>abstract tests</i>. As an example of its application, when you ...@@ -1263,7 +1263,7 @@ known as <i>abstract tests</i>. As an example of its application, when you
are designing an interface you can write a standard suite of abstract are designing an interface you can write a standard suite of abstract
tests (perhaps using a factory function as the test parameter) that tests (perhaps using a factory function as the test parameter) that
all implementations of the interface are expected to pass. When all implementations of the interface are expected to pass. When
someone implements the interface, he can instantiate your suite to get someone implements the interface, they can instantiate your suite to get
all the interface-conformance tests for free. all the interface-conformance tests for free.
To define abstract tests, you should organize your code like this: To define abstract tests, you should organize your code like this:
......
...@@ -102,9 +102,9 @@ Then every user of your machine can write tests without ...@@ -102,9 +102,9 @@ Then every user of your machine can write tests without
recompiling Google Test. recompiling Google Test.
This seemed like a good idea, but it has a This seemed like a good idea, but it has a
got-cha: every user needs to compile his tests using the _same_ compiler got-cha: every user needs to compile their tests using the _same_ compiler
flags used to compile the installed Google Test libraries; otherwise flags used to compile the installed Google Test libraries; otherwise
he may run into undefined behaviors (i.e. the tests can behave they may run into undefined behaviors (i.e. the tests can behave
strangely and may even crash for no obvious reasons). strangely and may even crash for no obvious reasons).
Why? Because C++ has this thing called the One-Definition Rule: if Why? Because C++ has this thing called the One-Definition Rule: if
...@@ -1034,7 +1034,7 @@ namespace bar { ...@@ -1034,7 +1034,7 @@ namespace bar {
TEST(CoolTest, DoSomething) { TEST(CoolTest, DoSomething) {
SUCCEED(); SUCCEED();
} }
} // namespace foo } // namespace bar
``` ```
However, the following code is **not allowed** and will produce a runtime error from Google Test because the test methods are using different test fixture classes with the same test case name. However, the following code is **not allowed** and will produce a runtime error from Google Test because the test methods are using different test fixture classes with the same test case name.
...@@ -1052,7 +1052,7 @@ class CoolTest : public ::testing::Test {}; // Fixture: bar::CoolTest ...@@ -1052,7 +1052,7 @@ class CoolTest : public ::testing::Test {}; // Fixture: bar::CoolTest
TEST_F(CoolTest, DoSomething) { TEST_F(CoolTest, DoSomething) {
SUCCEED(); SUCCEED();
} }
} // namespace foo } // namespace bar
``` ```
## How do I build Google Testing Framework with Xcode 4? ## ## How do I build Google Testing Framework with Xcode 4? ##
......
...@@ -40,7 +40,7 @@ maintain. ...@@ -40,7 +40,7 @@ maintain.
## Highlights ## ## Highlights ##
* The implementation is in a single Python script and thus ultra portable: no build or installation is needed and it works cross platforms. * The implementation is in a single Python script and thus ultra portable: no build or installation is needed and it works cross platforms.
* Pump tries to be smart with respect to [Google's style guide](http://code.google.com/p/google-styleguide/): it breaks long lines (easy to have when they are generated) at acceptable places to fit within 80 columns and indent the continuation lines correctly. * Pump tries to be smart with respect to [Google's style guide](https://github.com/google/styleguide): it breaks long lines (easy to have when they are generated) at acceptable places to fit within 80 columns and indent the continuation lines correctly.
* The format is human-readable and more concise than XML. * The format is human-readable and more concise than XML.
* The format works relatively well with Emacs' C++ mode. * The format works relatively well with Emacs' C++ mode.
......
...@@ -137,7 +137,8 @@ class TypeWithoutFormatter { ...@@ -137,7 +137,8 @@ class TypeWithoutFormatter {
public: public:
// This default version is called when kTypeKind is kOtherType. // This default version is called when kTypeKind is kOtherType.
static void PrintValue(const T& value, ::std::ostream* os) { static void PrintValue(const T& value, ::std::ostream* os) {
PrintBytesInObjectTo(reinterpret_cast<const unsigned char*>(&value), PrintBytesInObjectTo(static_cast<const unsigned char*>(
reinterpret_cast<const void *>(&value)),
sizeof(value), os); sizeof(value), os);
} }
}; };
......
...@@ -741,7 +741,7 @@ using ::std::tuple_size; ...@@ -741,7 +741,7 @@ using ::std::tuple_size;
# define _TR1_FUNCTIONAL 1 # define _TR1_FUNCTIONAL 1
# include <tr1/tuple> # include <tr1/tuple>
# undef _TR1_FUNCTIONAL // Allows the user to #include # undef _TR1_FUNCTIONAL // Allows the user to #include
// <tr1/functional> if he chooses to. // <tr1/functional> if they choose to.
# else # else
# include <tr1/tuple> // NOLINT # include <tr1/tuple> // NOLINT
# endif // !GTEST_HAS_RTTI && GTEST_GCC_VER_ < 40302 # endif // !GTEST_HAS_RTTI && GTEST_GCC_VER_ < 40302
...@@ -2591,10 +2591,6 @@ std::string StringFromGTestEnv(const char* flag, const char* default_val); ...@@ -2591,10 +2591,6 @@ std::string StringFromGTestEnv(const char* flag, const char* default_val);
} // namespace internal } // namespace internal
// Returns a path to temporary directory.
// Tries to determine an appropriate directory for the platform.
GTEST_API_ std::string TempDir();
} // namespace testing } // namespace testing
#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_H_ #endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_H_
...@@ -38,7 +38,6 @@ ...@@ -38,7 +38,6 @@
using ::testing::EmptyTestEventListener; using ::testing::EmptyTestEventListener;
using ::testing::InitGoogleTest; using ::testing::InitGoogleTest;
using ::testing::Test; using ::testing::Test;
using ::testing::TestCase;
using ::testing::TestEventListeners; using ::testing::TestEventListeners;
using ::testing::TestInfo; using ::testing::TestInfo;
using ::testing::TestPartResult; using ::testing::TestPartResult;
......
...@@ -52,7 +52,7 @@ EXAMPLES ...@@ -52,7 +52,7 @@ EXAMPLES
This tool is experimental. In particular, it assumes that there is no This tool is experimental. In particular, it assumes that there is no
conditional inclusion of Google Test headers. Please report any conditional inclusion of Google Test headers. Please report any
problems to googletestframework@googlegroups.com. You can read problems to googletestframework@googlegroups.com. You can read
http://code.google.com/p/googletest/wiki/GoogleTestAdvancedGuide for https://github.com/google/googletest/blob/master/googletest/docs/AdvancedGuide.md for
more information. more information.
""" """
......
...@@ -137,7 +137,7 @@ ...@@ -137,7 +137,7 @@
// implementation. It must come before gtest-internal-inl.h is // implementation. It must come before gtest-internal-inl.h is
// included, or there will be a compiler error. This trick is to // included, or there will be a compiler error. This trick is to
// prevent a user from accidentally including gtest-internal-inl.h in // prevent a user from accidentally including gtest-internal-inl.h in
// his code. // their code.
#define GTEST_IMPLEMENTATION_ 1 #define GTEST_IMPLEMENTATION_ 1
#include "src/gtest-internal-inl.h" #include "src/gtest-internal-inl.h"
#undef GTEST_IMPLEMENTATION_ #undef GTEST_IMPLEMENTATION_
...@@ -1313,13 +1313,14 @@ AssertionResult EqFailure(const char* lhs_expression, ...@@ -1313,13 +1313,14 @@ AssertionResult EqFailure(const char* lhs_expression,
const std::string& rhs_value, const std::string& rhs_value,
bool ignoring_case) { bool ignoring_case) {
Message msg; Message msg;
msg << " Expected: " << lhs_expression; msg << "Expected equality of these values:";
msg << "\n " << lhs_expression;
if (lhs_value != lhs_expression) { if (lhs_value != lhs_expression) {
msg << "\n Which is: " << lhs_value; msg << "\n Which is: " << lhs_value;
} }
msg << "\nTo be equal to: " << rhs_expression; msg << "\n " << rhs_expression;
if (rhs_value != rhs_expression) { if (rhs_value != rhs_expression) {
msg << "\n Which is: " << rhs_value; msg << "\n Which is: " << rhs_value;
} }
if (ignoring_case) { if (ignoring_case) {
...@@ -2569,10 +2570,10 @@ void ReportInvalidTestCaseType(const char* test_case_name, ...@@ -2569,10 +2570,10 @@ 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.";
fprintf(stderr, "%s %s", GTEST_LOG_(ERROR)
FormatFileLocation(code_location.file.c_str(), << FormatFileLocation(code_location.file.c_str(),
code_location.line).c_str(), code_location.line)
errors.GetString().c_str()); << " " << errors.GetString();
} }
#endif // GTEST_HAS_PARAM_TEST #endif // GTEST_HAS_PARAM_TEST
...@@ -3449,9 +3450,7 @@ class XmlUnitTestResultPrinter : public EmptyTestEventListener { ...@@ -3449,9 +3450,7 @@ class XmlUnitTestResultPrinter : public EmptyTestEventListener {
XmlUnitTestResultPrinter::XmlUnitTestResultPrinter(const char* output_file) XmlUnitTestResultPrinter::XmlUnitTestResultPrinter(const char* output_file)
: output_file_(output_file) { : output_file_(output_file) {
if (output_file_.c_str() == NULL || output_file_.empty()) { if (output_file_.c_str() == NULL || output_file_.empty()) {
fprintf(stderr, "XML output file may not be null\n"); GTEST_LOG_(FATAL) << "XML output file may not be null";
fflush(stderr);
exit(EXIT_FAILURE);
} }
} }
...@@ -3476,11 +3475,8 @@ void XmlUnitTestResultPrinter::OnTestIterationEnd(const UnitTest& unit_test, ...@@ -3476,11 +3475,8 @@ 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.
fprintf(stderr, GTEST_LOG_(FATAL) << "Unable to open file \""
"Unable to open file \"%s\"\n", << output_file_ << "\"";
output_file_.c_str());
fflush(stderr);
exit(EXIT_FAILURE);
} }
std::stringstream stream; std::stringstream stream;
PrintXmlUnitTest(&stream, unit_test); PrintXmlUnitTest(&stream, unit_test);
...@@ -4431,9 +4427,9 @@ void UnitTestImpl::ConfigureXmlOutput() { ...@@ -4431,9 +4427,9 @@ 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 != "") {
printf("WARNING: unrecognized output format \"%s\" ignored.\n", GTEST_LOG_(WARNING) << "WARNING: unrecognized output format \""
output_format.c_str()); << output_format
fflush(stdout); << "\" ignored.";
} }
} }
...@@ -4448,9 +4444,9 @@ void UnitTestImpl::ConfigureStreamingOutput() { ...@@ -4448,9 +4444,9 @@ 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 {
printf("WARNING: unrecognized streaming target \"%s\" ignored.\n", GTEST_LOG_(WARNING) << "unrecognized streaming target \""
target.c_str()); << target
fflush(stdout); << "\" ignored.";
} }
} }
} }
...@@ -4579,9 +4575,9 @@ static void TearDownEnvironment(Environment* env) { env->TearDown(); } ...@@ -4579,9 +4575,9 @@ 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()) {
printf("%s", 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.\n"); "before calling RUN_ALL_TESTS(). Please fix it.";
return false; return false;
} }
...@@ -4812,7 +4808,7 @@ bool ShouldRunTestOnShard(int total_shards, int shard_index, int test_id) { ...@@ -4812,7 +4808,7 @@ bool ShouldRunTestOnShard(int total_shards, int shard_index, int test_id) {
// each TestCase and TestInfo object. // each TestCase and TestInfo object.
// If shard_tests == true, further filters tests based on sharding // If shard_tests == true, further filters tests based on sharding
// variables in the environment - see // variables in the environment - see
// http://code.google.com/p/googletest/wiki/GoogleTestAdvancedGuide. // https://github.com/google/googletest/blob/master/googletest/docs/AdvancedGuide.md .
// Returns the number of tests that should run. // Returns the number of tests that should run.
int UnitTestImpl::FilterTests(ReactionToSharding shard_tests) { int UnitTestImpl::FilterTests(ReactionToSharding shard_tests) {
const Int32 total_shards = shard_tests == HONOR_SHARDING_PROTOCOL ? const Int32 total_shards = shard_tests == HONOR_SHARDING_PROTOCOL ?
...@@ -5281,11 +5277,9 @@ bool ParseGoogleTestFlag(const char* const arg) { ...@@ -5281,11 +5277,9 @@ bool ParseGoogleTestFlag(const char* const arg) {
void LoadFlagsFromFile(const std::string& path) { 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) {
fprintf(stderr, GTEST_LOG_(FATAL) << "Unable to open file \""
"Unable to open file \"%s\"\n", << GTEST_FLAG(flagfile)
GTEST_FLAG(flagfile).c_str()); << "\"";
fflush(stderr);
exit(EXIT_FAILURE);
} }
std::string contents(ReadEntireFile(flagfile)); std::string contents(ReadEntireFile(flagfile));
posix::FClose(flagfile); posix::FClose(flagfile);
......
...@@ -61,7 +61,7 @@ using testing::internal::AlwaysTrue; ...@@ -61,7 +61,7 @@ using testing::internal::AlwaysTrue;
// implementation. It must come before gtest-internal-inl.h is // implementation. It must come before gtest-internal-inl.h is
// included, or there will be a compiler error. This trick is to // included, or there will be a compiler error. This trick is to
// prevent a user from accidentally including gtest-internal-inl.h in // prevent a user from accidentally including gtest-internal-inl.h in
// his code. // their code.
# define GTEST_IMPLEMENTATION_ 1 # define GTEST_IMPLEMENTATION_ 1
# include "src/gtest-internal-inl.h" # include "src/gtest-internal-inl.h"
# undef GTEST_IMPLEMENTATION_ # undef GTEST_IMPLEMENTATION_
......
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
// implementation. It must come before gtest-internal-inl.h is // implementation. It must come before gtest-internal-inl.h is
// included, or there will be a compiler error. This trick is to // included, or there will be a compiler error. This trick is to
// prevent a user from accidentally including gtest-internal-inl.h in // prevent a user from accidentally including gtest-internal-inl.h in
// his code. // their code.
#define GTEST_IMPLEMENTATION_ 1 #define GTEST_IMPLEMENTATION_ 1
#include "src/gtest-internal-inl.h" #include "src/gtest-internal-inl.h"
#undef GTEST_IMPLEMENTATION_ #undef GTEST_IMPLEMENTATION_
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
// implementation. It must come before gtest-internal-inl.h is // implementation. It must come before gtest-internal-inl.h is
// included, or there will be a compiler error. This trick is to // included, or there will be a compiler error. This trick is to
// prevent a user from accidentally including gtest-internal-inl.h in // prevent a user from accidentally including gtest-internal-inl.h in
// his code. // their code.
#define GTEST_IMPLEMENTATION_ 1 #define GTEST_IMPLEMENTATION_ 1
#include "src/gtest-internal-inl.h" #include "src/gtest-internal-inl.h"
#undef GTEST_IMPLEMENTATION_ #undef GTEST_IMPLEMENTATION_
......
...@@ -141,7 +141,7 @@ void VerifyGenerator(const ParamGenerator<T>& generator, ...@@ -141,7 +141,7 @@ void VerifyGenerator(const ParamGenerator<T>& generator,
<< ", expected_values[i] is " << PrintValue(expected_values[i]) << ", expected_values[i] is " << PrintValue(expected_values[i])
<< ", *it is " << PrintValue(*it) << ", *it is " << PrintValue(*it)
<< ", and 'it' is an iterator created with the copy constructor.\n"; << ", and 'it' is an iterator created with the copy constructor.\n";
it++; ++it;
} }
EXPECT_TRUE(it == generator.end()) EXPECT_TRUE(it == generator.end())
<< "At the presumed end of sequence when accessing via an iterator " << "At the presumed end of sequence when accessing via an iterator "
...@@ -161,7 +161,7 @@ void VerifyGenerator(const ParamGenerator<T>& generator, ...@@ -161,7 +161,7 @@ void VerifyGenerator(const ParamGenerator<T>& generator,
<< ", expected_values[i] is " << PrintValue(expected_values[i]) << ", expected_values[i] is " << PrintValue(expected_values[i])
<< ", *it is " << PrintValue(*it) << ", *it is " << PrintValue(*it)
<< ", and 'it' is an iterator created with the copy constructor.\n"; << ", and 'it' is an iterator created with the copy constructor.\n";
it++; ++it;
} }
EXPECT_TRUE(it == generator.end()) EXPECT_TRUE(it == generator.end())
<< "At the presumed end of sequence when accessing via an iterator " << "At the presumed end of sequence when accessing via an iterator "
...@@ -196,7 +196,7 @@ TEST(IteratorTest, ParamIteratorConformsToForwardIteratorConcept) { ...@@ -196,7 +196,7 @@ TEST(IteratorTest, ParamIteratorConformsToForwardIteratorConcept) {
<< "element same as its source points to"; << "element same as its source points to";
// Verifies that iterator assignment works as expected. // Verifies that iterator assignment works as expected.
it++; ++it;
EXPECT_FALSE(*it == *it2); EXPECT_FALSE(*it == *it2);
it2 = it; it2 = it;
EXPECT_TRUE(*it == *it2) << "Assigned iterators must point to the " EXPECT_TRUE(*it == *it2) << "Assigned iterators must point to the "
...@@ -215,7 +215,7 @@ TEST(IteratorTest, ParamIteratorConformsToForwardIteratorConcept) { ...@@ -215,7 +215,7 @@ TEST(IteratorTest, ParamIteratorConformsToForwardIteratorConcept) {
// Verifies that prefix and postfix operator++() advance an iterator // Verifies that prefix and postfix operator++() advance an iterator
// all the same. // all the same.
it2 = it; it2 = it;
it++; ++it;
++it2; ++it2;
EXPECT_TRUE(*it == *it2); EXPECT_TRUE(*it == *it2);
} }
...@@ -857,8 +857,8 @@ TEST_P(CustomLambdaNamingTest, CustomTestNames) {} ...@@ -857,8 +857,8 @@ TEST_P(CustomLambdaNamingTest, CustomTestNames) {}
INSTANTIATE_TEST_CASE_P(CustomParamNameLambda, INSTANTIATE_TEST_CASE_P(CustomParamNameLambda,
CustomLambdaNamingTest, CustomLambdaNamingTest,
Values(std::string("LambdaName")), Values(std::string("LambdaName")),
[](const ::testing::TestParamInfo<std::string>& info) { [](const ::testing::TestParamInfo<std::string>& tpinfo) {
return info.param; return tpinfo.param;
}); });
#endif // GTEST_LANG_CXX11 #endif // GTEST_LANG_CXX11
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
// implementation. It must come before gtest-internal-inl.h is // implementation. It must come before gtest-internal-inl.h is
// included, or there will be a compiler error. This trick is to // included, or there will be a compiler error. This trick is to
// prevent a user from accidentally including gtest-internal-inl.h in // prevent a user from accidentally including gtest-internal-inl.h in
// his code. // their code.
#define GTEST_IMPLEMENTATION_ 1 #define GTEST_IMPLEMENTATION_ 1
#include "src/gtest-internal-inl.h" #include "src/gtest-internal-inl.h"
#undef GTEST_IMPLEMENTATION_ #undef GTEST_IMPLEMENTATION_
......
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