summaryrefslogtreecommitdiffstats
path: root/googletest
diff options
context:
space:
mode:
authorGennadiy Civil <gennadiycivil@users.noreply.github.com>2017-12-01 21:41:53 (GMT)
committerGitHub <noreply@github.com>2017-12-01 21:41:53 (GMT)
commit9e236748fb7c9e0d29cdcae0a9f4e1c062838f48 (patch)
tree1d961a5f52067643ace2651fd3aa8dfbf965e225 /googletest
parent4d26df729c4172a4786fb4ca509a264dfd9b89dc (diff)
parent247a3d8e5e5d403f7fcacdb8ccc71e5059f15daa (diff)
downloadgoogletest-9e236748fb7c9e0d29cdcae0a9f4e1c062838f48.zip
googletest-9e236748fb7c9e0d29cdcae0a9f4e1c062838f48.tar.gz
googletest-9e236748fb7c9e0d29cdcae0a9f4e1c062838f48.tar.bz2
Merge branch 'master' into masterrefs/pull/1225/head
Diffstat (limited to 'googletest')
-rw-r--r--googletest/.gitignore2
-rw-r--r--googletest/CMakeLists.txt5
-rw-r--r--googletest/README.md14
-rw-r--r--googletest/cmake/internal_utils.cmake51
-rw-r--r--googletest/configure.ac2
-rw-r--r--googletest/docs/AdvancedGuide.md6
-rw-r--r--googletest/docs/DevGuide.md4
-rw-r--r--googletest/docs/FAQ.md16
-rw-r--r--googletest/docs/PumpManual.md2
-rw-r--r--googletest/include/gtest/gtest-printers.h3
-rw-r--r--googletest/include/gtest/internal/gtest-port-arch.h2
-rw-r--r--googletest/include/gtest/internal/gtest-port.h27
-rw-r--r--googletest/samples/sample10_unittest.cc1
-rwxr-xr-xgoogletest/scripts/fuse_gtest_files.py2
-rw-r--r--googletest/src/gtest.cc64
-rw-r--r--googletest/test/gtest-death-test_test.cc2
-rw-r--r--googletest/test/gtest-filepath_test.cc2
-rw-r--r--googletest/test/gtest-options_test.cc2
-rw-r--r--googletest/test/gtest-param-test_test.cc12
-rw-r--r--googletest/test/gtest-port_test.cc2
-rw-r--r--googletest/test/gtest-printers_test.cc51
-rw-r--r--googletest/test/gtest_catch_exceptions_test_.cc2
-rw-r--r--googletest/test/gtest_color_test_.cc2
-rw-r--r--googletest/test/gtest_output_test_.cc2
-rw-r--r--googletest/test/gtest_output_test_golden_lin.txt134
-rw-r--r--googletest/test/gtest_repeat_test.cc2
-rw-r--r--googletest/test/gtest_unittest.cc116
-rwxr-xr-xgoogletest/test/gtest_xml_output_unittest.py21
28 files changed, 321 insertions, 230 deletions
diff --git a/googletest/.gitignore b/googletest/.gitignore
deleted file mode 100644
index 4b7be4b..0000000
--- a/googletest/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-# python
-*.pyc
diff --git a/googletest/CMakeLists.txt b/googletest/CMakeLists.txt
index 59343ed..b9a920b 100644
--- a/googletest/CMakeLists.txt
+++ b/googletest/CMakeLists.txt
@@ -27,6 +27,8 @@ option(
"Build gtest with internal symbols hidden in shared libraries."
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().
include(cmake/hermetic_build.cmake OPTIONAL)
@@ -75,9 +77,6 @@ include_directories(
${gtest_SOURCE_DIR}/include
${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:
# Compiler version(MS) version(cmake) Support
# ---------- ----------- -------------- -----------------------------
diff --git a/googletest/README.md b/googletest/README.md
index 0a3474c..f273a7d 100644
--- a/googletest/README.md
+++ b/googletest/README.md
@@ -161,7 +161,8 @@ Existing build's `CMakeLists.txt`:
# Add googletest directly to our build. This defines
# the gtest and gtest_main targets.
add_subdirectory(${CMAKE_BINARY_DIR}/googletest-src
- ${CMAKE_BINARY_DIR}/googletest-build)
+ ${CMAKE_BINARY_DIR}/googletest-build
+ EXCLUDE_FROM_ALL)
# The gtest/gtest_main targets carry header search path
# dependencies automatically when using CMake 2.8.11 or
@@ -182,6 +183,17 @@ technique is discussed in more detail in
which also contains a link to a fully generalized implementation
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 ###
diff --git a/googletest/cmake/internal_utils.cmake b/googletest/cmake/internal_utils.cmake
index f0f54d0..c54bc94 100644
--- a/googletest/cmake/internal_utils.cmake
+++ b/googletest/cmake/internal_utils.cmake
@@ -48,10 +48,14 @@ endmacro()
macro(config_compiler_and_linker)
# Note: pthreads on MinGW is not supported, even if available
# instead, we use windows threading primitives
+ unset(GTEST_HAS_PTHREAD)
if (NOT gtest_disable_pthreads AND NOT MINGW)
# Defines CMAKE_USE_PTHREADS_INIT and CMAKE_THREAD_LIBS_INIT.
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads)
+ if (CMAKE_USE_PTHREADS_INIT)
+ set(GTEST_HAS_PTHREAD ON)
+ endif()
endif()
fix_default_compiler_settings_()
@@ -83,10 +87,6 @@ macro(config_compiler_and_linker)
# http://stackoverflow.com/questions/3232669 explains the issue.
set(cxx_base_flags "${cxx_base_flags} -wd4702")
endif()
- if (NOT (MSVC_VERSION GREATER 1900)) # 1900 is Visual Studio 2015
- # BigObj required for tests.
- set(cxx_base_flags "${cxx_base_flags} -bigobj")
- endif()
set(cxx_base_flags "${cxx_base_flags} -D_UNICODE -DUNICODE -DWIN32 -D_WIN32")
set(cxx_base_flags "${cxx_base_flags} -DSTRICT -DWIN32_LEAN_AND_MEAN")
@@ -94,7 +94,7 @@ macro(config_compiler_and_linker)
set(cxx_no_exception_flags "-D_HAS_EXCEPTIONS=0")
set(cxx_no_rtti_flags "-GR-")
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_no_exception_flags "-fno-exceptions")
# Until version 4.3.2, GCC doesn't define a macro to indicate
@@ -126,7 +126,8 @@ macro(config_compiler_and_linker)
set(cxx_no_rtti_flags "")
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")
else()
set(GTEST_HAS_PTHREAD_MACRO "-DGTEST_HAS_PTHREAD=0")
@@ -159,7 +160,7 @@ function(cxx_library_with_type name type cxx_flags)
PROPERTIES
COMPILE_DEFINITIONS "GTEST_CREATE_SHARED_LIBRARY=1")
endif()
- if (CMAKE_USE_PTHREADS_INIT)
+ if (DEFINED GTEST_HAS_PTHREAD)
target_link_libraries(${name} ${CMAKE_THREAD_LIBS_INIT})
endif()
endfunction()
@@ -182,6 +183,10 @@ endfunction()
# is built from the given source files with the given compiler flags.
function(cxx_executable_with_flags name cxx_flags libs)
add_executable(${name} ${ARGN})
+ if (MSVC AND (NOT (MSVC_VERSION LESS 1700))) # 1700 is Visual Studio 2012.
+ # BigObj required for tests.
+ set(cxx_flags "${cxx_flags} -bigobj")
+ endif()
if (cxx_flags)
set_target_properties(${name}
PROPERTIES
@@ -236,23 +241,33 @@ endfunction()
# creates a Python test with the given name whose main module is in
# test/name.py. It does nothing if Python is not installed.
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)
- # ${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)
- add_test(
- NAME ${name}
- COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test/${name}.py
- --build_dir=${CMAKE_CURRENT_BINARY_DIR}/$<CONFIGURATION>)
+ if (CMAKE_CONFIGURATION_TYPES)
+ # Multi-configuration build generators as for Visual Studio save
+ # output in a subdirectory of CMAKE_CURRENT_BINARY_DIR (Debug,
+ # 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)
+ # ${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(
${name}
${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test/${name}.py
--build_dir=${CMAKE_CURRENT_BINARY_DIR}/\${CTEST_CONFIGURATION_TYPE})
endif (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 3.1)
- endif()
+ endif(PYTHONINTERP_FOUND)
endfunction()
diff --git a/googletest/configure.ac b/googletest/configure.ac
index cc592e1..254c8c4 100644
--- a/googletest/configure.ac
+++ b/googletest/configure.ac
@@ -5,7 +5,7 @@ m4_include(m4/acx_pthread.m4)
# "[1.0.1]"). It also asumes that there won't be any closing parenthesis
# between "AC_INIT(" and the closing ")" including comments and strings.
AC_INIT([Google C++ Testing Framework],
- [1.7.0],
+ [1.8.0],
[googletestframework@googlegroups.com],
[gtest])
diff --git a/googletest/docs/AdvancedGuide.md b/googletest/docs/AdvancedGuide.md
index a454bf4..e4dd94d 100644
--- a/googletest/docs/AdvancedGuide.md
+++ b/googletest/docs/AdvancedGuide.md
@@ -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
tests (perhaps using a factory function as the test parameter) that
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.
To define abstract tests, you should organize your code like this:
@@ -1623,8 +1623,8 @@ printf("We are in test %s of test case %s.\n",
```
`current_test_info()` returns a null pointer if no test is running. In
-particular, you cannot find the test case name in `TestCaseSetUp()`,
-`TestCaseTearDown()` (where you know the test case name implicitly), or
+particular, you cannot find the test case name in `SetUpTestCase()`,
+`TearDownTestCase()` (where you know the test case name implicitly), or
functions called from them.
_Availability:_ Linux, Windows, Mac.
diff --git a/googletest/docs/DevGuide.md b/googletest/docs/DevGuide.md
index 4333a8e..88a3de9 100644
--- a/googletest/docs/DevGuide.md
+++ b/googletest/docs/DevGuide.md
@@ -101,6 +101,10 @@ Please do submit code. Here's what you need to do:
1. Sign a Contributor License Agreement.
1. Create a Pull Request in the usual way.
+If you are a Googler, it is preferable to first create an internal change and
+have it reviewed and submitted, and then create an upstreaming pull
+request here.
+
## Google Test Committers ##
The current members of the Google Test engineering team are the only
diff --git a/googletest/docs/FAQ.md b/googletest/docs/FAQ.md
index 36f5f7f..1a216a1 100644
--- a/googletest/docs/FAQ.md
+++ b/googletest/docs/FAQ.md
@@ -102,9 +102,9 @@ Then every user of your machine can write tests without
recompiling Google Test.
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
-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).
Why? Because C++ has this thing called the One-Definition Rule: if
@@ -494,7 +494,7 @@ EXPECT_PRED1(IsPositive, 5);
However, this will work:
``` cpp
-EXPECT_PRED1(*static_cast<bool (*)(int)>*(IsPositive), 5);
+EXPECT_PRED1(static_cast<bool (*)(int)>(IsPositive), 5);
```
(The stuff inside the angled brackets for the `static_cast` operator is the
@@ -512,14 +512,14 @@ bool IsNegative(T x) {
you can use it in a predicate assertion like this:
``` cpp
-ASSERT_PRED1(IsNegative*<int>*, -5);
+ASSERT_PRED1(IsNegative<int>, -5);
```
Things are more interesting if your template has more than one parameters. The
following won't compile:
``` cpp
-ASSERT_PRED2(*GreaterThan<int, int>*, 5, 0);
+ASSERT_PRED2(GreaterThan<int, int>, 5, 0);
```
@@ -528,7 +528,7 @@ which is one more than expected. The workaround is to wrap the predicate
function in parentheses:
``` cpp
-ASSERT_PRED2(*(GreaterThan<int, int>)*, 5, 0);
+ASSERT_PRED2((GreaterThan<int, int>), 5, 0);
```
@@ -1034,7 +1034,7 @@ namespace bar {
TEST(CoolTest, DoSomething) {
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.
@@ -1052,7 +1052,7 @@ class CoolTest : public ::testing::Test {}; // Fixture: bar::CoolTest
TEST_F(CoolTest, DoSomething) {
SUCCEED();
}
-} // namespace foo
+} // namespace bar
```
## How do I build Google Testing Framework with Xcode 4? ##
diff --git a/googletest/docs/PumpManual.md b/googletest/docs/PumpManual.md
index 109c7f2..827bb24 100644
--- a/googletest/docs/PumpManual.md
+++ b/googletest/docs/PumpManual.md
@@ -40,7 +40,7 @@ maintain.
## Highlights ##
* 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 works relatively well with Emacs' C++ mode.
diff --git a/googletest/include/gtest/gtest-printers.h b/googletest/include/gtest/gtest-printers.h
index fba7661..282a2da 100644
--- a/googletest/include/gtest/gtest-printers.h
+++ b/googletest/include/gtest/gtest-printers.h
@@ -137,7 +137,8 @@ class TypeWithoutFormatter {
public:
// This default version is called when kTypeKind is kOtherType.
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);
}
};
diff --git a/googletest/include/gtest/internal/gtest-port-arch.h b/googletest/include/gtest/internal/gtest-port-arch.h
index f32fc06..bb20616 100644
--- a/googletest/include/gtest/internal/gtest-port-arch.h
+++ b/googletest/include/gtest/internal/gtest-port-arch.h
@@ -69,6 +69,8 @@
# endif
#elif defined __FreeBSD__
# define GTEST_OS_FREEBSD 1
+#elif defined __Fuchsia__
+# define GTEST_OS_FUCHSIA 1
#elif defined __linux__
# define GTEST_OS_LINUX 1
# if defined __ANDROID__
diff --git a/googletest/include/gtest/internal/gtest-port.h b/googletest/include/gtest/internal/gtest-port.h
index c2a9f5f..0c36007 100644
--- a/googletest/include/gtest/internal/gtest-port.h
+++ b/googletest/include/gtest/internal/gtest-port.h
@@ -122,6 +122,7 @@
// GTEST_OS_AIX - IBM AIX
// GTEST_OS_CYGWIN - Cygwin
// GTEST_OS_FREEBSD - FreeBSD
+// GTEST_OS_FUCHSIA - Fuchsia
// GTEST_OS_HPUX - HP-UX
// GTEST_OS_LINUX - Linux
// GTEST_OS_LINUX_ANDROID - Google Android
@@ -324,7 +325,7 @@
// -std={c,gnu}++{0x,11} is passed. The C++11 standard specifies a
// value for __cplusplus, and recent versions of clang, gcc, and
// probably other compilers set that too in C++11 mode.
-# if __GXX_EXPERIMENTAL_CXX0X__ || __cplusplus >= 201103L
+# if __GXX_EXPERIMENTAL_CXX0X__ || __cplusplus >= 201103L || _MSC_VER >= 1900
// Compiling in at least C++11 mode.
# define GTEST_LANG_CXX11 1
# else
@@ -356,12 +357,16 @@
#if GTEST_STDLIB_CXX11
# define GTEST_HAS_STD_BEGIN_AND_END_ 1
# define GTEST_HAS_STD_FORWARD_LIST_ 1
-# define GTEST_HAS_STD_FUNCTION_ 1
+# if !defined(_MSC_VER) || (_MSC_FULL_VER >= 190023824) // works only with VS2015U2 and better
+# define GTEST_HAS_STD_FUNCTION_ 1
+# endif
# define GTEST_HAS_STD_INITIALIZER_LIST_ 1
# define GTEST_HAS_STD_MOVE_ 1
# define GTEST_HAS_STD_SHARED_PTR_ 1
# define GTEST_HAS_STD_TYPE_TRAITS_ 1
# define GTEST_HAS_STD_UNIQUE_PTR_ 1
+# define GTEST_HAS_UNORDERED_MAP_ 1
+# define GTEST_HAS_UNORDERED_SET_ 1
#endif
// C++11 specifies that <tuple> provides std::tuple.
@@ -607,8 +612,9 @@ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION;
//
// To disable threading support in Google Test, add -DGTEST_HAS_PTHREAD=0
// to your compiler flags.
-# define GTEST_HAS_PTHREAD (GTEST_OS_LINUX || GTEST_OS_MAC || GTEST_OS_HPUX \
- || GTEST_OS_QNX || GTEST_OS_FREEBSD || GTEST_OS_NACL || GTEST_OS_NETBSD)
+#define GTEST_HAS_PTHREAD \
+ (GTEST_OS_LINUX || GTEST_OS_MAC || GTEST_OS_HPUX || GTEST_OS_QNX || \
+ GTEST_OS_FREEBSD || GTEST_OS_NACL || GTEST_OS_NETBSD || GTEST_OS_FUCHSIA)
#endif // GTEST_HAS_PTHREAD
#if GTEST_HAS_PTHREAD
@@ -658,7 +664,8 @@ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION;
// support TR1 tuple. libc++ only provides std::tuple, in C++11 mode,
// and it can be used with some compilers that define __GNUC__.
# if (defined(__GNUC__) && !defined(__CUDACC__) && (GTEST_GCC_VER_ >= 40000) \
- && !GTEST_OS_QNX && !defined(_LIBCPP_VERSION)) || _MSC_VER >= 1600
+ && !GTEST_OS_QNX && !defined(_LIBCPP_VERSION)) \
+ || (_MSC_VER >= 1600 && _MSC_VER < 1900)
# define GTEST_ENV_HAS_TR1_TUPLE_ 1
# endif
@@ -739,7 +746,7 @@ using ::std::tuple_size;
# define _TR1_FUNCTIONAL 1
# include <tr1/tuple>
# undef _TR1_FUNCTIONAL // Allows the user to #include
- // <tr1/functional> if he chooses to.
+ // <tr1/functional> if they choose to.
# else
# include <tr1/tuple> // NOLINT
# endif // !GTEST_HAS_RTTI && GTEST_GCC_VER_ < 40302
@@ -2059,7 +2066,7 @@ extern "C" inline void DeleteThreadLocalValue(void* value_holder) {
// Implements thread-local storage on pthreads-based systems.
template <typename T>
-class ThreadLocal {
+class GTEST_API_ ThreadLocal {
public:
ThreadLocal()
: key_(CreateKey()), default_factory_(new DefaultValueHolderFactory()) {}
@@ -2191,7 +2198,7 @@ class GTestMutexLock {
typedef GTestMutexLock MutexLock;
template <typename T>
-class ThreadLocal {
+class GTEST_API_ ThreadLocal {
public:
ThreadLocal() : value_() {}
explicit ThreadLocal(const T& value) : value_(value) {}
@@ -2589,10 +2596,6 @@ std::string StringFromGTestEnv(const char* flag, const char* default_val);
} // namespace internal
-// Returns a path to temporary directory.
-// Tries to determine an appropriate directory for the platform.
-GTEST_API_ std::string TempDir();
-
} // namespace testing
#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_H_
diff --git a/googletest/samples/sample10_unittest.cc b/googletest/samples/sample10_unittest.cc
index 977e5ff..10aa762 100644
--- a/googletest/samples/sample10_unittest.cc
+++ b/googletest/samples/sample10_unittest.cc
@@ -38,7 +38,6 @@
using ::testing::EmptyTestEventListener;
using ::testing::InitGoogleTest;
using ::testing::Test;
-using ::testing::TestCase;
using ::testing::TestEventListeners;
using ::testing::TestInfo;
using ::testing::TestPartResult;
diff --git a/googletest/scripts/fuse_gtest_files.py b/googletest/scripts/fuse_gtest_files.py
index 3f3e9f3..9a5c8d3 100755
--- a/googletest/scripts/fuse_gtest_files.py
+++ b/googletest/scripts/fuse_gtest_files.py
@@ -52,7 +52,7 @@ EXAMPLES
This tool is experimental. In particular, it assumes that there is no
conditional inclusion of Google Test headers. Please report any
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.
"""
diff --git a/googletest/src/gtest.cc b/googletest/src/gtest.cc
index b6087f9..749e829 100644
--- a/googletest/src/gtest.cc
+++ b/googletest/src/gtest.cc
@@ -137,7 +137,7 @@
// 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.
+// their code.
#define GTEST_IMPLEMENTATION_ 1
#include "src/gtest-internal-inl.h"
#undef GTEST_IMPLEMENTATION_
@@ -1313,13 +1313,14 @@ AssertionResult EqFailure(const char* lhs_expression,
const std::string& rhs_value,
bool ignoring_case) {
Message msg;
- msg << " Expected: " << lhs_expression;
+ msg << "Expected equality of these values:";
+ msg << "\n " << 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) {
- msg << "\n Which is: " << rhs_value;
+ msg << "\n Which is: " << rhs_value;
}
if (ignoring_case) {
@@ -2569,10 +2570,10 @@ void ReportInvalidTestCaseType(const char* test_case_name,
<< "probably rename one of the classes to put the tests into different\n"
<< "test cases.";
- fprintf(stderr, "%s %s",
- FormatFileLocation(code_location.file.c_str(),
- code_location.line).c_str(),
- errors.GetString().c_str());
+ GTEST_LOG_(ERROR)
+ << FormatFileLocation(code_location.file.c_str(),
+ code_location.line)
+ << " " << errors.GetString();
}
#endif // GTEST_HAS_PARAM_TEST
@@ -2883,7 +2884,7 @@ enum GTestColor {
};
#if GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_MOBILE && \
- !GTEST_OS_WINDOWS_PHONE && !GTEST_OS_WINDOWS_RT
+ !GTEST_OS_WINDOWS_PHONE && !GTEST_OS_WINDOWS_RT && !GTEST_OS_WINDOWS_MINGW
// Returns the character attribute for the given color.
WORD GetColorAttribute(GTestColor color) {
@@ -2942,7 +2943,7 @@ bool ShouldUseColor(bool stdout_is_tty) {
const char* const gtest_color = GTEST_FLAG(color).c_str();
if (String::CaseInsensitiveCStringEquals(gtest_color, "auto")) {
-#if GTEST_OS_WINDOWS
+#if GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_MINGW
// On Windows the TERM variable is usually not set, but the
// console there does support colors.
return stdout_is_tty;
@@ -3000,7 +3001,7 @@ void ColoredPrintf(GTestColor color, const char* fmt, ...) {
}
#if GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_MOBILE && \
- !GTEST_OS_WINDOWS_PHONE && !GTEST_OS_WINDOWS_RT
+ !GTEST_OS_WINDOWS_PHONE && !GTEST_OS_WINDOWS_RT && !GTEST_OS_WINDOWS_MINGW
const HANDLE stdout_handle = GetStdHandle(STD_OUTPUT_HANDLE);
// Gets the current text color.
@@ -3449,9 +3450,7 @@ class XmlUnitTestResultPrinter : public EmptyTestEventListener {
XmlUnitTestResultPrinter::XmlUnitTestResultPrinter(const char* output_file)
: output_file_(output_file) {
if (output_file_.c_str() == NULL || output_file_.empty()) {
- fprintf(stderr, "XML output file may not be null\n");
- fflush(stderr);
- exit(EXIT_FAILURE);
+ GTEST_LOG_(FATAL) << "XML output file may not be null";
}
}
@@ -3476,11 +3475,8 @@ void XmlUnitTestResultPrinter::OnTestIterationEnd(const UnitTest& unit_test,
// 3. To interpret the meaning of errno in a thread-safe way,
// we need the strerror_r() function, which is not available on
// Windows.
- fprintf(stderr,
- "Unable to open file \"%s\"\n",
- output_file_.c_str());
- fflush(stderr);
- exit(EXIT_FAILURE);
+ GTEST_LOG_(FATAL) << "Unable to open file \""
+ << output_file_ << "\"";
}
std::stringstream stream;
PrintXmlUnitTest(&stream, unit_test);
@@ -4431,9 +4427,9 @@ void UnitTestImpl::ConfigureXmlOutput() {
listeners()->SetDefaultXmlGenerator(new XmlUnitTestResultPrinter(
UnitTestOptions::GetAbsolutePathToOutputFile().c_str()));
} else if (output_format != "") {
- printf("WARNING: unrecognized output format \"%s\" ignored.\n",
- output_format.c_str());
- fflush(stdout);
+ GTEST_LOG_(WARNING) << "WARNING: unrecognized output format \""
+ << output_format
+ << "\" ignored.";
}
}
@@ -4448,9 +4444,9 @@ void UnitTestImpl::ConfigureStreamingOutput() {
listeners()->Append(new StreamingListener(target.substr(0, pos),
target.substr(pos+1)));
} else {
- printf("WARNING: unrecognized streaming target \"%s\" ignored.\n",
- target.c_str());
- fflush(stdout);
+ GTEST_LOG_(WARNING) << "unrecognized streaming target \""
+ << target
+ << "\" ignored.";
}
}
}
@@ -4579,9 +4575,9 @@ static void TearDownEnvironment(Environment* env) { env->TearDown(); }
bool UnitTestImpl::RunAllTests() {
// Makes sure InitGoogleTest() was called.
if (!GTestIsInitialized()) {
- printf("%s",
- "\nThis test program did NOT call ::testing::InitGoogleTest "
- "before calling RUN_ALL_TESTS(). Please fix it.\n");
+ GTEST_LOG_(ERROR) <<
+ "\nThis test program did NOT call ::testing::InitGoogleTest "
+ "before calling RUN_ALL_TESTS(). Please fix it.";
return false;
}
@@ -4812,7 +4808,7 @@ bool ShouldRunTestOnShard(int total_shards, int shard_index, int test_id) {
// each TestCase and TestInfo object.
// If shard_tests == true, further filters tests based on sharding
// 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.
int UnitTestImpl::FilterTests(ReactionToSharding shard_tests) {
const Int32 total_shards = shard_tests == HONOR_SHARDING_PROTOCOL ?
@@ -5281,11 +5277,9 @@ bool ParseGoogleTestFlag(const char* const arg) {
void LoadFlagsFromFile(const std::string& path) {
FILE* flagfile = posix::FOpen(path.c_str(), "r");
if (!flagfile) {
- fprintf(stderr,
- "Unable to open file \"%s\"\n",
- GTEST_FLAG(flagfile).c_str());
- fflush(stderr);
- exit(EXIT_FAILURE);
+ GTEST_LOG_(FATAL) << "Unable to open file \""
+ << GTEST_FLAG(flagfile)
+ << "\"";
}
std::string contents(ReadEntireFile(flagfile));
posix::FClose(flagfile);
diff --git a/googletest/test/gtest-death-test_test.cc b/googletest/test/gtest-death-test_test.cc
index 957fe38..85021e3 100644
--- a/googletest/test/gtest-death-test_test.cc
+++ b/googletest/test/gtest-death-test_test.cc
@@ -61,7 +61,7 @@ using testing::internal::AlwaysTrue;
// 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.
+// their code.
# define GTEST_IMPLEMENTATION_ 1
# include "src/gtest-internal-inl.h"
# undef GTEST_IMPLEMENTATION_
diff --git a/googletest/test/gtest-filepath_test.cc b/googletest/test/gtest-filepath_test.cc
index da72986..22f4ed6 100644
--- a/googletest/test/gtest-filepath_test.cc
+++ b/googletest/test/gtest-filepath_test.cc
@@ -45,7 +45,7 @@
// 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.
+// their code.
#define GTEST_IMPLEMENTATION_ 1
#include "src/gtest-internal-inl.h"
#undef GTEST_IMPLEMENTATION_
diff --git a/googletest/test/gtest-options_test.cc b/googletest/test/gtest-options_test.cc
index 5586dc3..88c6e9a 100644
--- a/googletest/test/gtest-options_test.cc
+++ b/googletest/test/gtest-options_test.cc
@@ -50,7 +50,7 @@
// 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.
+// their code.
#define GTEST_IMPLEMENTATION_ 1
#include "src/gtest-internal-inl.h"
#undef GTEST_IMPLEMENTATION_
diff --git a/googletest/test/gtest-param-test_test.cc b/googletest/test/gtest-param-test_test.cc
index 8b278bb..d1b0644 100644
--- a/googletest/test/gtest-param-test_test.cc
+++ b/googletest/test/gtest-param-test_test.cc
@@ -141,7 +141,7 @@ void VerifyGenerator(const ParamGenerator<T>& generator,
<< ", expected_values[i] is " << PrintValue(expected_values[i])
<< ", *it is " << PrintValue(*it)
<< ", and 'it' is an iterator created with the copy constructor.\n";
- it++;
+ ++it;
}
EXPECT_TRUE(it == generator.end())
<< "At the presumed end of sequence when accessing via an iterator "
@@ -161,7 +161,7 @@ void VerifyGenerator(const ParamGenerator<T>& generator,
<< ", expected_values[i] is " << PrintValue(expected_values[i])
<< ", *it is " << PrintValue(*it)
<< ", and 'it' is an iterator created with the copy constructor.\n";
- it++;
+ ++it;
}
EXPECT_TRUE(it == generator.end())
<< "At the presumed end of sequence when accessing via an iterator "
@@ -196,7 +196,7 @@ TEST(IteratorTest, ParamIteratorConformsToForwardIteratorConcept) {
<< "element same as its source points to";
// Verifies that iterator assignment works as expected.
- it++;
+ ++it;
EXPECT_FALSE(*it == *it2);
it2 = it;
EXPECT_TRUE(*it == *it2) << "Assigned iterators must point to the "
@@ -215,7 +215,7 @@ TEST(IteratorTest, ParamIteratorConformsToForwardIteratorConcept) {
// Verifies that prefix and postfix operator++() advance an iterator
// all the same.
it2 = it;
- it++;
+ ++it;
++it2;
EXPECT_TRUE(*it == *it2);
}
@@ -857,8 +857,8 @@ TEST_P(CustomLambdaNamingTest, CustomTestNames) {}
INSTANTIATE_TEST_CASE_P(CustomParamNameLambda,
CustomLambdaNamingTest,
Values(std::string("LambdaName")),
- [](const ::testing::TestParamInfo<std::string>& info) {
- return info.param;
+ [](const ::testing::TestParamInfo<std::string>& tpinfo) {
+ return tpinfo.param;
});
#endif // GTEST_LANG_CXX11
diff --git a/googletest/test/gtest-port_test.cc b/googletest/test/gtest-port_test.cc
index 1d25ee6..62ee11b 100644
--- a/googletest/test/gtest-port_test.cc
+++ b/googletest/test/gtest-port_test.cc
@@ -50,7 +50,7 @@
// 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.
+// their code.
#define GTEST_IMPLEMENTATION_ 1
#include "src/gtest-internal-inl.h"
#undef GTEST_IMPLEMENTATION_
diff --git a/googletest/test/gtest-printers_test.cc b/googletest/test/gtest-printers_test.cc
index 487d3cb..2a6c017 100644
--- a/googletest/test/gtest-printers_test.cc
+++ b/googletest/test/gtest-printers_test.cc
@@ -51,10 +51,15 @@
#include "gtest/gtest.h"
// hash_map and hash_set are available under Visual C++, or on Linux.
-#if GTEST_HAS_HASH_MAP_
+#if GTEST_HAS_UNORDERED_MAP_
+# include <unordered_map> // NOLINT
+#elif GTEST_HAS_HASH_MAP_
# include <hash_map> // NOLINT
#endif // GTEST_HAS_HASH_MAP_
-#if GTEST_HAS_HASH_SET_
+
+#if GTEST_HAS_UNORDERED_SET_
+# include <unordered_set> // NOLINT
+#elif GTEST_HAS_HASH_SET_
# include <hash_set> // NOLINT
#endif // GTEST_HAS_HASH_SET_
@@ -239,21 +244,47 @@ using ::testing::internal::UniversalTersePrintTupleFieldsToStrings;
#endif
using ::testing::internal::string;
-#if GTEST_HAS_HASH_MAP_
// The hash_* classes are not part of the C++ standard. STLport
// defines them in namespace std. MSVC defines them in ::stdext. GCC
// defines them in ::.
+#if GTEST_HAS_UNORDERED_MAP_
+
+#define GTEST_HAS_HASH_MAP_ 1
+template<class Key, class T>
+using hash_map = ::std::unordered_map<Key, T>;
+template<class Key, class T>
+using hash_multimap = ::std::unordered_multimap<Key, T>;
+
+#elif GTEST_HAS_HASH_MAP_
+
#ifdef _STLP_HASH_MAP // We got <hash_map> from STLport.
using ::std::hash_map;
-using ::std::hash_set;
using ::std::hash_multimap;
-using ::std::hash_multiset;
#elif _MSC_VER
using ::stdext::hash_map;
-using ::stdext::hash_set;
using ::stdext::hash_multimap;
+#endif
+
+#endif
+
+#if GTEST_HAS_UNORDERED_SET_
+
+#define GTEST_HAS_HASH_SET_ 1
+template<class Key>
+using hash_set = ::std::unordered_set<Key>;
+template<class Key>
+using hash_multiset = ::std::unordered_multiset<Key>;
+
+#elif GTEST_HAS_HASH_SET_
+
+#ifdef _STLP_HASH_MAP // We got <hash_map> from STLport.
+using ::std::hash_set;
+using ::std::hash_multiset;
+#elif _MSC_VER
+using ::stdext::hash_set;
using ::stdext::hash_multiset;
#endif
+
#endif
// Prints a value to a string using the universal value printer. This
@@ -1061,8 +1092,8 @@ TEST(PrintTr1TupleTest, VariousSizes) {
::std::tr1::tuple<bool, char, short, testing::internal::Int32, // NOLINT
testing::internal::Int64, float, double, const char*, void*,
std::string>
- t10(false, 'a', 3, 4, 5, 1.5F, -2.5, str, ImplicitCast_<void*>(NULL),
- "10");
+ t10(false, 'a', static_cast<short>(3), 4, 5, 1.5F, -2.5, str,
+ ImplicitCast_<void*>(NULL), "10");
EXPECT_EQ("(false, 'a' (97, 0x61), 3, 4, 5, 1.5, -2.5, " + PrintPointer(str) +
" pointing to \"8\", NULL, \"10\")",
Print(t10));
@@ -1121,8 +1152,8 @@ TEST(PrintStdTupleTest, VariousSizes) {
::std::tuple<bool, char, short, testing::internal::Int32, // NOLINT
testing::internal::Int64, float, double, const char*, void*,
std::string>
- t10(false, 'a', 3, 4, 5, 1.5F, -2.5, str, ImplicitCast_<void*>(NULL),
- "10");
+ t10(false, 'a', static_cast<short>(3), 4, 5, 1.5F, -2.5, str,
+ ImplicitCast_<void*>(NULL), "10");
EXPECT_EQ("(false, 'a' (97, 0x61), 3, 4, 5, 1.5, -2.5, " + PrintPointer(str) +
" pointing to \"8\", NULL, \"10\")",
Print(t10));
diff --git a/googletest/test/gtest_catch_exceptions_test_.cc b/googletest/test/gtest_catch_exceptions_test_.cc
index b42637e..c6d953c 100644
--- a/googletest/test/gtest_catch_exceptions_test_.cc
+++ b/googletest/test/gtest_catch_exceptions_test_.cc
@@ -138,7 +138,7 @@ TEST_F(CxxExceptionInConstructorTest, ThrowsExceptionInConstructor) {
}
// Exceptions in destructors are not supported in C++11.
-#if !defined(__GXX_EXPERIMENTAL_CXX0X__) && __cplusplus < 201103L && _MSC_VER < 1900
+#if !GTEST_LANG_CXX11
class CxxExceptionInDestructorTest : public Test {
public:
static void TearDownTestCase() {
diff --git a/googletest/test/gtest_color_test_.cc b/googletest/test/gtest_color_test_.cc
index f61ebb8..672069c 100644
--- a/googletest/test/gtest_color_test_.cc
+++ b/googletest/test/gtest_color_test_.cc
@@ -41,7 +41,7 @@
// 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.
+// their code.
#define GTEST_IMPLEMENTATION_ 1
#include "src/gtest-internal-inl.h"
#undef GTEST_IMPLEMENTATION_
diff --git a/googletest/test/gtest_output_test_.cc b/googletest/test/gtest_output_test_.cc
index 1070a9f..e5fa764 100644
--- a/googletest/test/gtest_output_test_.cc
+++ b/googletest/test/gtest_output_test_.cc
@@ -42,7 +42,7 @@
// 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.
+// their code.
#define GTEST_IMPLEMENTATION_ 1
#include "src/gtest-internal-inl.h"
#undef GTEST_IMPLEMENTATION_
diff --git a/googletest/test/gtest_output_test_golden_lin.txt b/googletest/test/gtest_output_test_golden_lin.txt
index 2223d56..677d9f4 100644
--- a/googletest/test/gtest_output_test_golden_lin.txt
+++ b/googletest/test/gtest_output_test_golden_lin.txt
@@ -5,8 +5,9 @@ Value of: false
Actual: false
Expected: true
gtest_output_test_.cc:#: Failure
- Expected: 2
-To be equal to: 3
+Expected equality of these values:
+ 2
+ 3
[==========] Running 66 tests from 29 test cases.
[----------] Global test environment set-up.
FooEnvironment::SetUp() called.
@@ -34,21 +35,24 @@ BarEnvironment::SetUp() called.
[----------] 2 tests from NonfatalFailureTest
[ RUN ] NonfatalFailureTest.EscapesStringOperands
gtest_output_test_.cc:#: Failure
- Expected: kGoldenString
- Which is: "\"Line"
-To be equal to: actual
- Which is: "actual \"string\""
-gtest_output_test_.cc:#: Failure
- Expected: golden
- Which is: "\"Line"
-To be equal to: actual
- Which is: "actual \"string\""
+Expected equality of these values:
+ kGoldenString
+ Which is: "\"Line"
+ actual
+ Which is: "actual \"string\""
+gtest_output_test_.cc:#: Failure
+Expected equality of these values:
+ golden
+ Which is: "\"Line"
+ actual
+ Which is: "actual \"string\""
[ FAILED ] NonfatalFailureTest.EscapesStringOperands
[ RUN ] NonfatalFailureTest.DiffForLongStrings
gtest_output_test_.cc:#: Failure
- Expected: golden_str
- Which is: "\"Line\0 1\"\nLine 2"
-To be equal to: "Line 2"
+Expected equality of these values:
+ golden_str
+ Which is: "\"Line\0 1\"\nLine 2"
+ "Line 2"
With diff:
@@ -1,2 @@
-\"Line\0 1\"
@@ -59,16 +63,18 @@ With diff:
[ RUN ] FatalFailureTest.FatalFailureInSubroutine
(expecting a failure that x should be 1)
gtest_output_test_.cc:#: Failure
- Expected: 1
-To be equal to: x
- Which is: 2
+Expected equality of these values:
+ 1
+ x
+ Which is: 2
[ FAILED ] FatalFailureTest.FatalFailureInSubroutine
[ RUN ] FatalFailureTest.FatalFailureInNestedSubroutine
(expecting a failure that x should be 1)
gtest_output_test_.cc:#: Failure
- Expected: 1
-To be equal to: x
- Which is: 2
+Expected equality of these values:
+ 1
+ x
+ Which is: 2
[ FAILED ] FatalFailureTest.FatalFailureInNestedSubroutine
[ RUN ] FatalFailureTest.NonfatalFailureInSubroutine
(expecting a failure on false)
@@ -107,39 +113,44 @@ This failure is expected, and shouldn't have a trace.
[ RUN ] SCOPED_TRACETest.WorksInLoop
(expected to fail)
gtest_output_test_.cc:#: Failure
- Expected: 2
-To be equal to: n
- Which is: 1
+Expected equality of these values:
+ 2
+ n
+ Which is: 1
Google Test trace:
gtest_output_test_.cc:#: i = 1
gtest_output_test_.cc:#: Failure
- Expected: 1
-To be equal to: n
- Which is: 2
+Expected equality of these values:
+ 1
+ n
+ Which is: 2
Google Test trace:
gtest_output_test_.cc:#: i = 2
[ FAILED ] SCOPED_TRACETest.WorksInLoop
[ RUN ] SCOPED_TRACETest.WorksInSubroutine
(expected to fail)
gtest_output_test_.cc:#: Failure
- Expected: 2
-To be equal to: n
- Which is: 1
+Expected equality of these values:
+ 2
+ n
+ Which is: 1
Google Test trace:
gtest_output_test_.cc:#: n = 1
gtest_output_test_.cc:#: Failure
- Expected: 1
-To be equal to: n
- Which is: 2
+Expected equality of these values:
+ 1
+ n
+ Which is: 2
Google Test trace:
gtest_output_test_.cc:#: n = 2
[ FAILED ] SCOPED_TRACETest.WorksInSubroutine
[ RUN ] SCOPED_TRACETest.CanBeNested
(expected to fail)
gtest_output_test_.cc:#: Failure
- Expected: 1
-To be equal to: n
- Which is: 2
+Expected equality of these values:
+ 1
+ n
+ Which is: 2
Google Test trace:
gtest_output_test_.cc:#: n = 2
gtest_output_test_.cc:#:
@@ -437,9 +448,10 @@ Expected: 1 fatal failure
[ OK ] TypedTest/0.Success
[ RUN ] TypedTest/0.Failure
gtest_output_test_.cc:#: Failure
- Expected: 1
-To be equal to: TypeParam()
- Which is: 0
+Expected equality of these values:
+ 1
+ TypeParam()
+ Which is: 0
Expected failure
[ FAILED ] TypedTest/0.Failure, where TypeParam = int
[----------] 2 tests from Unsigned/TypedTestP/0, where TypeParam = unsigned char
@@ -447,10 +459,11 @@ Expected failure
[ OK ] Unsigned/TypedTestP/0.Success
[ RUN ] Unsigned/TypedTestP/0.Failure
gtest_output_test_.cc:#: Failure
- Expected: 1U
- Which is: 1
-To be equal to: TypeParam()
- Which is: '\0'
+Expected equality of these values:
+ 1U
+ Which is: 1
+ TypeParam()
+ Which is: '\0'
Expected failure
[ FAILED ] Unsigned/TypedTestP/0.Failure, where TypeParam = unsigned char
[----------] 2 tests from Unsigned/TypedTestP/1, where TypeParam = unsigned int
@@ -458,10 +471,11 @@ Expected failure
[ OK ] Unsigned/TypedTestP/1.Success
[ RUN ] Unsigned/TypedTestP/1.Failure
gtest_output_test_.cc:#: Failure
- Expected: 1U
- Which is: 1
-To be equal to: TypeParam()
- Which is: 0
+Expected equality of these values:
+ 1U
+ Which is: 1
+ TypeParam()
+ Which is: 0
Expected failure
[ FAILED ] Unsigned/TypedTestP/1.Failure, where TypeParam = unsigned int
[----------] 4 tests from ExpectFailureTest
@@ -597,18 +611,20 @@ Expected non-fatal failure.
[----------] 1 test from PrintingFailingParams/FailingParamTest
[ RUN ] PrintingFailingParams/FailingParamTest.Fails/0
gtest_output_test_.cc:#: Failure
- Expected: 1
-To be equal to: GetParam()
- Which is: 2
+Expected equality of these values:
+ 1
+ GetParam()
+ Which is: 2
[ FAILED ] PrintingFailingParams/FailingParamTest.Fails/0, where GetParam() = 2
[----------] 2 tests from PrintingStrings/ParamTest
[ RUN ] PrintingStrings/ParamTest.Success/a
[ OK ] PrintingStrings/ParamTest.Success/a
[ RUN ] PrintingStrings/ParamTest.Failure/a
gtest_output_test_.cc:#: Failure
- Expected: "b"
-To be equal to: GetParam()
- Which is: "a"
+Expected equality of these values:
+ "b"
+ GetParam()
+ Which is: "a"
Expected failure
[ FAILED ] PrintingStrings/ParamTest.Failure/a, where GetParam() = "a"
[----------] Global test environment tear-down
@@ -678,16 +694,18 @@ Expected fatal failure.
[ RUN ] FatalFailureTest.FatalFailureInSubroutine
(expecting a failure that x should be 1)
gtest_output_test_.cc:#: Failure
- Expected: 1
-To be equal to: x
- Which is: 2
+Expected equality of these values:
+ 1
+ x
+ Which is: 2
[ FAILED ] FatalFailureTest.FatalFailureInSubroutine (? ms)
[ RUN ] FatalFailureTest.FatalFailureInNestedSubroutine
(expecting a failure that x should be 1)
gtest_output_test_.cc:#: Failure
- Expected: 1
-To be equal to: x
- Which is: 2
+Expected equality of these values:
+ 1
+ x
+ Which is: 2
[ FAILED ] FatalFailureTest.FatalFailureInNestedSubroutine (? ms)
[ RUN ] FatalFailureTest.NonfatalFailureInSubroutine
(expecting a failure on false)
diff --git a/googletest/test/gtest_repeat_test.cc b/googletest/test/gtest_repeat_test.cc
index 481012a..165d202 100644
--- a/googletest/test/gtest_repeat_test.cc
+++ b/googletest/test/gtest_repeat_test.cc
@@ -39,7 +39,7 @@
// 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.
+// their code.
#define GTEST_IMPLEMENTATION_ 1
#include "src/gtest-internal-inl.h"
#undef GTEST_IMPLEMENTATION_
diff --git a/googletest/test/gtest_unittest.cc b/googletest/test/gtest_unittest.cc
index 1d3c7c7..e4f743b 100644
--- a/googletest/test/gtest_unittest.cc
+++ b/googletest/test/gtest_unittest.cc
@@ -71,7 +71,7 @@ TEST(CommandLineFlagsTest, CanBeAccessedInCodeOnceGTestHIsIncluded) {
// 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.
+// their code.
#define GTEST_IMPLEMENTATION_ 1
#include "src/gtest-internal-inl.h"
#undef GTEST_IMPLEMENTATION_
@@ -2096,7 +2096,7 @@ class UnitTestRecordPropertyTestEnvironment : public Environment {
};
// This will test property recording outside of any test or test case.
-static Environment* record_property_env =
+Environment* record_property_env GTEST_ATTRIBUTE_UNUSED_ =
AddGlobalTestEnvironment(new UnitTestRecordPropertyTestEnvironment);
// This group of tests is for predicate assertions (ASSERT_PRED*, etc)
@@ -2429,8 +2429,9 @@ TEST(StringAssertionTest, ASSERT_STREQ) {
const char p2[] = "good";
ASSERT_STREQ(p1, p2);
- EXPECT_FATAL_FAILURE(ASSERT_STREQ("bad", "good"),
- "Expected: \"bad\"");
+ EXPECT_FATAL_FAILURE(
+ ASSERT_STREQ("bad", "good"),
+ "Expected equality of these values:\n \"bad\"\n \"good\"");
}
// Tests ASSERT_STREQ with NULL arguments.
@@ -3115,13 +3116,13 @@ TEST(DISABLED_TestCase, DISABLED_TestShouldNotRun) {
FAIL() << "Unexpected failure: Test in disabled test case should not be run.";
}
-// Check that when all tests in a test case are disabled, SetupTestCase() and
+// Check that when all tests in a test case are disabled, SetUpTestCase() and
// TearDownTestCase() are not called.
class DisabledTestsTest : public Test {
protected:
static void SetUpTestCase() {
FAIL() << "Unexpected failure: All tests disabled in test case. "
- "SetupTestCase() should not be called.";
+ "SetUpTestCase() should not be called.";
}
static void TearDownTestCase() {
@@ -3528,35 +3529,39 @@ TEST(AssertionTest, EqFailure) {
EqFailure("foo", "bar", foo_val, bar_val, false)
.failure_message());
EXPECT_STREQ(
- " Expected: foo\n"
- " Which is: 5\n"
- "To be equal to: bar\n"
- " Which is: 6",
+ "Expected equality of these values:\n"
+ " foo\n"
+ " Which is: 5\n"
+ " bar\n"
+ " Which is: 6",
msg1.c_str());
const std::string msg2(
EqFailure("foo", "6", foo_val, bar_val, false)
.failure_message());
EXPECT_STREQ(
- " Expected: foo\n"
- " Which is: 5\n"
- "To be equal to: 6",
+ "Expected equality of these values:\n"
+ " foo\n"
+ " Which is: 5\n"
+ " 6",
msg2.c_str());
const std::string msg3(
EqFailure("5", "bar", foo_val, bar_val, false)
.failure_message());
EXPECT_STREQ(
- " Expected: 5\n"
- "To be equal to: bar\n"
- " Which is: 6",
+ "Expected equality of these values:\n"
+ " 5\n"
+ " bar\n"
+ " Which is: 6",
msg3.c_str());
const std::string msg4(
EqFailure("5", "6", foo_val, bar_val, false).failure_message());
EXPECT_STREQ(
- " Expected: 5\n"
- "To be equal to: 6",
+ "Expected equality of these values:\n"
+ " 5\n"
+ " 6",
msg4.c_str());
const std::string msg5(
@@ -3564,10 +3569,11 @@ TEST(AssertionTest, EqFailure) {
std::string("\"x\""), std::string("\"y\""),
true).failure_message());
EXPECT_STREQ(
- " Expected: foo\n"
- " Which is: \"x\"\n"
- "To be equal to: bar\n"
- " Which is: \"y\"\n"
+ "Expected equality of these values:\n"
+ " foo\n"
+ " Which is: \"x\"\n"
+ " bar\n"
+ " Which is: \"y\"\n"
"Ignoring case",
msg5.c_str());
}
@@ -3580,11 +3586,12 @@ TEST(AssertionTest, EqFailureWithDiff) {
const std::string msg1(
EqFailure("left", "right", left, right, false).failure_message());
EXPECT_STREQ(
- " Expected: left\n"
- " Which is: "
+ "Expected equality of these values:\n"
+ " left\n"
+ " Which is: "
"1\\n2XXX\\n3\\n5\\n6\\n7\\n8\\n9\\n10\\n11\\n12XXX\\n13\\n14\\n15\n"
- "To be equal to: right\n"
- " Which is: 1\\n2\\n3\\n4\\n5\\n6\\n7\\n8\\n9\\n11\\n12\\n13\\n14\n"
+ " right\n"
+ " Which is: 1\\n2\\n3\\n4\\n5\\n6\\n7\\n8\\n9\\n11\\n12\\n13\\n14\n"
"With diff:\n@@ -1,5 +1,6 @@\n 1\n-2XXX\n+2\n 3\n+4\n 5\n 6\n"
"@@ -7,8 +8,6 @@\n 8\n 9\n-10\n 11\n-12XXX\n+12\n 13\n 14\n-15\n",
msg1.c_str());
@@ -3679,9 +3686,10 @@ TEST(ExpectTest, ASSERT_EQ_Double) {
TEST(AssertionTest, ASSERT_EQ) {
ASSERT_EQ(5, 2 + 3);
EXPECT_FATAL_FAILURE(ASSERT_EQ(5, 2*3),
- " Expected: 5\n"
- "To be equal to: 2*3\n"
- " Which is: 6");
+ "Expected equality of these values:\n"
+ " 5\n"
+ " 2*3\n"
+ " Which is: 6");
}
// Tests ASSERT_EQ(NULL, pointer).
@@ -3698,7 +3706,7 @@ TEST(AssertionTest, ASSERT_EQ_NULL) {
// A failure.
static int n = 0;
EXPECT_FATAL_FAILURE(ASSERT_EQ(NULL, &n),
- "To be equal to: &n\n");
+ " &n\n Which is:");
}
#endif // GTEST_CAN_COMPARE_NULL
@@ -3714,7 +3722,7 @@ TEST(ExpectTest, ASSERT_EQ_0) {
// A failure.
EXPECT_FATAL_FAILURE(ASSERT_EQ(0, 5.6),
- "Expected: 0");
+ " 0\n 5.6");
}
// Tests ASSERT_NE.
@@ -3813,7 +3821,7 @@ void TestEq1(int x) {
// Tests calling a test subroutine that's not part of a fixture.
TEST(AssertionTest, NonFixtureSubroutine) {
EXPECT_FATAL_FAILURE(TestEq1(2),
- "To be equal to: x");
+ "Which is: 2");
}
// An uncopyable class.
@@ -3862,7 +3870,8 @@ TEST(AssertionTest, AssertWorksWithUncopyableObject) {
EXPECT_FATAL_FAILURE(TestAssertNonPositive(),
"IsPositiveUncopyable(y) evaluates to false, where\ny evaluates to -1");
EXPECT_FATAL_FAILURE(TestAssertEqualsUncopyable(),
- "Expected: x\n Which is: 5\nTo be equal to: y\n Which is: -1");
+ "Expected equality of these values:\n"
+ " x\n Which is: 5\n y\n Which is: -1");
}
// Tests that uncopyable objects can be used in expects.
@@ -3874,7 +3883,8 @@ TEST(AssertionTest, ExpectWorksWithUncopyableObject) {
"IsPositiveUncopyable(y) evaluates to false, where\ny evaluates to -1");
EXPECT_EQ(x, x);
EXPECT_NONFATAL_FAILURE(EXPECT_EQ(x, y),
- "Expected: x\n Which is: 5\nTo be equal to: y\n Which is: -1");
+ "Expected equality of these values:\n"
+ " x\n Which is: 5\n y\n Which is: -1");
}
enum NamedEnum {
@@ -3950,7 +3960,7 @@ TEST(AssertionTest, AnonymousEnum) {
// ICE's in C++Builder.
EXPECT_FATAL_FAILURE(ASSERT_EQ(kCaseA, kCaseB),
- "To be equal to: kCaseB");
+ "kCaseB");
EXPECT_FATAL_FAILURE(ASSERT_EQ(kCaseA, kCaseC),
"Which is: 42");
# endif
@@ -4390,9 +4400,10 @@ TEST(ExpectTest, ExpectFalseWithAssertionResult) {
TEST(ExpectTest, EXPECT_EQ) {
EXPECT_EQ(5, 2 + 3);
EXPECT_NONFATAL_FAILURE(EXPECT_EQ(5, 2*3),
- " Expected: 5\n"
- "To be equal to: 2*3\n"
- " Which is: 6");
+ "Expected equality of these values:\n"
+ " 5\n"
+ " 2*3\n"
+ " Which is: 6");
EXPECT_NONFATAL_FAILURE(EXPECT_EQ(5, 2 - 3),
"2 - 3");
}
@@ -4423,7 +4434,7 @@ TEST(ExpectTest, EXPECT_EQ_NULL) {
// A failure.
int n = 0;
EXPECT_NONFATAL_FAILURE(EXPECT_EQ(NULL, &n),
- "To be equal to: &n\n");
+ "&n\n");
}
#endif // GTEST_CAN_COMPARE_NULL
@@ -4439,7 +4450,7 @@ TEST(ExpectTest, EXPECT_EQ_0) {
// A failure.
EXPECT_NONFATAL_FAILURE(EXPECT_EQ(0, 5.6),
- "Expected: 0");
+ "Expected equality of these values:\n 0\n 5.6");
}
// Tests EXPECT_NE.
@@ -4539,7 +4550,7 @@ TEST(ExpectTest, EXPECT_ANY_THROW) {
TEST(ExpectTest, ExpectPrecedence) {
EXPECT_EQ(1 < 2, true);
EXPECT_NONFATAL_FAILURE(EXPECT_EQ(true, true && false),
- "To be equal to: true && false");
+ "true && false");
}
@@ -4686,7 +4697,7 @@ TEST(EqAssertionTest, Bool) {
EXPECT_FATAL_FAILURE({
bool false_value = false;
ASSERT_EQ(false_value, true);
- }, "To be equal to: true");
+ }, "Which is: false");
}
// Tests using int values in {EXPECT|ASSERT}_EQ.
@@ -4720,10 +4731,11 @@ TEST(EqAssertionTest, WideChar) {
EXPECT_EQ(L'b', L'b');
EXPECT_NONFATAL_FAILURE(EXPECT_EQ(L'\0', L'x'),
- " Expected: L'\0'\n"
- " Which is: L'\0' (0, 0x0)\n"
- "To be equal to: L'x'\n"
- " Which is: L'x' (120, 0x78)");
+ "Expected equality of these values:\n"
+ " L'\0'\n"
+ " Which is: L'\0' (0, 0x0)\n"
+ " L'x'\n"
+ " Which is: L'x' (120, 0x78)");
static wchar_t wchar;
wchar = L'b';
@@ -4731,7 +4743,7 @@ TEST(EqAssertionTest, WideChar) {
"wchar");
wchar = 0x8119;
EXPECT_FATAL_FAILURE(ASSERT_EQ(static_cast<wchar_t>(0x8120), wchar),
- "To be equal to: wchar");
+ "wchar");
}
// Tests using ::std::string values in {EXPECT|ASSERT}_EQ.
@@ -4760,8 +4772,8 @@ TEST(EqAssertionTest, StdString) {
static ::std::string str3(str1);
str3.at(2) = '\0';
EXPECT_FATAL_FAILURE(ASSERT_EQ(str1, str3),
- "To be equal to: str3\n"
- " Which is: \"A \\0 in the middle\"");
+ " str3\n"
+ " Which is: \"A \\0 in the middle\"");
}
#if GTEST_HAS_STD_WSTRING
@@ -4881,7 +4893,7 @@ TEST(EqAssertionTest, CharPointer) {
ASSERT_EQ(p1, p1);
EXPECT_NONFATAL_FAILURE(EXPECT_EQ(p0, p2),
- "To be equal to: p2");
+ "p2");
EXPECT_NONFATAL_FAILURE(EXPECT_EQ(p1, p2),
"p2");
EXPECT_FATAL_FAILURE(ASSERT_EQ(reinterpret_cast<char*>(0x1234),
@@ -4903,7 +4915,7 @@ TEST(EqAssertionTest, WideCharPointer) {
EXPECT_EQ(p0, p0);
EXPECT_NONFATAL_FAILURE(EXPECT_EQ(p0, p2),
- "To be equal to: p2");
+ "p2");
EXPECT_NONFATAL_FAILURE(EXPECT_EQ(p1, p2),
"p2");
void* pv3 = (void*)0x1234; // NOLINT
@@ -7655,7 +7667,7 @@ TEST(NativeArrayTest, MethodsWork) {
EXPECT_EQ(0, *it);
++it;
EXPECT_EQ(1, *it);
- it++;
+ ++it;
EXPECT_EQ(2, *it);
++it;
EXPECT_EQ(na.end(), it);
diff --git a/googletest/test/gtest_xml_output_unittest.py b/googletest/test/gtest_xml_output_unittest.py
index e940a5a..9f92f98 100755
--- a/googletest/test/gtest_xml_output_unittest.py
+++ b/googletest/test/gtest_xml_output_unittest.py
@@ -64,20 +64,23 @@ EXPECTED_NON_EMPTY_XML = """<?xml version="1.0" encoding="UTF-8"?>
</testsuite>
<testsuite name="FailedTest" tests="1" failures="1" disabled="0" errors="0" time="*">
<testcase name="Fails" status="run" time="*" classname="FailedTest">
- <failure message="gtest_xml_output_unittest_.cc:*&#x0A; Expected: 1&#x0A;To be equal to: 2" type=""><![CDATA[gtest_xml_output_unittest_.cc:*
- Expected: 1
-To be equal to: 2%(stack)s]]></failure>
+ <failure message="gtest_xml_output_unittest_.cc:*&#x0A;Expected equality of these values:&#x0A; 1&#x0A; 2" type=""><![CDATA[gtest_xml_output_unittest_.cc:*
+Expected equality of these values:
+ 1
+ 2%(stack)s]]></failure>
</testcase>
</testsuite>
<testsuite name="MixedResultTest" tests="3" failures="1" disabled="1" errors="0" time="*">
<testcase name="Succeeds" status="run" time="*" classname="MixedResultTest"/>
<testcase name="Fails" status="run" time="*" classname="MixedResultTest">
- <failure message="gtest_xml_output_unittest_.cc:*&#x0A; Expected: 1&#x0A;To be equal to: 2" type=""><![CDATA[gtest_xml_output_unittest_.cc:*
- Expected: 1
-To be equal to: 2%(stack)s]]></failure>
- <failure message="gtest_xml_output_unittest_.cc:*&#x0A; Expected: 2&#x0A;To be equal to: 3" type=""><![CDATA[gtest_xml_output_unittest_.cc:*
- Expected: 2
-To be equal to: 3%(stack)s]]></failure>
+ <failure message="gtest_xml_output_unittest_.cc:*&#x0A;Expected equality of these values:&#x0A; 1&#x0A; 2" type=""><![CDATA[gtest_xml_output_unittest_.cc:*
+Expected equality of these values:
+ 1
+ 2%(stack)s]]></failure>
+ <failure message="gtest_xml_output_unittest_.cc:*&#x0A;Expected equality of these values:&#x0A; 2&#x0A; 3" type=""><![CDATA[gtest_xml_output_unittest_.cc:*
+Expected equality of these values:
+ 2
+ 3%(stack)s]]></failure>
</testcase>
<testcase name="DISABLED_test" status="notrun" time="*" classname="MixedResultTest"/>
</testsuite>