aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2017-06-22 07:34:45 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2017-06-22 07:34:45 +0000
commitf786916e6f2211c6a64d0333897702463cfdf779 (patch)
tree557e8915184d4e29dbd1eabe515575549ecdc097
parent64c90baff234cabd1cd2597ec33dbdc6819fc048 (diff)
parent6e94adafcd9eb3bfbeca8cefb3e2eb74069353a1 (diff)
downloadgoogletest-oreo-mr1-s1-release.tar.gz
release-request-36fe639f-9404-4c33-86fb-47bc4ab2221f-for-git_oc-mr1-release-4124666 snap-temp-L64200000076596327android-wear-8.1.0_r1android-vts-8.1_r9android-vts-8.1_r8android-vts-8.1_r7android-vts-8.1_r6android-vts-8.1_r5android-vts-8.1_r4android-vts-8.1_r3android-vts-8.1_r14android-vts-8.1_r13android-vts-8.1_r12android-vts-8.1_r11android-vts-8.1_r10android-security-8.1.0_r93android-security-8.1.0_r92android-security-8.1.0_r91android-security-8.1.0_r90android-security-8.1.0_r89android-security-8.1.0_r88android-security-8.1.0_r87android-security-8.1.0_r86android-security-8.1.0_r85android-security-8.1.0_r84android-security-8.1.0_r83android-security-8.1.0_r82android-cts-8.1_r9android-cts-8.1_r8android-cts-8.1_r7android-cts-8.1_r6android-cts-8.1_r5android-cts-8.1_r4android-cts-8.1_r3android-cts-8.1_r25android-cts-8.1_r24android-cts-8.1_r23android-cts-8.1_r22android-cts-8.1_r21android-cts-8.1_r20android-cts-8.1_r2android-cts-8.1_r19android-cts-8.1_r18android-cts-8.1_r17android-cts-8.1_r16android-cts-8.1_r15android-cts-8.1_r14android-cts-8.1_r13android-cts-8.1_r12android-cts-8.1_r11android-cts-8.1_r10android-cts-8.1_r1android-8.1.0_r9android-8.1.0_r81android-8.1.0_r80android-8.1.0_r8android-8.1.0_r79android-8.1.0_r78android-8.1.0_r77android-8.1.0_r76android-8.1.0_r75android-8.1.0_r74android-8.1.0_r73android-8.1.0_r72android-8.1.0_r71android-8.1.0_r70android-8.1.0_r7android-8.1.0_r69android-8.1.0_r68android-8.1.0_r67android-8.1.0_r66android-8.1.0_r65android-8.1.0_r64android-8.1.0_r63android-8.1.0_r62android-8.1.0_r61android-8.1.0_r60android-8.1.0_r6android-8.1.0_r53android-8.1.0_r52android-8.1.0_r51android-8.1.0_r50android-8.1.0_r5android-8.1.0_r48android-8.1.0_r47android-8.1.0_r46android-8.1.0_r45android-8.1.0_r43android-8.1.0_r42android-8.1.0_r41android-8.1.0_r40android-8.1.0_r4android-8.1.0_r39android-8.1.0_r38android-8.1.0_r37android-8.1.0_r36android-8.1.0_r35android-8.1.0_r33android-8.1.0_r32android-8.1.0_r31android-8.1.0_r30android-8.1.0_r3android-8.1.0_r29android-8.1.0_r28android-8.1.0_r27android-8.1.0_r26android-8.1.0_r25android-8.1.0_r23android-8.1.0_r22android-8.1.0_r21android-8.1.0_r20android-8.1.0_r2android-8.1.0_r19android-8.1.0_r18android-8.1.0_r17android-8.1.0_r16android-8.1.0_r15android-8.1.0_r14android-8.1.0_r13android-8.1.0_r12android-8.1.0_r11android-8.1.0_r10android-8.1.0_r1security-oc-mr1-releaseoreo-mr1-wear-releaseoreo-mr1-vts-releaseoreo-mr1-security-releaseoreo-mr1-s1-releaseoreo-mr1-releaseoreo-mr1-cuttlefish-testingoreo-mr1-cts-releaseoreo-m8-releaseoreo-m7-releaseoreo-m6-s4-releaseoreo-m6-s3-releaseoreo-m6-s2-releaseoreo-m5-releaseoreo-m4-s9-releaseoreo-m4-s8-releaseoreo-m4-s7-releaseoreo-m4-s6-releaseoreo-m4-s5-releaseoreo-m4-s4-releaseoreo-m4-s3-releaseoreo-m4-s2-releaseoreo-m4-s12-releaseoreo-m4-s11-releaseoreo-m4-s10-releaseoreo-m4-s1-releaseoreo-m3-releaseoreo-m2-s5-releaseoreo-m2-s4-releaseoreo-m2-s3-releaseoreo-m2-s2-releaseoreo-m2-s1-releaseoreo-m2-release
Change-Id: I4700d262bc0cbb31043f5c1241cc5135f550590a
-rw-r--r--.gitignore3
-rw-r--r--CMakeLists.txt2
-rw-r--r--README.md3
-rw-r--r--appveyor.yml71
-rw-r--r--googlemock/Android.bp2
-rw-r--r--googlemock/CMakeLists.txt2
-rw-r--r--googlemock/README.md22
-rw-r--r--googlemock/docs/CookBook.md4
-rw-r--r--googlemock/docs/ForDummies.md2
-rw-r--r--googlemock/docs/v1_5/ForDummies.md2
-rw-r--r--googlemock/docs/v1_6/ForDummies.md2
-rw-r--r--googlemock/docs/v1_7/ForDummies.md2
-rw-r--r--googlemock/include/gmock/gmock-matchers.h118
-rw-r--r--googlemock/include/gmock/gmock-spec-builders.h53
-rw-r--r--googlemock/include/gmock/internal/gmock-internal-utils.h9
-rw-r--r--googlemock/make/Makefile2
-rw-r--r--googlemock/msvc/2005/gmock_config.vsprops2
-rw-r--r--googlemock/msvc/2010/gmock_config.props2
-rw-r--r--googlemock/msvc/2015/gmock.sln32
-rw-r--r--googlemock/msvc/2015/gmock.vcxproj84
-rw-r--r--googlemock/msvc/2015/gmock_config.props19
-rw-r--r--googlemock/msvc/2015/gmock_main.vcxproj90
-rw-r--r--googlemock/msvc/2015/gmock_test.vcxproj103
-rw-r--r--googlemock/src/gmock-cardinalities.cc2
-rw-r--r--googlemock/src/gmock-internal-utils.cc5
-rw-r--r--googlemock/src/gmock-matchers.cc9
-rw-r--r--googlemock/src/gmock-spec-builders.cc13
-rw-r--r--googlemock/test/gmock-generated-actions_test.cc114
-rw-r--r--googlemock/test/gmock-generated-function-mockers_test.cc38
-rw-r--r--googlemock/test/gmock-generated-matchers_test.cc72
-rw-r--r--googlemock/test/gmock-internal-utils_test.cc25
-rw-r--r--googlemock/test/gmock-matchers_test.cc170
-rw-r--r--googlemock/test/gmock-more-actions_test.cc151
-rw-r--r--googlemock/test/gmock-nice-strict_test.cc27
-rw-r--r--googlemock/test/gmock-spec-builders_test.cc15
-rw-r--r--googlemock/test/gmock_output_test_golden.txt8
-rw-r--r--googlemock/test/gmock_stress_test.cc2
-rw-r--r--googletest/.gitignore2
-rw-r--r--googletest/CMakeLists.txt2
-rw-r--r--googletest/README.md109
-rw-r--r--googletest/cmake/internal_utils.cmake20
-rw-r--r--googletest/docs/AdvancedGuide.md21
-rw-r--r--googletest/docs/FAQ.md2
-rw-r--r--googletest/docs/Primer.md28
-rw-r--r--googletest/docs/V1_5_AdvancedGuide.md4
-rw-r--r--googletest/docs/V1_6_AdvancedGuide.md4
-rw-r--r--googletest/docs/V1_6_FAQ.md2
-rw-r--r--googletest/docs/V1_7_AdvancedGuide.md4
-rw-r--r--googletest/docs/V1_7_FAQ.md2
-rw-r--r--googletest/include/gtest/gtest-printers.h99
-rw-r--r--googletest/include/gtest/gtest-spi.h5
-rw-r--r--googletest/include/gtest/gtest-typed-test.h7
-rw-r--r--googletest/include/gtest/gtest.h216
-rw-r--r--googletest/include/gtest/internal/custom/gtest-port.h3
-rw-r--r--googletest/include/gtest/internal/custom/gtest.h23
-rw-r--r--googletest/include/gtest/internal/gtest-internal.h7
-rw-r--r--googletest/include/gtest/internal/gtest-param-util.h19
-rw-r--r--googletest/include/gtest/internal/gtest-port.h59
-rwxr-xr-xgoogletest/scripts/fuse_gtest_files.py33
-rw-r--r--googletest/src/gtest-death-test.cc7
-rw-r--r--googletest/src/gtest-internal-inl.h30
-rw-r--r--googletest/src/gtest-port.cc63
-rw-r--r--googletest/src/gtest.cc180
-rw-r--r--googletest/test/gtest-death-test_test.cc2
-rw-r--r--googletest/test/gtest-port_test.cc7
-rw-r--r--googletest/test/gtest-printers_test.cc56
-rw-r--r--googletest/test/gtest_catch_exceptions_test_.cc2
-rwxr-xr-xgoogletest/test/gtest_env_var_test.py18
-rwxr-xr-xgoogletest/test/gtest_filter_unittest.py13
-rwxr-xr-xgoogletest/test/gtest_list_tests_unittest.py4
-rwxr-xr-xgoogletest/test/gtest_output_test.py2
-rw-r--r--googletest/test/gtest_output_test_golden_lin.txt114
-rwxr-xr-xgoogletest/test/gtest_test_utils.py2
-rwxr-xr-xgoogletest/test/gtest_throw_on_failure_test.py2
-rwxr-xr-xgoogletest/test/gtest_uninitialized_test.py4
-rw-r--r--googletest/test/gtest_unittest.cc112
-rwxr-xr-xgoogletest/test/gtest_xml_output_unittest.py21
-rwxr-xr-xgoogletest/test/gtest_xml_test_utils.py2
-rw-r--r--googletest/xcode/gtest.xcodeproj/project.pbxproj47
-rwxr-xr-xtravis.sh2
80 files changed, 1674 insertions, 969 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 00000000..74e7466a
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,3 @@
+# Ignore CI build directory
+build/
+xcuserdata
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8d2b552e..5754992e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 2.6.2)
+cmake_minimum_required(VERSION 2.6.4)
project( googletest-distribution )
diff --git a/README.md b/README.md
index 20728771..076484e4 100644
--- a/README.md
+++ b/README.md
@@ -2,6 +2,7 @@
# Google Test #
[![Build Status](https://travis-ci.org/google/googletest.svg?branch=master)](https://travis-ci.org/google/googletest)
+[![Build status](https://ci.appveyor.com/api/projects/status/4o38plt0xbo1ubc8/branch/master?svg=true)](https://ci.appveyor.com/project/BillyDonahue/googletest/branch/master)
Welcome to **Google Test**, Google's C++ test framework!
@@ -105,7 +106,7 @@ package (as described below):
### Mac OS X Requirements ###
* Mac OS X v10.4 Tiger or newer
- * XCode Developer Tools
+ * Xcode Developer Tools
### Requirements for Contributors ###
diff --git a/appveyor.yml b/appveyor.yml
new file mode 100644
index 00000000..d613fd60
--- /dev/null
+++ b/appveyor.yml
@@ -0,0 +1,71 @@
+version: '{build}'
+
+os: Visual Studio 2015
+
+environment:
+ matrix:
+ - Toolset: v140
+ - Toolset: v120
+ - Toolset: v110
+ - Toolset: v100
+
+platform:
+ - Win32
+ - x64
+
+configuration:
+# - Release
+ - Debug
+
+build:
+ verbosity: minimal
+
+artifacts:
+ - path: '_build/Testing/Temporary/*'
+ name: test_results
+
+before_build:
+- ps: |
+ Write-Output "Configuration: $env:CONFIGURATION"
+ Write-Output "Platform: $env:PLATFORM"
+ $generator = switch ($env:TOOLSET)
+ {
+ "v140" {"Visual Studio 14 2015"}
+ "v120" {"Visual Studio 12 2013"}
+ "v110" {"Visual Studio 11 2012"}
+ "v100" {"Visual Studio 10 2010"}
+ }
+ if ($env:PLATFORM -eq "x64")
+ {
+ $generator = "$generator Win64"
+ }
+
+build_script:
+- ps: |
+ if (($env:TOOLSET -eq "v100") -and ($env:PLATFORM -eq "x64"))
+ {
+ return
+ }
+ md _build -Force | Out-Null
+ cd _build
+
+ & cmake -G "$generator" -DCMAKE_CONFIGURATION_TYPES="Debug;Release" -Dgtest_build_tests=ON -Dgtest_build_samples=ON -Dgmock_build_tests=ON ..
+ if ($LastExitCode -ne 0) {
+ throw "Exec: $ErrorMessage"
+ }
+ & cmake --build . --config $env:CONFIGURATION
+ if ($LastExitCode -ne 0) {
+ throw "Exec: $ErrorMessage"
+ }
+
+test_script:
+- ps: |
+ if (($env:Toolset -eq "v100") -and ($env:PLATFORM -eq "x64"))
+ {
+ return
+ }
+
+ & ctest -C $env:CONFIGURATION --output-on-failure
+ if ($LastExitCode -ne 0) {
+ throw "Exec: $ErrorMessage"
+ }
diff --git a/googlemock/Android.bp b/googlemock/Android.bp
index 337c0540..c17b7331 100644
--- a/googlemock/Android.bp
+++ b/googlemock/Android.bp
@@ -18,7 +18,7 @@ cc_defaults {
local_include_dirs: ["include"],
export_include_dirs: ["include"],
- cflags: ["-Wno-missing-field-initializers"],
+ cflags: ["-Wno-missing-field-initializers", "-Wno-unused-parameter"],
}
cc_defaults {
diff --git a/googlemock/CMakeLists.txt b/googlemock/CMakeLists.txt
index beb259a2..9fb96a4b 100644
--- a/googlemock/CMakeLists.txt
+++ b/googlemock/CMakeLists.txt
@@ -38,7 +38,7 @@ endif()
# ${gmock_BINARY_DIR}.
# Language "C" is required for find_package(Threads).
project(gmock CXX C)
-cmake_minimum_required(VERSION 2.6.2)
+cmake_minimum_required(VERSION 2.6.4)
if (COMMAND set_up_hermetic_build)
set_up_hermetic_build()
diff --git a/googlemock/README.md b/googlemock/README.md
index 332beab3..7b13a6d3 100644
--- a/googlemock/README.md
+++ b/googlemock/README.md
@@ -53,18 +53,18 @@ the Apache License, which is different from Google Mock's license.
If you are new to the project, we suggest that you read the user
documentation in the following order:
- * Learn the [basics](../googletest/docs/Primer.md) of
+ * Learn the [basics](../../master/googletest/docs/Primer.md) of
Google Test, if you choose to use Google Mock with it (recommended).
- * Read [Google Mock for Dummies](docs/ForDummies.md).
+ * Read [Google Mock for Dummies](../../master/googlemock/docs/ForDummies.md).
* Read the instructions below on how to build Google Mock.
You can also watch Zhanyong's [talk](http://www.youtube.com/watch?v=sYpCyLI47rM) on Google Mock's usage and implementation.
Once you understand the basics, check out the rest of the docs:
- * [CheatSheet](docs/CheatSheet.md) - all the commonly used stuff
+ * [CheatSheet](../../master/googlemock/docs/CheatSheet.md) - all the commonly used stuff
at a glance.
- * [CookBook](docs/CookBook.md) - recipes for getting things done,
+ * [CookBook](../../master/googlemock/docs/CookBook.md) - recipes for getting things done,
including advanced techniques.
If you need help, please check the
@@ -79,7 +79,7 @@ posting a question on the
Google Mock is not a testing framework itself. Instead, it needs a
testing framework for writing tests. Google Mock works seamlessly
with [Google Test](http://code.google.com/p/googletest/), but
-you can also use it with [any C++ testing framework](googlemock/ForDummies.md#Using_Google_Mock_with_Any_Testing_Framework).
+you can also use it with [any C++ testing framework](../../master/googlemock/docs/ForDummies.md#using-google-mock-with-any-testing-framework).
### Requirements for End Users ###
@@ -90,7 +90,7 @@ You must use the bundled version of Google Test when using Google Mock.
You can also easily configure Google Mock to work with another testing
framework, although it will still need Google Test. Please read
["Using_Google_Mock_with_Any_Testing_Framework"](
- docs/ForDummies.md#Using_Google_Mock_with_Any_Testing_Framework)
+ ../../master/googlemock/docs/ForDummies.md#using-google-mock-with-any-testing-framework)
for instructions.
Google Mock depends on advanced C++ features and thus requires a more
@@ -125,6 +125,14 @@ build Google Mock and its tests, which has further requirements:
### Building Google Mock ###
+If you have CMake available, it is recommended that you follow the
+[build instructions][gtest_cmakebuild]
+as described for Google Test. If are using Google Mock with an
+existing CMake project, the section
+[Incorporating Into An Existing CMake Project][gtest_incorpcmake]
+may be of particular interest. Otherwise, the following sections
+detail how to build Google Mock without CMake.
+
#### Preparing to Build (Unix only) ####
If you are using a Unix system and plan to use the GNU Autotools build
@@ -331,3 +339,5 @@ patch.
Happy testing!
[gtest_readme]: ../googletest/README.md "googletest"
+[gtest_cmakebuild]: ../googletest/README.md#using-cmake "Using CMake"
+[gtest_incorpcmake]: ../googletest/README.md#incorporating-into-an-existing-cmake-project "Incorporating Into An Existing CMake Project"
diff --git a/googlemock/docs/CookBook.md b/googlemock/docs/CookBook.md
index c215b551..0460d357 100644
--- a/googlemock/docs/CookBook.md
+++ b/googlemock/docs/CookBook.md
@@ -218,7 +218,7 @@ per-function syntactic overhead will be much lower.
If you are concerned about the performance overhead incurred by
virtual functions, and profiling confirms your concern, you can
-combine this with the recipe for [mocking non-virtual methods](#Mocking_Nonvirtual_Methods.md).
+combine this with the recipe for [mocking non-virtual methods](#mocking-nonvirtual-methods).
## The Nice, the Strict, and the Naggy ##
@@ -2103,7 +2103,7 @@ For better readability, Google Mock also gives you:
* `WithArg<N>(action)` (no `s` after `Arg`) when the inner `action` takes _one_ argument.
As you may have realized, `InvokeWithoutArgs(...)` is just syntactic
-sugar for `WithoutArgs(Inovke(...))`.
+sugar for `WithoutArgs(Invoke(...))`.
Here are more tips:
diff --git a/googlemock/docs/ForDummies.md b/googlemock/docs/ForDummies.md
index e2f362a6..0da4cbe2 100644
--- a/googlemock/docs/ForDummies.md
+++ b/googlemock/docs/ForDummies.md
@@ -44,7 +44,7 @@ We encourage you to use Google Mock as:
* a _testing_ tool to cut your tests' outbound dependencies and probe the interaction between your module and its collaborators.
# Getting Started #
-Using Google Mock is easy! Inside your C++ source file, just #include `"gtest/gtest.h"` and `"gmock/gmock.h"`, and you are ready to go.
+Using Google Mock is easy! Inside your C++ source file, just `#include` `"gtest/gtest.h"` and `"gmock/gmock.h"`, and you are ready to go.
# A Case for Mock Turtles #
Let's look at an example. Suppose you are developing a graphics program that relies on a LOGO-like API for drawing. How would you test that it does the right thing? Well, you can run it and compare the screen with a golden screen snapshot, but let's admit it: tests like this are expensive to run and fragile (What if you just upgraded to a shiny new graphics card that has better anti-aliasing? Suddenly you have to update all your golden images.). It would be too painful if all your tests are like this. Fortunately, you learned about Dependency Injection and know the right thing to do: instead of having your application talk to the drawing API directly, wrap the API in an interface (say, `Turtle`) and code to that interface:
diff --git a/googlemock/docs/v1_5/ForDummies.md b/googlemock/docs/v1_5/ForDummies.md
index f389606c..fcc3b561 100644
--- a/googlemock/docs/v1_5/ForDummies.md
+++ b/googlemock/docs/v1_5/ForDummies.md
@@ -44,7 +44,7 @@ We encourage you to use Google Mock as:
* a _testing_ tool to cut your tests' outbound dependencies and probe the interaction between your module and its collaborators.
# Getting Started #
-Using Google Mock is easy! Inside your C++ source file, just #include `<gtest/gtest.h>` and `<gmock/gmock.h>`, and you are ready to go.
+Using Google Mock is easy! Inside your C++ source file, just `#include` `<gtest/gtest.h>` and `<gmock/gmock.h>`, and you are ready to go.
# A Case for Mock Turtles #
Let's look at an example. Suppose you are developing a graphics program that relies on a LOGO-like API for drawing. How would you test that it does the right thing? Well, you can run it and compare the screen with a golden screen snapshot, but let's admit it: tests like this are expensive to run and fragile (What if you just upgraded to a shiny new graphics card that has better anti-aliasing? Suddenly you have to update all your golden images.). It would be too painful if all your tests are like this. Fortunately, you learned about Dependency Injection and know the right thing to do: instead of having your application talk to the drawing API directly, wrap the API in an interface (say, `Turtle`) and code to that interface:
diff --git a/googlemock/docs/v1_6/ForDummies.md b/googlemock/docs/v1_6/ForDummies.md
index 0891b8c4..19ee63ab 100644
--- a/googlemock/docs/v1_6/ForDummies.md
+++ b/googlemock/docs/v1_6/ForDummies.md
@@ -44,7 +44,7 @@ We encourage you to use Google Mock as:
* a _testing_ tool to cut your tests' outbound dependencies and probe the interaction between your module and its collaborators.
# Getting Started #
-Using Google Mock is easy! Inside your C++ source file, just #include `"gtest/gtest.h"` and `"gmock/gmock.h"`, and you are ready to go.
+Using Google Mock is easy! Inside your C++ source file, just `#include` `"gtest/gtest.h"` and `"gmock/gmock.h"`, and you are ready to go.
# A Case for Mock Turtles #
Let's look at an example. Suppose you are developing a graphics program that relies on a LOGO-like API for drawing. How would you test that it does the right thing? Well, you can run it and compare the screen with a golden screen snapshot, but let's admit it: tests like this are expensive to run and fragile (What if you just upgraded to a shiny new graphics card that has better anti-aliasing? Suddenly you have to update all your golden images.). It would be too painful if all your tests are like this. Fortunately, you learned about Dependency Injection and know the right thing to do: instead of having your application talk to the drawing API directly, wrap the API in an interface (say, `Turtle`) and code to that interface:
diff --git a/googlemock/docs/v1_7/ForDummies.md b/googlemock/docs/v1_7/ForDummies.md
index 2ed43007..ee03c5b9 100644
--- a/googlemock/docs/v1_7/ForDummies.md
+++ b/googlemock/docs/v1_7/ForDummies.md
@@ -44,7 +44,7 @@ We encourage you to use Google Mock as:
* a _testing_ tool to cut your tests' outbound dependencies and probe the interaction between your module and its collaborators.
# Getting Started #
-Using Google Mock is easy! Inside your C++ source file, just #include `"gtest/gtest.h"` and `"gmock/gmock.h"`, and you are ready to go.
+Using Google Mock is easy! Inside your C++ source file, just `#include` `"gtest/gtest.h"` and `"gmock/gmock.h"`, and you are ready to go.
# A Case for Mock Turtles #
Let's look at an example. Suppose you are developing a graphics program that relies on a LOGO-like API for drawing. How would you test that it does the right thing? Well, you can run it and compare the screen with a golden screen snapshot, but let's admit it: tests like this are expensive to run and fragile (What if you just upgraded to a shiny new graphics card that has better anti-aliasing? Suddenly you have to update all your golden images.). It would be too painful if all your tests are like this. Fortunately, you learned about Dependency Injection and know the right thing to do: instead of having your application talk to the drawing API directly, wrap the API in an interface (say, `Turtle`) and code to that interface:
diff --git a/googlemock/include/gmock/gmock-matchers.h b/googlemock/include/gmock/gmock-matchers.h
index 33b37a7a..9ade5b64 100644
--- a/googlemock/include/gmock/gmock-matchers.h
+++ b/googlemock/include/gmock/gmock-matchers.h
@@ -186,7 +186,7 @@ class StringMatchResultListener : public MatchResultListener {
StringMatchResultListener() : MatchResultListener(&ss_) {}
// Returns the explanation accumulated so far.
- internal::string str() const { return ss_.str(); }
+ std::string str() const { return ss_.str(); }
// Clears the explanation accumulated so far.
void Clear() { ss_.str(""); }
@@ -675,7 +675,7 @@ Matcher<T> A();
namespace internal {
// If the explanation is not empty, prints it to the ostream.
-inline void PrintIfNotEmpty(const internal::string& explanation,
+inline void PrintIfNotEmpty(const std::string& explanation,
::std::ostream* os) {
if (explanation != "" && os != NULL) {
*os << ", " << explanation;
@@ -685,11 +685,11 @@ inline void PrintIfNotEmpty(const internal::string& explanation,
// Returns true if the given type name is easy to read by a human.
// This is used to decide whether printing the type of a value might
// be helpful.
-inline bool IsReadableTypeName(const string& type_name) {
+inline bool IsReadableTypeName(const std::string& type_name) {
// We consider a type name readable if it's short or doesn't contain
// a template or function type.
return (type_name.length() <= 20 ||
- type_name.find_first_of("<(") == string::npos);
+ type_name.find_first_of("<(") == std::string::npos);
}
// Matches the value against the given matcher, prints the value and explains
@@ -711,7 +711,7 @@ bool MatchPrintAndExplain(Value& value, const Matcher<T>& matcher,
UniversalPrint(value, listener->stream());
#if GTEST_HAS_RTTI
- const string& type_name = GetTypeName<Value>();
+ const std::string& type_name = GetTypeName<Value>();
if (IsReadableTypeName(type_name))
*listener->stream() << " (of type " << type_name << ")";
#endif
@@ -1335,17 +1335,17 @@ class MatchesRegexMatcher {
// wchar_t*
template <typename CharType>
bool MatchAndExplain(CharType* s, MatchResultListener* listener) const {
- return s != NULL && MatchAndExplain(internal::string(s), listener);
+ return s != NULL && MatchAndExplain(std::string(s), listener);
}
- // Matches anything that can convert to internal::string.
+ // Matches anything that can convert to std::string.
//
- // This is a template, not just a plain function with const internal::string&,
+ // This is a template, not just a plain function with const std::string&,
// because StringPiece has some interfering non-explicit constructors.
template <class MatcheeStringType>
bool MatchAndExplain(const MatcheeStringType& s,
MatchResultListener* /* listener */) const {
- const internal::string& s2(s);
+ const std::string& s2(s);
return full_match_ ? RE::FullMatch(s2, *regex_) :
RE::PartialMatch(s2, *regex_);
}
@@ -1353,13 +1353,13 @@ class MatchesRegexMatcher {
void DescribeTo(::std::ostream* os) const {
*os << (full_match_ ? "matches" : "contains")
<< " regular expression ";
- UniversalPrinter<internal::string>::Print(regex_->pattern(), os);
+ UniversalPrinter<std::string>::Print(regex_->pattern(), os);
}
void DescribeNegationTo(::std::ostream* os) const {
*os << "doesn't " << (full_match_ ? "match" : "contain")
<< " regular expression ";
- UniversalPrinter<internal::string>::Print(regex_->pattern(), os);
+ UniversalPrinter<std::string>::Print(regex_->pattern(), os);
}
private:
@@ -1526,8 +1526,8 @@ class BothOfMatcherImpl : public MatcherInterface<T> {
}
// Otherwise we need to explain why *both* of them match.
- const internal::string s1 = listener1.str();
- const internal::string s2 = listener2.str();
+ const std::string s1 = listener1.str();
+ const std::string s2 = listener2.str();
if (s1 == "") {
*listener << s2;
@@ -1698,8 +1698,8 @@ class EitherOfMatcherImpl : public MatcherInterface<T> {
}
// Otherwise we need to explain why *both* of them fail.
- const internal::string s1 = listener1.str();
- const internal::string s2 = listener2.str();
+ const std::string s1 = listener1.str();
+ const std::string s2 = listener2.str();
if (s1 == "") {
*listener << s2;
@@ -2123,7 +2123,7 @@ class WhenDynamicCastToMatcherBase {
protected:
const Matcher<To> matcher_;
- static string GetToName() {
+ static std::string GetToName() {
#if GTEST_HAS_RTTI
return GetTypeName<To>();
#else // GTEST_HAS_RTTI
@@ -2953,7 +2953,7 @@ class KeyMatcherImpl : public MatcherInterface<PairType> {
StringMatchResultListener inner_listener;
const bool match = inner_matcher_.MatchAndExplain(key_value.first,
&inner_listener);
- const internal::string explanation = inner_listener.str();
+ const std::string explanation = inner_listener.str();
if (explanation != "") {
*listener << "whose first field is a value " << explanation;
}
@@ -3058,8 +3058,8 @@ class PairMatcherImpl : public MatcherInterface<PairType> {
}
private:
- void ExplainSuccess(const internal::string& first_explanation,
- const internal::string& second_explanation,
+ void ExplainSuccess(const std::string& first_explanation,
+ const std::string& second_explanation,
MatchResultListener* listener) const {
*listener << "whose both fields match";
if (first_explanation != "") {
@@ -3166,7 +3166,7 @@ class ElementsAreMatcherImpl : public MatcherInterface<Container> {
const bool listener_interested = listener->IsInterested();
// explanations[i] is the explanation of the element at index i.
- ::std::vector<internal::string> explanations(count());
+ ::std::vector<std::string> explanations(count());
StlContainerReference stl_container = View::ConstReference(container);
typename StlContainer::const_iterator it = stl_container.begin();
size_t exam_pos = 0;
@@ -3225,7 +3225,7 @@ class ElementsAreMatcherImpl : public MatcherInterface<Container> {
if (listener_interested) {
bool reason_printed = false;
for (size_t i = 0; i != count(); ++i) {
- const internal::string& s = explanations[i];
+ const std::string& s = explanations[i];
if (!s.empty()) {
if (reason_printed) {
*listener << ",\nand ";
@@ -3278,7 +3278,7 @@ class GTEST_API_ MatchMatrix {
void Randomize();
- string DebugString() const;
+ std::string DebugString() const;
private:
size_t SpaceIndex(size_t ilhs, size_t irhs) const {
@@ -3322,9 +3322,8 @@ class GTEST_API_ UnorderedElementsAreMatcherImplBase {
void DescribeNegationToImpl(::std::ostream* os) const;
bool VerifyAllElementsAndMatchersAreMatched(
- const ::std::vector<string>& element_printouts,
- const MatchMatrix& matrix,
- MatchResultListener* listener) const;
+ const ::std::vector<std::string>& element_printouts,
+ const MatchMatrix& matrix, MatchResultListener* listener) const;
MatcherDescriberVec& matcher_describers() {
return matcher_describers_;
@@ -3376,7 +3375,7 @@ class UnorderedElementsAreMatcherImpl
virtual bool MatchAndExplain(Container container,
MatchResultListener* listener) const {
StlContainerReference stl_container = View::ConstReference(container);
- ::std::vector<string> element_printouts;
+ ::std::vector<std::string> element_printouts;
MatchMatrix matrix = AnalyzeElements(stl_container.begin(),
stl_container.end(),
&element_printouts,
@@ -3407,7 +3406,7 @@ class UnorderedElementsAreMatcherImpl
template <typename ElementIter>
MatchMatrix AnalyzeElements(ElementIter elem_first, ElementIter elem_last,
- ::std::vector<string>* element_printouts,
+ ::std::vector<std::string>* element_printouts,
MatchResultListener* listener) const {
element_printouts->clear();
::std::vector<char> did_match;
@@ -3619,9 +3618,9 @@ BoundSecondMatcher<Tuple2Matcher, Second> MatcherBindSecond(
// 'negation' is false; otherwise returns the description of the
// negation of the matcher. 'param_values' contains a list of strings
// that are the print-out of the matcher's parameters.
-GTEST_API_ string FormatMatcherDescription(bool negation,
- const char* matcher_name,
- const Strings& param_values);
+GTEST_API_ std::string FormatMatcherDescription(bool negation,
+ const char* matcher_name,
+ const Strings& param_values);
} // namespace internal
@@ -3951,53 +3950,52 @@ internal::ResultOfMatcher<Callable> ResultOf(
// String matchers.
// Matches a string equal to str.
-inline PolymorphicMatcher<internal::StrEqualityMatcher<internal::string> >
- StrEq(const internal::string& str) {
- return MakePolymorphicMatcher(internal::StrEqualityMatcher<internal::string>(
- str, true, true));
+inline PolymorphicMatcher<internal::StrEqualityMatcher<std::string> > StrEq(
+ const std::string& str) {
+ return MakePolymorphicMatcher(
+ internal::StrEqualityMatcher<std::string>(str, true, true));
}
// Matches a string not equal to str.
-inline PolymorphicMatcher<internal::StrEqualityMatcher<internal::string> >
- StrNe(const internal::string& str) {
- return MakePolymorphicMatcher(internal::StrEqualityMatcher<internal::string>(
- str, false, true));
+inline PolymorphicMatcher<internal::StrEqualityMatcher<std::string> > StrNe(
+ const std::string& str) {
+ return MakePolymorphicMatcher(
+ internal::StrEqualityMatcher<std::string>(str, false, true));
}
// Matches a string equal to str, ignoring case.
-inline PolymorphicMatcher<internal::StrEqualityMatcher<internal::string> >
- StrCaseEq(const internal::string& str) {
- return MakePolymorphicMatcher(internal::StrEqualityMatcher<internal::string>(
- str, true, false));
+inline PolymorphicMatcher<internal::StrEqualityMatcher<std::string> > StrCaseEq(
+ const std::string& str) {
+ return MakePolymorphicMatcher(
+ internal::StrEqualityMatcher<std::string>(str, true, false));
}
// Matches a string not equal to str, ignoring case.
-inline PolymorphicMatcher<internal::StrEqualityMatcher<internal::string> >
- StrCaseNe(const internal::string& str) {
- return MakePolymorphicMatcher(internal::StrEqualityMatcher<internal::string>(
- str, false, false));
+inline PolymorphicMatcher<internal::StrEqualityMatcher<std::string> > StrCaseNe(
+ const std::string& str) {
+ return MakePolymorphicMatcher(
+ internal::StrEqualityMatcher<std::string>(str, false, false));
}
// Creates a matcher that matches any string, std::string, or C string
// that contains the given substring.
-inline PolymorphicMatcher<internal::HasSubstrMatcher<internal::string> >
- HasSubstr(const internal::string& substring) {
- return MakePolymorphicMatcher(internal::HasSubstrMatcher<internal::string>(
- substring));
+inline PolymorphicMatcher<internal::HasSubstrMatcher<std::string> > HasSubstr(
+ const std::string& substring) {
+ return MakePolymorphicMatcher(
+ internal::HasSubstrMatcher<std::string>(substring));
}
// Matches a string that starts with 'prefix' (case-sensitive).
-inline PolymorphicMatcher<internal::StartsWithMatcher<internal::string> >
- StartsWith(const internal::string& prefix) {
- return MakePolymorphicMatcher(internal::StartsWithMatcher<internal::string>(
- prefix));
+inline PolymorphicMatcher<internal::StartsWithMatcher<std::string> > StartsWith(
+ const std::string& prefix) {
+ return MakePolymorphicMatcher(
+ internal::StartsWithMatcher<std::string>(prefix));
}
// Matches a string that ends with 'suffix' (case-sensitive).
-inline PolymorphicMatcher<internal::EndsWithMatcher<internal::string> >
- EndsWith(const internal::string& suffix) {
- return MakePolymorphicMatcher(internal::EndsWithMatcher<internal::string>(
- suffix));
+inline PolymorphicMatcher<internal::EndsWithMatcher<std::string> > EndsWith(
+ const std::string& suffix) {
+ return MakePolymorphicMatcher(internal::EndsWithMatcher<std::string>(suffix));
}
// Matches a string that fully matches regular expression 'regex'.
@@ -4007,7 +4005,7 @@ inline PolymorphicMatcher<internal::MatchesRegexMatcher> MatchesRegex(
return MakePolymorphicMatcher(internal::MatchesRegexMatcher(regex, true));
}
inline PolymorphicMatcher<internal::MatchesRegexMatcher> MatchesRegex(
- const internal::string& regex) {
+ const std::string& regex) {
return MatchesRegex(new internal::RE(regex));
}
@@ -4018,7 +4016,7 @@ inline PolymorphicMatcher<internal::MatchesRegexMatcher> ContainsRegex(
return MakePolymorphicMatcher(internal::MatchesRegexMatcher(regex, false));
}
inline PolymorphicMatcher<internal::MatchesRegexMatcher> ContainsRegex(
- const internal::string& regex) {
+ const std::string& regex) {
return ContainsRegex(new internal::RE(regex));
}
diff --git a/googlemock/include/gmock/gmock-spec-builders.h b/googlemock/include/gmock/gmock-spec-builders.h
index fed7de66..39f72129 100644
--- a/googlemock/include/gmock/gmock-spec-builders.h
+++ b/googlemock/include/gmock/gmock-spec-builders.h
@@ -148,8 +148,7 @@ class GTEST_API_ UntypedFunctionMockerBase {
// action fails.
// L = *
virtual UntypedActionResultHolderBase* UntypedPerformDefaultAction(
- const void* untyped_args,
- const string& call_description) const = 0;
+ const void* untyped_args, const std::string& call_description) const = 0;
// Performs the given action with the given arguments and returns
// the action's result.
@@ -263,12 +262,14 @@ class UntypedOnCallSpecBase {
};
// Asserts that the ON_CALL() statement has a certain property.
- void AssertSpecProperty(bool property, const string& failure_message) const {
+ void AssertSpecProperty(bool property,
+ const std::string& failure_message) const {
Assert(property, file_, line_, failure_message);
}
// Expects that the ON_CALL() statement has a certain property.
- void ExpectSpecProperty(bool property, const string& failure_message) const {
+ void ExpectSpecProperty(bool property,
+ const std::string& failure_message) const {
Expect(property, file_, line_, failure_message);
}
@@ -690,7 +691,7 @@ GTEST_API_ extern ThreadLocal<Sequence*> g_gmock_implicit_sequence;
class GTEST_API_ ExpectationBase {
public:
// source_text is the EXPECT_CALL(...) source that created this Expectation.
- ExpectationBase(const char* file, int line, const string& source_text);
+ ExpectationBase(const char* file, int line, const std::string& source_text);
virtual ~ExpectationBase();
@@ -738,12 +739,14 @@ class GTEST_API_ ExpectationBase {
virtual Expectation GetHandle() = 0;
// Asserts that the EXPECT_CALL() statement has the given property.
- void AssertSpecProperty(bool property, const string& failure_message) const {
+ void AssertSpecProperty(bool property,
+ const std::string& failure_message) const {
Assert(property, file_, line_, failure_message);
}
// Expects that the EXPECT_CALL() statement has the given property.
- void ExpectSpecProperty(bool property, const string& failure_message) const {
+ void ExpectSpecProperty(bool property,
+ const std::string& failure_message) const {
Expect(property, file_, line_, failure_message);
}
@@ -845,7 +848,7 @@ class GTEST_API_ ExpectationBase {
// an EXPECT_CALL() statement finishes.
const char* file_; // The file that contains the expectation.
int line_; // The line number of the expectation.
- const string source_text_; // The EXPECT_CALL(...) source text.
+ const std::string source_text_; // The EXPECT_CALL(...) source text.
// True iff the cardinality is specified explicitly.
bool cardinality_specified_;
Cardinality cardinality_; // The cardinality of the expectation.
@@ -880,8 +883,8 @@ class TypedExpectation : public ExpectationBase {
typedef typename Function<F>::ArgumentMatcherTuple ArgumentMatcherTuple;
typedef typename Function<F>::Result Result;
- TypedExpectation(FunctionMockerBase<F>* owner,
- const char* a_file, int a_line, const string& a_source_text,
+ TypedExpectation(FunctionMockerBase<F>* owner, const char* a_file, int a_line,
+ const std::string& a_source_text,
const ArgumentMatcherTuple& m)
: ExpectationBase(a_file, a_line, a_source_text),
owner_(owner),
@@ -1240,7 +1243,7 @@ class TypedExpectation : public ExpectationBase {
// Logs a message including file and line number information.
GTEST_API_ void LogWithLocation(testing::internal::LogSeverity severity,
const char* file, int line,
- const string& message);
+ const std::string& message);
template <typename F>
class MockSpec {
@@ -1259,7 +1262,7 @@ class MockSpec {
internal::OnCallSpec<F>& InternalDefaultActionSetAt(
const char* file, int line, const char* obj, const char* call) {
LogWithLocation(internal::kInfo, file, line,
- string("ON_CALL(") + obj + ", " + call + ") invoked");
+ std::string("ON_CALL(") + obj + ", " + call + ") invoked");
return function_mocker_->AddNewOnCallSpec(file, line, matchers_);
}
@@ -1267,7 +1270,8 @@ class MockSpec {
// the newly created spec.
internal::TypedExpectation<F>& InternalExpectedAt(
const char* file, int line, const char* obj, const char* call) {
- const string source_text(string("EXPECT_CALL(") + obj + ", " + call + ")");
+ const std::string source_text(std::string("EXPECT_CALL(") + obj + ", " +
+ call + ")");
LogWithLocation(internal::kInfo, file, line, source_text + " invoked");
return function_mocker_->AddNewExpectation(
file, line, source_text, matchers_);
@@ -1389,7 +1393,7 @@ class ActionResultHolder : public UntypedActionResultHolderBase {
static ActionResultHolder* PerformDefaultAction(
const FunctionMockerBase<F>* func_mocker,
const typename Function<F>::ArgumentTuple& args,
- const string& call_description) {
+ const std::string& call_description) {
return new ActionResultHolder(Wrapper(
func_mocker->PerformDefaultAction(args, call_description)));
}
@@ -1429,7 +1433,7 @@ class ActionResultHolder<void> : public UntypedActionResultHolderBase {
static ActionResultHolder* PerformDefaultAction(
const FunctionMockerBase<F>* func_mocker,
const typename Function<F>::ArgumentTuple& args,
- const string& call_description) {
+ const std::string& call_description) {
func_mocker->PerformDefaultAction(args, call_description);
return new ActionResultHolder;
}
@@ -1496,13 +1500,14 @@ class FunctionMockerBase : public UntypedFunctionMockerBase {
// without locking.
// L = *
Result PerformDefaultAction(const ArgumentTuple& args,
- const string& call_description) const {
+ const std::string& call_description) const {
const OnCallSpec<F>* const spec =
this->FindOnCallSpec(args);
if (spec != NULL) {
return spec->GetAction().Perform(args);
}
- const string message = call_description +
+ const std::string message =
+ call_description +
"\n The mock function has no default action "
"set, and its return type has no default value set.";
#if GTEST_HAS_EXCEPTIONS
@@ -1522,7 +1527,7 @@ class FunctionMockerBase : public UntypedFunctionMockerBase {
// L = *
virtual UntypedActionResultHolderBase* UntypedPerformDefaultAction(
const void* untyped_args, // must point to an ArgumentTuple
- const string& call_description) const {
+ const std::string& call_description) const {
const ArgumentTuple& args =
*static_cast<const ArgumentTuple*>(untyped_args);
return ResultHolder::PerformDefaultAction(this, args, call_description);
@@ -1598,12 +1603,10 @@ class FunctionMockerBase : public UntypedFunctionMockerBase {
}
// Adds and returns an expectation spec for this mock function.
- TypedExpectation<F>& AddNewExpectation(
- const char* file,
- int line,
- const string& source_text,
- const ArgumentMatcherTuple& m)
- GTEST_LOCK_EXCLUDED_(g_gmock_mutex) {
+ TypedExpectation<F>& AddNewExpectation(const char* file, int line,
+ const std::string& source_text,
+ const ArgumentMatcherTuple& m)
+ GTEST_LOCK_EXCLUDED_(g_gmock_mutex) {
Mock::RegisterUseByOnCallOrExpectCall(MockObject(), file, line);
TypedExpectation<F>* const expectation =
new TypedExpectation<F>(this, file, line, source_text, m);
@@ -1796,7 +1799,7 @@ class FunctionMockerBase : public UntypedFunctionMockerBase {
// Reports an uninteresting call (whose description is in msg) in the
// manner specified by 'reaction'.
-void ReportUninterestingCall(CallReaction reaction, const string& msg);
+void ReportUninterestingCall(CallReaction reaction, const std::string& msg);
} // namespace internal
diff --git a/googlemock/include/gmock/internal/gmock-internal-utils.h b/googlemock/include/gmock/internal/gmock-internal-utils.h
index e2ddb05c..7e65cea8 100644
--- a/googlemock/include/gmock/internal/gmock-internal-utils.h
+++ b/googlemock/include/gmock/internal/gmock-internal-utils.h
@@ -267,7 +267,7 @@ class FailureReporterInterface {
// Reports a failure that occurred at the given source file location.
virtual void ReportFailure(FailureType type, const char* file, int line,
- const string& message) = 0;
+ const std::string& message) = 0;
};
// Returns the failure reporter used by Google Mock.
@@ -279,7 +279,7 @@ GTEST_API_ FailureReporterInterface* GetFailureReporter();
// inline this function to prevent it from showing up in the stack
// trace.
inline void Assert(bool condition, const char* file, int line,
- const string& msg) {
+ const std::string& msg) {
if (!condition) {
GetFailureReporter()->ReportFailure(FailureReporterInterface::kFatal,
file, line, msg);
@@ -292,7 +292,7 @@ inline void Assert(bool condition, const char* file, int line) {
// Verifies that condition is true; generates a non-fatal failure if
// condition is false.
inline void Expect(bool condition, const char* file, int line,
- const string& msg) {
+ const std::string& msg) {
if (!condition) {
GetFailureReporter()->ReportFailure(FailureReporterInterface::kNonfatal,
file, line, msg);
@@ -328,8 +328,7 @@ GTEST_API_ bool LogIsVisible(LogSeverity severity);
// stack_frames_to_skip is treated as 0, since we don't know which
// function calls will be inlined by the compiler and need to be
// conservative.
-GTEST_API_ void Log(LogSeverity severity,
- const string& message,
+GTEST_API_ void Log(LogSeverity severity, const std::string& message,
int stack_frames_to_skip);
// TODO(wan@google.com): group all type utilities together.
diff --git a/googlemock/make/Makefile b/googlemock/make/Makefile
index c1cc0e90..7c13e05f 100644
--- a/googlemock/make/Makefile
+++ b/googlemock/make/Makefile
@@ -17,7 +17,7 @@
# Points to the root of Google Test, relative to where this file is.
# Remember to tweak this if you move this file, or if you want to use
# a copy of Google Test at a different location.
-GTEST_DIR = ../gtest
+GTEST_DIR = ../../googletest
# Points to the root of Google Mock, relative to where this file is.
# Remember to tweak this if you move this file.
diff --git a/googlemock/msvc/2005/gmock_config.vsprops b/googlemock/msvc/2005/gmock_config.vsprops
index 8b65cfb6..875939c1 100644
--- a/googlemock/msvc/2005/gmock_config.vsprops
+++ b/googlemock/msvc/2005/gmock_config.vsprops
@@ -10,6 +10,6 @@
/>
<UserMacro
Name="GTestDir"
- Value="../../gtest"
+ Value="../../../googletest"
/>
</VisualStudioPropertySheet>
diff --git a/googlemock/msvc/2010/gmock_config.props b/googlemock/msvc/2010/gmock_config.props
index bd497f1d..441f31cf 100644
--- a/googlemock/msvc/2010/gmock_config.props
+++ b/googlemock/msvc/2010/gmock_config.props
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Label="UserMacros">
- <GTestDir>../../gtest</GTestDir>
+ <GTestDir>../../../googletest</GTestDir>
</PropertyGroup>
<PropertyGroup>
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
diff --git a/googlemock/msvc/2015/gmock.sln b/googlemock/msvc/2015/gmock.sln
new file mode 100644
index 00000000..c59e07fc
--- /dev/null
+++ b/googlemock/msvc/2015/gmock.sln
@@ -0,0 +1,32 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 14
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gmock", "gmock.vcxproj", "{34681F0D-CE45-415D-B5F2-5C662DFE3BD5}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gmock_test", "gmock_test.vcxproj", "{F10D22F8-AC7B-4213-8720-608E7D878CD2}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gmock_main", "gmock_main.vcxproj", "{E4EF614B-30DF-4954-8C53-580A0BF6B589}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {34681F0D-CE45-415D-B5F2-5C662DFE3BD5}.Debug|Win32.ActiveCfg = Debug|Win32
+ {34681F0D-CE45-415D-B5F2-5C662DFE3BD5}.Debug|Win32.Build.0 = Debug|Win32
+ {34681F0D-CE45-415D-B5F2-5C662DFE3BD5}.Release|Win32.ActiveCfg = Release|Win32
+ {34681F0D-CE45-415D-B5F2-5C662DFE3BD5}.Release|Win32.Build.0 = Release|Win32
+ {F10D22F8-AC7B-4213-8720-608E7D878CD2}.Debug|Win32.ActiveCfg = Debug|Win32
+ {F10D22F8-AC7B-4213-8720-608E7D878CD2}.Debug|Win32.Build.0 = Debug|Win32
+ {F10D22F8-AC7B-4213-8720-608E7D878CD2}.Release|Win32.ActiveCfg = Release|Win32
+ {F10D22F8-AC7B-4213-8720-608E7D878CD2}.Release|Win32.Build.0 = Release|Win32
+ {E4EF614B-30DF-4954-8C53-580A0BF6B589}.Debug|Win32.ActiveCfg = Debug|Win32
+ {E4EF614B-30DF-4954-8C53-580A0BF6B589}.Debug|Win32.Build.0 = Debug|Win32
+ {E4EF614B-30DF-4954-8C53-580A0BF6B589}.Release|Win32.ActiveCfg = Release|Win32
+ {E4EF614B-30DF-4954-8C53-580A0BF6B589}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/googlemock/msvc/2015/gmock.vcxproj b/googlemock/msvc/2015/gmock.vcxproj
new file mode 100644
index 00000000..d5ddd091
--- /dev/null
+++ b/googlemock/msvc/2015/gmock.vcxproj
@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{34681F0D-CE45-415D-B5F2-5C662DFE3BD5}</ProjectGuid>
+ <RootNamespace>gmock</RootNamespace>
+ <Keyword>Win32Proj</Keyword>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <CharacterSet>Unicode</CharacterSet>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <PlatformToolset>v140</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <CharacterSet>Unicode</CharacterSet>
+ <PlatformToolset>v140</PlatformToolset>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ <Import Project="gmock_config.props" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ <Import Project="gmock_config.props" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup>
+ <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(OutDir)$(ProjectName)\</IntDir>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(OutDir)$(ProjectName)\</IntDir>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <Optimization>Disabled</Optimization>
+ <AdditionalIncludeDirectories>..\..\include;..\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MinimalRebuild>true</MinimalRebuild>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <AdditionalIncludeDirectories>..\..\include;..\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\src\gmock-all.cc" />
+ <ClCompile Include="$(GTestDir)\src\gtest-all.cc">
+ <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(GTestDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(GTestDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ </ClCompile>
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project> \ No newline at end of file
diff --git a/googlemock/msvc/2015/gmock_config.props b/googlemock/msvc/2015/gmock_config.props
new file mode 100644
index 00000000..77bc95b1
--- /dev/null
+++ b/googlemock/msvc/2015/gmock_config.props
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup Label="UserMacros">
+ <GTestDir>../../../googletest</GTestDir>
+ </PropertyGroup>
+ <PropertyGroup>
+ <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
+ </PropertyGroup>
+ <ItemDefinitionGroup>
+ <ClCompile>
+ <AdditionalIncludeDirectories>$(GTestDir)/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ </ClCompile>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <BuildMacro Include="GTestDir">
+ <Value>$(GTestDir)</Value>
+ </BuildMacro>
+ </ItemGroup>
+</Project>
diff --git a/googlemock/msvc/2015/gmock_main.vcxproj b/googlemock/msvc/2015/gmock_main.vcxproj
new file mode 100644
index 00000000..76cc68b9
--- /dev/null
+++ b/googlemock/msvc/2015/gmock_main.vcxproj
@@ -0,0 +1,90 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{E4EF614B-30DF-4954-8C53-580A0BF6B589}</ProjectGuid>
+ <RootNamespace>gmock_main</RootNamespace>
+ <Keyword>Win32Proj</Keyword>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <CharacterSet>Unicode</CharacterSet>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <PlatformToolset>v140</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <CharacterSet>Unicode</CharacterSet>
+ <PlatformToolset>v140</PlatformToolset>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ <Import Project="gmock_config.props" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ <Import Project="gmock_config.props" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup>
+ <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(OutDir)$(ProjectName)\</IntDir>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(OutDir)$(ProjectName)\</IntDir>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <Optimization>Disabled</Optimization>
+ <AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MinimalRebuild>true</MinimalRebuild>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ProjectReference Include="gmock.vcxproj">
+ <Project>{34681f0d-ce45-415d-b5f2-5c662dfe3bd5}</Project>
+ <CopyLocalSatelliteAssemblies>true</CopyLocalSatelliteAssemblies>
+ <ReferenceOutputAssembly>true</ReferenceOutputAssembly>
+ </ProjectReference>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\src\gmock_main.cc">
+ <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ </ClCompile>
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project> \ No newline at end of file
diff --git a/googlemock/msvc/2015/gmock_test.vcxproj b/googlemock/msvc/2015/gmock_test.vcxproj
new file mode 100644
index 00000000..76ea5534
--- /dev/null
+++ b/googlemock/msvc/2015/gmock_test.vcxproj
@@ -0,0 +1,103 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{F10D22F8-AC7B-4213-8720-608E7D878CD2}</ProjectGuid>
+ <RootNamespace>gmock_test</RootNamespace>
+ <Keyword>Win32Proj</Keyword>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <CharacterSet>Unicode</CharacterSet>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <PlatformToolset>v140</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <CharacterSet>Unicode</CharacterSet>
+ <PlatformToolset>v140</PlatformToolset>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ <Import Project="gmock_config.props" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ <Import Project="gmock_config.props" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup>
+ <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(OutDir)$(ProjectName)\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(OutDir)$(ProjectName)\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
+ <Optimization>Disabled</Optimization>
+ <AdditionalIncludeDirectories>..\..\include;..\..;$(GTestDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MinimalRebuild>true</MinimalRebuild>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <Link>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <SubSystem>Console</SubSystem>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
+ <AdditionalIncludeDirectories>..\..\include;..\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <Link>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <SubSystem>Console</SubSystem>
+ <OptimizeReferences>true</OptimizeReferences>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ProjectReference Include="gmock_main.vcxproj">
+ <Project>{e4ef614b-30df-4954-8c53-580a0bf6b589}</Project>
+ <CopyLocalSatelliteAssemblies>true</CopyLocalSatelliteAssemblies>
+ <ReferenceOutputAssembly>true</ReferenceOutputAssembly>
+ </ProjectReference>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\test\gmock_all_test.cc" />
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project> \ No newline at end of file
diff --git a/googlemock/src/gmock-cardinalities.cc b/googlemock/src/gmock-cardinalities.cc
index 50ec7286..335b966e 100644
--- a/googlemock/src/gmock-cardinalities.cc
+++ b/googlemock/src/gmock-cardinalities.cc
@@ -92,7 +92,7 @@ class BetweenCardinalityImpl : public CardinalityInterface {
};
// Formats "n times" in a human-friendly way.
-inline internal::string FormatTimes(int n) {
+inline std::string FormatTimes(int n) {
if (n == 1) {
return "once";
} else if (n == 2) {
diff --git a/googlemock/src/gmock-internal-utils.cc b/googlemock/src/gmock-internal-utils.cc
index fb530801..6464abc2 100644
--- a/googlemock/src/gmock-internal-utils.cc
+++ b/googlemock/src/gmock-internal-utils.cc
@@ -76,7 +76,7 @@ GTEST_API_ string ConvertIdentifierNameToWords(const char* id_name) {
class GoogleTestFailureReporter : public FailureReporterInterface {
public:
virtual void ReportFailure(FailureType type, const char* file, int line,
- const string& message) {
+ const std::string& message) {
AssertHelper(type == kFatal ?
TestPartResult::kFatalFailure :
TestPartResult::kNonFatalFailure,
@@ -128,8 +128,7 @@ GTEST_API_ bool LogIsVisible(LogSeverity severity) {
// stack_frames_to_skip is treated as 0, since we don't know which
// function calls will be inlined by the compiler and need to be
// conservative.
-GTEST_API_ void Log(LogSeverity severity,
- const string& message,
+GTEST_API_ void Log(LogSeverity severity, const std::string& message,
int stack_frames_to_skip) {
if (!LogIsVisible(severity))
return;
diff --git a/googlemock/src/gmock-matchers.cc b/googlemock/src/gmock-matchers.cc
index e7424510..e0de25cb 100644
--- a/googlemock/src/gmock-matchers.cc
+++ b/googlemock/src/gmock-matchers.cc
@@ -379,7 +379,7 @@ void MatchMatrix::Randomize() {
}
}
-string MatchMatrix::DebugString() const {
+std::string MatchMatrix::DebugString() const {
::std::stringstream ss;
const char *sep = "";
for (size_t i = 0; i < LhsSize(); ++i) {
@@ -441,10 +441,9 @@ void UnorderedElementsAreMatcherImplBase::DescribeNegationToImpl(
// Returns false, writing an explanation to 'listener', if and only
// if the success criteria are not met.
bool UnorderedElementsAreMatcherImplBase::
-VerifyAllElementsAndMatchersAreMatched(
- const ::std::vector<string>& element_printouts,
- const MatchMatrix& matrix,
- MatchResultListener* listener) const {
+ VerifyAllElementsAndMatchersAreMatched(
+ const ::std::vector<std::string>& element_printouts,
+ const MatchMatrix& matrix, MatchResultListener* listener) const {
bool result = true;
::std::vector<char> element_matched(matrix.LhsSize(), 0);
::std::vector<char> matcher_matched(matrix.RhsSize(), 0);
diff --git a/googlemock/src/gmock-spec-builders.cc b/googlemock/src/gmock-spec-builders.cc
index 2b48af13..2fa1ee4b 100644
--- a/googlemock/src/gmock-spec-builders.cc
+++ b/googlemock/src/gmock-spec-builders.cc
@@ -58,16 +58,15 @@ GTEST_API_ GTEST_DEFINE_STATIC_MUTEX_(g_gmock_mutex);
// Logs a message including file and line number information.
GTEST_API_ void LogWithLocation(testing::internal::LogSeverity severity,
const char* file, int line,
- const string& message) {
+ const std::string& message) {
::std::ostringstream s;
s << file << ":" << line << ": " << message << ::std::endl;
Log(severity, s.str(), 0);
}
// Constructs an ExpectationBase object.
-ExpectationBase::ExpectationBase(const char* a_file,
- int a_line,
- const string& a_source_text)
+ExpectationBase::ExpectationBase(const char* a_file, int a_line,
+ const std::string& a_source_text)
: file_(a_file),
line_(a_line),
source_text_(a_source_text),
@@ -244,7 +243,7 @@ GTEST_API_ ThreadLocal<Sequence*> g_gmock_implicit_sequence;
// Reports an uninteresting call (whose description is in msg) in the
// manner specified by 'reaction'.
-void ReportUninterestingCall(CallReaction reaction, const string& msg) {
+void ReportUninterestingCall(CallReaction reaction, const std::string& msg) {
// Include a stack trace only if --gmock_verbose=info is specified.
const int stack_frames_to_skip =
GMOCK_FLAG(verbose) == kInfoVerbosity ? 3 : -1;
@@ -258,8 +257,8 @@ void ReportUninterestingCall(CallReaction reaction, const string& msg) {
"\nNOTE: You can safely ignore the above warning unless this "
"call should not happen. Do not suppress it by blindly adding "
"an EXPECT_CALL() if you don't mean to enforce the call. "
- "See http://code.google.com/p/googlemock/wiki/CookBook#"
- "Knowing_When_to_Expect for details.\n",
+ "See https://github.com/google/googletest/blob/master/googlemock/docs/CookBook.md#"
+ "knowing-when-to-expect for details.\n",
stack_frames_to_skip);
break;
default: // FAIL
diff --git a/googlemock/test/gmock-generated-actions_test.cc b/googlemock/test/gmock-generated-actions_test.cc
index 5ca5bc78..58d45728 100644
--- a/googlemock/test/gmock-generated-actions_test.cc
+++ b/googlemock/test/gmock-generated-actions_test.cc
@@ -81,12 +81,12 @@ bool Unary(int x) { return x < 0; }
const char* Plus1(const char* s) { return s + 1; }
-bool ByConstRef(const string& s) { return s == "Hi"; }
+bool ByConstRef(const std::string& s) { return s == "Hi"; }
const double g_double = 0;
bool ReferencesGlobalDouble(const double& x) { return &x == &g_double; }
-string ByNonConstRef(string& s) { return s += "+"; } // NOLINT
+std::string ByNonConstRef(std::string& s) { return s += "+"; } // NOLINT
struct UnaryFunctor {
int operator()(bool x) { return x ? 1 : -1; }
@@ -102,9 +102,9 @@ void VoidTernary(int, char, bool) { g_done = true; }
int SumOf4(int a, int b, int c, int d) { return a + b + c + d; }
-string Concat4(const char* s1, const char* s2, const char* s3,
- const char* s4) {
- return string(s1) + s2 + s3 + s4;
+std::string Concat4(const char* s1, const char* s2, const char* s3,
+ const char* s4) {
+ return std::string(s1) + s2 + s3 + s4;
}
int SumOf5(int a, int b, int c, int d, int e) { return a + b + c + d + e; }
@@ -115,9 +115,9 @@ struct SumOf5Functor {
}
};
-string Concat5(const char* s1, const char* s2, const char* s3,
- const char* s4, const char* s5) {
- return string(s1) + s2 + s3 + s4 + s5;
+std::string Concat5(const char* s1, const char* s2, const char* s3,
+ const char* s4, const char* s5) {
+ return std::string(s1) + s2 + s3 + s4 + s5;
}
int SumOf6(int a, int b, int c, int d, int e, int f) {
@@ -130,34 +130,34 @@ struct SumOf6Functor {
}
};
-string Concat6(const char* s1, const char* s2, const char* s3,
- const char* s4, const char* s5, const char* s6) {
- return string(s1) + s2 + s3 + s4 + s5 + s6;
+std::string Concat6(const char* s1, const char* s2, const char* s3,
+ const char* s4, const char* s5, const char* s6) {
+ return std::string(s1) + s2 + s3 + s4 + s5 + s6;
}
-string Concat7(const char* s1, const char* s2, const char* s3,
- const char* s4, const char* s5, const char* s6,
- const char* s7) {
- return string(s1) + s2 + s3 + s4 + s5 + s6 + s7;
+std::string Concat7(const char* s1, const char* s2, const char* s3,
+ const char* s4, const char* s5, const char* s6,
+ const char* s7) {
+ return std::string(s1) + s2 + s3 + s4 + s5 + s6 + s7;
}
-string Concat8(const char* s1, const char* s2, const char* s3,
- const char* s4, const char* s5, const char* s6,
- const char* s7, const char* s8) {
- return string(s1) + s2 + s3 + s4 + s5 + s6 + s7 + s8;
+std::string Concat8(const char* s1, const char* s2, const char* s3,
+ const char* s4, const char* s5, const char* s6,
+ const char* s7, const char* s8) {
+ return std::string(s1) + s2 + s3 + s4 + s5 + s6 + s7 + s8;
}
-string Concat9(const char* s1, const char* s2, const char* s3,
- const char* s4, const char* s5, const char* s6,
- const char* s7, const char* s8, const char* s9) {
- return string(s1) + s2 + s3 + s4 + s5 + s6 + s7 + s8 + s9;
+std::string Concat9(const char* s1, const char* s2, const char* s3,
+ const char* s4, const char* s5, const char* s6,
+ const char* s7, const char* s8, const char* s9) {
+ return std::string(s1) + s2 + s3 + s4 + s5 + s6 + s7 + s8 + s9;
}
-string Concat10(const char* s1, const char* s2, const char* s3,
- const char* s4, const char* s5, const char* s6,
- const char* s7, const char* s8, const char* s9,
- const char* s10) {
- return string(s1) + s2 + s3 + s4 + s5 + s6 + s7 + s8 + s9 + s10;
+std::string Concat10(const char* s1, const char* s2, const char* s3,
+ const char* s4, const char* s5, const char* s6,
+ const char* s7, const char* s8, const char* s9,
+ const char* s10) {
+ return std::string(s1) + s2 + s3 + s4 + s5 + s6 + s7 + s8 + s9 + s10;
}
// A helper that turns the type of a C-string literal from const
@@ -208,38 +208,37 @@ TEST(InvokeArgumentTest, Functor6) {
// Tests using InvokeArgument with a 7-ary function.
TEST(InvokeArgumentTest, Function7) {
- Action<string(string(*)(const char*, const char*, const char*,
- const char*, const char*, const char*,
- const char*))> a =
- InvokeArgument<0>("1", "2", "3", "4", "5", "6", "7");
+ Action<std::string(std::string(*)(const char*, const char*, const char*,
+ const char*, const char*, const char*,
+ const char*))>
+ a = InvokeArgument<0>("1", "2", "3", "4", "5", "6", "7");
EXPECT_EQ("1234567", a.Perform(make_tuple(&Concat7)));
}
// Tests using InvokeArgument with a 8-ary function.
TEST(InvokeArgumentTest, Function8) {
- Action<string(string(*)(const char*, const char*, const char*,
- const char*, const char*, const char*,
- const char*, const char*))> a =
- InvokeArgument<0>("1", "2", "3", "4", "5", "6", "7", "8");
+ Action<std::string(std::string(*)(const char*, const char*, const char*,
+ const char*, const char*, const char*,
+ const char*, const char*))>
+ a = InvokeArgument<0>("1", "2", "3", "4", "5", "6", "7", "8");
EXPECT_EQ("12345678", a.Perform(make_tuple(&Concat8)));
}
// Tests using InvokeArgument with a 9-ary function.
TEST(InvokeArgumentTest, Function9) {
- Action<string(string(*)(const char*, const char*, const char*,
- const char*, const char*, const char*,
- const char*, const char*, const char*))> a =
- InvokeArgument<0>("1", "2", "3", "4", "5", "6", "7", "8", "9");
+ Action<std::string(std::string(*)(const char*, const char*, const char*,
+ const char*, const char*, const char*,
+ const char*, const char*, const char*))>
+ a = InvokeArgument<0>("1", "2", "3", "4", "5", "6", "7", "8", "9");
EXPECT_EQ("123456789", a.Perform(make_tuple(&Concat9)));
}
// Tests using InvokeArgument with a 10-ary function.
TEST(InvokeArgumentTest, Function10) {
- Action<string(string(*)(const char*, const char*, const char*,
- const char*, const char*, const char*,
- const char*, const char*, const char*,
- const char*))> a =
- InvokeArgument<0>("1", "2", "3", "4", "5", "6", "7", "8", "9", "0");
+ Action<std::string(std::string(*)(
+ const char*, const char*, const char*, const char*, const char*,
+ const char*, const char*, const char*, const char*, const char*))>
+ a = InvokeArgument<0>("1", "2", "3", "4", "5", "6", "7", "8", "9", "0");
EXPECT_EQ("1234567890", a.Perform(make_tuple(&Concat10)));
}
@@ -260,8 +259,8 @@ TEST(InvokeArgumentTest, FunctionWithCStringLiteral) {
// Tests using InvokeArgument with a function that takes a const reference.
TEST(InvokeArgumentTest, ByConstReferenceFunction) {
- Action<bool(bool(*function)(const string& s))> a = // NOLINT
- InvokeArgument<0>(string("Hi"));
+ Action<bool(bool (*function)(const std::string& s))> a = // NOLINT
+ InvokeArgument<0>(std::string("Hi"));
// When action 'a' is constructed, it makes a copy of the temporary
// string object passed to it, so it's OK to use 'a' later, when the
// temporary object has already died.
@@ -305,17 +304,18 @@ TEST(WithArgsTest, ThreeArgs) {
// Tests using WithArgs with an action that takes 4 arguments.
TEST(WithArgsTest, FourArgs) {
- Action<string(const char*, const char*, double, const char*, const char*)> a =
- WithArgs<4, 3, 1, 0>(Invoke(Concat4));
+ Action<std::string(const char*, const char*, double, const char*,
+ const char*)>
+ a = WithArgs<4, 3, 1, 0>(Invoke(Concat4));
EXPECT_EQ("4310", a.Perform(make_tuple(CharPtr("0"), CharPtr("1"), 2.5,
CharPtr("3"), CharPtr("4"))));
}
// Tests using WithArgs with an action that takes 5 arguments.
TEST(WithArgsTest, FiveArgs) {
- Action<string(const char*, const char*, const char*,
- const char*, const char*)> a =
- WithArgs<4, 3, 2, 1, 0>(Invoke(Concat5));
+ Action<std::string(const char*, const char*, const char*, const char*,
+ const char*)>
+ a = WithArgs<4, 3, 2, 1, 0>(Invoke(Concat5));
EXPECT_EQ("43210",
a.Perform(make_tuple(CharPtr("0"), CharPtr("1"), CharPtr("2"),
CharPtr("3"), CharPtr("4"))));
@@ -323,7 +323,7 @@ TEST(WithArgsTest, FiveArgs) {
// Tests using WithArgs with an action that takes 6 arguments.
TEST(WithArgsTest, SixArgs) {
- Action<string(const char*, const char*, const char*)> a =
+ Action<std::string(const char*, const char*, const char*)> a =
WithArgs<0, 1, 2, 2, 1, 0>(Invoke(Concat6));
EXPECT_EQ("012210",
a.Perform(make_tuple(CharPtr("0"), CharPtr("1"), CharPtr("2"))));
@@ -331,7 +331,7 @@ TEST(WithArgsTest, SixArgs) {
// Tests using WithArgs with an action that takes 7 arguments.
TEST(WithArgsTest, SevenArgs) {
- Action<string(const char*, const char*, const char*, const char*)> a =
+ Action<std::string(const char*, const char*, const char*, const char*)> a =
WithArgs<0, 1, 2, 3, 2, 1, 0>(Invoke(Concat7));
EXPECT_EQ("0123210",
a.Perform(make_tuple(CharPtr("0"), CharPtr("1"), CharPtr("2"),
@@ -340,7 +340,7 @@ TEST(WithArgsTest, SevenArgs) {
// Tests using WithArgs with an action that takes 8 arguments.
TEST(WithArgsTest, EightArgs) {
- Action<string(const char*, const char*, const char*, const char*)> a =
+ Action<std::string(const char*, const char*, const char*, const char*)> a =
WithArgs<0, 1, 2, 3, 0, 1, 2, 3>(Invoke(Concat8));
EXPECT_EQ("01230123",
a.Perform(make_tuple(CharPtr("0"), CharPtr("1"), CharPtr("2"),
@@ -349,7 +349,7 @@ TEST(WithArgsTest, EightArgs) {
// Tests using WithArgs with an action that takes 9 arguments.
TEST(WithArgsTest, NineArgs) {
- Action<string(const char*, const char*, const char*, const char*)> a =
+ Action<std::string(const char*, const char*, const char*, const char*)> a =
WithArgs<0, 1, 2, 3, 1, 2, 3, 2, 3>(Invoke(Concat9));
EXPECT_EQ("012312323",
a.Perform(make_tuple(CharPtr("0"), CharPtr("1"), CharPtr("2"),
@@ -358,7 +358,7 @@ TEST(WithArgsTest, NineArgs) {
// Tests using WithArgs with an action that takes 10 arguments.
TEST(WithArgsTest, TenArgs) {
- Action<string(const char*, const char*, const char*, const char*)> a =
+ Action<std::string(const char*, const char*, const char*, const char*)> a =
WithArgs<0, 1, 2, 3, 2, 1, 0, 1, 2, 3>(Invoke(Concat10));
EXPECT_EQ("0123210123",
a.Perform(make_tuple(CharPtr("0"), CharPtr("1"), CharPtr("2"),
diff --git a/googlemock/test/gmock-generated-function-mockers_test.cc b/googlemock/test/gmock-generated-function-mockers_test.cc
index a86a6135..08e5eba1 100644
--- a/googlemock/test/gmock-generated-function-mockers_test.cc
+++ b/googlemock/test/gmock-generated-function-mockers_test.cc
@@ -57,7 +57,6 @@
namespace testing {
namespace gmock_generated_function_mockers_test {
-using testing::internal::string;
using testing::_;
using testing::A;
using testing::An;
@@ -82,11 +81,11 @@ class FooInterface {
virtual bool Unary(int x) = 0;
virtual long Binary(short x, int y) = 0; // NOLINT
virtual int Decimal(bool b, char c, short d, int e, long f, // NOLINT
- float g, double h, unsigned i, char* j, const string& k)
- = 0;
+ float g, double h, unsigned i, char* j,
+ const std::string& k) = 0;
virtual bool TakesNonConstReference(int& n) = 0; // NOLINT
- virtual string TakesConstReference(const int& n) = 0;
+ virtual std::string TakesConstReference(const int& n) = 0;
#ifdef GMOCK_ALLOWS_CONST_PARAM_FUNCTIONS
virtual bool TakesConst(const int x) = 0;
#endif // GMOCK_ALLOWS_CONST_PARAM_FUNCTIONS
@@ -101,13 +100,14 @@ class FooInterface {
virtual char OverloadedOnConstness() const = 0;
virtual int TypeWithHole(int (*func)()) = 0;
- virtual int TypeWithComma(const std::map<int, string>& a_map) = 0;
+ virtual int TypeWithComma(const std::map<int, std::string>& a_map) = 0;
#if GTEST_OS_WINDOWS
STDMETHOD_(int, CTNullary)() = 0;
STDMETHOD_(bool, CTUnary)(int x) = 0;
- STDMETHOD_(int, CTDecimal)(bool b, char c, short d, int e, long f, // NOLINT
- float g, double h, unsigned i, char* j, const string& k) = 0;
+ STDMETHOD_(int, CTDecimal)
+ (bool b, char c, short d, int e, long f, // NOLINT
+ float g, double h, unsigned i, char* j, const std::string& k) = 0;
STDMETHOD_(char, CTConst)(int x) const = 0;
#endif // GTEST_OS_WINDOWS
};
@@ -133,19 +133,19 @@ class MockFoo : public FooInterface {
MOCK_METHOD1(Unary, bool(int)); // NOLINT
MOCK_METHOD2(Binary, long(short, int)); // NOLINT
MOCK_METHOD10(Decimal, int(bool, char, short, int, long, float, // NOLINT
- double, unsigned, char*, const string& str));
+ double, unsigned, char*, const std::string& str));
MOCK_METHOD1(TakesNonConstReference, bool(int&)); // NOLINT
- MOCK_METHOD1(TakesConstReference, string(const int&));
+ MOCK_METHOD1(TakesConstReference, std::string(const int&));
#ifdef GMOCK_ALLOWS_CONST_PARAM_FUNCTIONS
MOCK_METHOD1(TakesConst, bool(const int)); // NOLINT
#endif
// Tests that the function return type can contain unprotected comma.
- MOCK_METHOD0(ReturnTypeWithComma, std::map<int, string>());
+ MOCK_METHOD0(ReturnTypeWithComma, std::map<int, std::string>());
MOCK_CONST_METHOD1(ReturnTypeWithComma,
- std::map<int, string>(int)); // NOLINT
+ std::map<int, std::string>(int)); // NOLINT
MOCK_METHOD0(OverloadedOnArgumentNumber, int()); // NOLINT
MOCK_METHOD1(OverloadedOnArgumentNumber, int(int)); // NOLINT
@@ -157,19 +157,21 @@ class MockFoo : public FooInterface {
MOCK_CONST_METHOD0(OverloadedOnConstness, char()); // NOLINT
MOCK_METHOD1(TypeWithHole, int(int (*)())); // NOLINT
- MOCK_METHOD1(TypeWithComma, int(const std::map<int, string>&)); // NOLINT
+ MOCK_METHOD1(TypeWithComma,
+ int(const std::map<int, std::string>&)); // NOLINT
#if GTEST_OS_WINDOWS
MOCK_METHOD0_WITH_CALLTYPE(STDMETHODCALLTYPE, CTNullary, int());
MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, CTUnary, bool(int));
- MOCK_METHOD10_WITH_CALLTYPE(STDMETHODCALLTYPE, CTDecimal, int(bool b, char c,
- short d, int e, long f, float g, double h, unsigned i, char* j,
- const string& k));
+ MOCK_METHOD10_WITH_CALLTYPE(STDMETHODCALLTYPE, CTDecimal,
+ int(bool b, char c, short d, int e, long f,
+ float g, double h, unsigned i, char* j,
+ const std::string& k));
MOCK_CONST_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, CTConst, char(int));
// Tests that the function return type can contain unprotected comma.
MOCK_METHOD0_WITH_CALLTYPE(STDMETHODCALLTYPE, CTReturnTypeWithComma,
- std::map<int, string>());
+ std::map<int, std::string>());
#endif // GTEST_OS_WINDOWS
private:
@@ -291,7 +293,7 @@ TEST_F(FunctionMockerTest, MocksFunctionsOverloadedOnConstnessOfThis) {
}
TEST_F(FunctionMockerTest, MocksReturnTypeWithComma) {
- const std::map<int, string> a_map;
+ const std::map<int, std::string> a_map;
EXPECT_CALL(mock_foo_, ReturnTypeWithComma())
.WillOnce(Return(a_map));
EXPECT_CALL(mock_foo_, ReturnTypeWithComma(42))
@@ -341,7 +343,7 @@ TEST_F(FunctionMockerTest, MocksFunctionsConstFunctionWithCallType) {
}
TEST_F(FunctionMockerTest, MocksReturnTypeWithCommaAndCallType) {
- const std::map<int, string> a_map;
+ const std::map<int, std::string> a_map;
EXPECT_CALL(mock_foo_, CTReturnTypeWithComma())
.WillOnce(Return(a_map));
diff --git a/googlemock/test/gmock-generated-matchers_test.cc b/googlemock/test/gmock-generated-matchers_test.cc
index 0e9f77f5..8234858d 100644
--- a/googlemock/test/gmock-generated-matchers_test.cc
+++ b/googlemock/test/gmock-generated-matchers_test.cc
@@ -79,11 +79,10 @@ using testing::StaticAssertTypeEq;
using testing::StrEq;
using testing::Value;
using testing::internal::ElementsAreArrayMatcher;
-using testing::internal::string;
// Returns the description of the given matcher.
template <typename T>
-string Describe(const Matcher<T>& m) {
+std::string Describe(const Matcher<T>& m) {
stringstream ss;
m.DescribeTo(&ss);
return ss.str();
@@ -91,7 +90,7 @@ string Describe(const Matcher<T>& m) {
// Returns the description of the negation of the given matcher.
template <typename T>
-string DescribeNegation(const Matcher<T>& m) {
+std::string DescribeNegation(const Matcher<T>& m) {
stringstream ss;
m.DescribeNegationTo(&ss);
return ss.str();
@@ -99,7 +98,7 @@ string DescribeNegation(const Matcher<T>& m) {
// Returns the reason why x matches, or doesn't match, m.
template <typename MatcherType, typename Value>
-string Explain(const MatcherType& m, const Value& x) {
+std::string Explain(const MatcherType& m, const Value& x) {
stringstream ss;
m.ExplainMatchResultTo(x, &ss);
return ss.str();
@@ -296,7 +295,7 @@ TEST(ElementsAreTest, CanDescribeExpectingOneElement) {
}
TEST(ElementsAreTest, CanDescribeExpectingManyElements) {
- Matcher<list<string> > m = ElementsAre(StrEq("one"), "two");
+ Matcher<list<std::string> > m = ElementsAre(StrEq("one"), "two");
EXPECT_EQ("has 2 elements where\n"
"element #0 is equal to \"one\",\n"
"element #1 is equal to \"two\"", Describe(m));
@@ -314,7 +313,7 @@ TEST(ElementsAreTest, CanDescribeNegationOfExpectingOneElment) {
}
TEST(ElementsAreTest, CanDescribeNegationOfExpectingManyElements) {
- Matcher<const list<string>& > m = ElementsAre("one", "two");
+ Matcher<const list<std::string>&> m = ElementsAre("one", "two");
EXPECT_EQ("doesn't have 2 elements, or\n"
"element #0 isn't equal to \"one\", or\n"
"element #1 isn't equal to \"two\"", DescribeNegation(m));
@@ -365,21 +364,21 @@ TEST(ElementsAreTest, CanExplainMismatchRightSize) {
}
TEST(ElementsAreTest, MatchesOneElementVector) {
- vector<string> test_vector;
+ vector<std::string> test_vector;
test_vector.push_back("test string");
EXPECT_THAT(test_vector, ElementsAre(StrEq("test string")));
}
TEST(ElementsAreTest, MatchesOneElementList) {
- list<string> test_list;
+ list<std::string> test_list;
test_list.push_back("test string");
EXPECT_THAT(test_list, ElementsAre("test string"));
}
TEST(ElementsAreTest, MatchesThreeElementVector) {
- vector<string> test_vector;
+ vector<std::string> test_vector;
test_vector.push_back("one");
test_vector.push_back("two");
test_vector.push_back("three");
@@ -428,30 +427,30 @@ TEST(ElementsAreTest, MatchesTenElementVector) {
}
TEST(ElementsAreTest, DoesNotMatchWrongSize) {
- vector<string> test_vector;
+ vector<std::string> test_vector;
test_vector.push_back("test string");
test_vector.push_back("test string");
- Matcher<vector<string> > m = ElementsAre(StrEq("test string"));
+ Matcher<vector<std::string> > m = ElementsAre(StrEq("test string"));
EXPECT_FALSE(m.Matches(test_vector));
}
TEST(ElementsAreTest, DoesNotMatchWrongValue) {
- vector<string> test_vector;
+ vector<std::string> test_vector;
test_vector.push_back("other string");
- Matcher<vector<string> > m = ElementsAre(StrEq("test string"));
+ Matcher<vector<std::string> > m = ElementsAre(StrEq("test string"));
EXPECT_FALSE(m.Matches(test_vector));
}
TEST(ElementsAreTest, DoesNotMatchWrongOrder) {
- vector<string> test_vector;
+ vector<std::string> test_vector;
test_vector.push_back("one");
test_vector.push_back("three");
test_vector.push_back("two");
- Matcher<vector<string> > m = ElementsAre(
- StrEq("one"), StrEq("two"), StrEq("three"));
+ Matcher<vector<std::string> > m =
+ ElementsAre(StrEq("one"), StrEq("two"), StrEq("three"));
EXPECT_FALSE(m.Matches(test_vector));
}
@@ -527,7 +526,7 @@ TEST(ElementsAreTest, WorksWithTwoDimensionalNativeArray) {
}
TEST(ElementsAreTest, AcceptsStringLiteral) {
- string array[] = { "hi", "one", "two" };
+ std::string array[] = {"hi", "one", "two"};
EXPECT_THAT(array, ElementsAre("hi", "one", "two"));
EXPECT_THAT(array, Not(ElementsAre("hi", "one", "too")));
}
@@ -546,10 +545,10 @@ TEST(ElementsAreTest, AcceptsArrayWithUnknownSize) {
// The size of kHi is not known in this test, but ElementsAre() should
// still accept it.
- string array1[] = { "hi" };
+ std::string array1[] = {"hi"};
EXPECT_THAT(array1, ElementsAre(kHi));
- string array2[] = { "ho" };
+ std::string array2[] = {"ho"};
EXPECT_THAT(array2, Not(ElementsAre(kHi)));
}
@@ -589,7 +588,7 @@ TEST(ElementsAreArrayTest, CanBeCreatedWithValueArray) {
TEST(ElementsAreArrayTest, CanBeCreatedWithArraySize) {
const char* a[] = { "one", "two", "three" };
- vector<string> test_vector(a, a + GTEST_ARRAY_SIZE_(a));
+ vector<std::string> test_vector(a, a + GTEST_ARRAY_SIZE_(a));
EXPECT_THAT(test_vector, ElementsAreArray(a, GTEST_ARRAY_SIZE_(a)));
const char** p = a;
@@ -600,7 +599,7 @@ TEST(ElementsAreArrayTest, CanBeCreatedWithArraySize) {
TEST(ElementsAreArrayTest, CanBeCreatedWithoutArraySize) {
const char* a[] = { "one", "two", "three" };
- vector<string> test_vector(a, a + GTEST_ARRAY_SIZE_(a));
+ vector<std::string> test_vector(a, a + GTEST_ARRAY_SIZE_(a));
EXPECT_THAT(test_vector, ElementsAreArray(a));
test_vector[0] = "1";
@@ -608,10 +607,10 @@ TEST(ElementsAreArrayTest, CanBeCreatedWithoutArraySize) {
}
TEST(ElementsAreArrayTest, CanBeCreatedWithMatcherArray) {
- const Matcher<string> kMatcherArray[] =
- { StrEq("one"), StrEq("two"), StrEq("three") };
+ const Matcher<std::string> kMatcherArray[] = {StrEq("one"), StrEq("two"),
+ StrEq("three")};
- vector<string> test_vector;
+ vector<std::string> test_vector;
test_vector.push_back("one");
test_vector.push_back("two");
test_vector.push_back("three");
@@ -640,7 +639,7 @@ TEST(ElementsAreArrayTest, TakesInitializerList) {
}
TEST(ElementsAreArrayTest, TakesInitializerListOfCStrings) {
- const string a[5] = { "a", "b", "c", "d", "e" };
+ const std::string a[5] = {"a", "b", "c", "d", "e"};
EXPECT_THAT(a, ElementsAreArray({ "a", "b", "c", "d", "e" }));
EXPECT_THAT(a, Not(ElementsAreArray({ "a", "b", "c", "e", "d" })));
EXPECT_THAT(a, Not(ElementsAreArray({ "a", "b", "c", "d", "ef" })));
@@ -751,9 +750,9 @@ MATCHER(IsEven2, negation ? "is odd" : "is even") {
// This also tests that the description string can reference matcher
// parameters.
-MATCHER_P2(EqSumOf, x, y,
- string(negation ? "doesn't equal" : "equals") + " the sum of " +
- PrintToString(x) + " and " + PrintToString(y)) {
+MATCHER_P2(EqSumOf, x, y, std::string(negation ? "doesn't equal" : "equals") +
+ " the sum of " + PrintToString(x) + " and " +
+ PrintToString(y)) {
if (arg == (x + y)) {
*result_listener << "OK";
return true;
@@ -1117,12 +1116,12 @@ TEST(ContainsTest, ListMatchesWhenElementIsInContainer) {
EXPECT_THAT(some_list, Contains(Gt(2.5)));
EXPECT_THAT(some_list, Contains(Eq(2.0f)));
- list<string> another_list;
+ list<std::string> another_list;
another_list.push_back("fee");
another_list.push_back("fie");
another_list.push_back("foe");
another_list.push_back("fum");
- EXPECT_THAT(another_list, Contains(string("fee")));
+ EXPECT_THAT(another_list, Contains(std::string("fee")));
}
TEST(ContainsTest, ListDoesNotMatchWhenElementIsNotInContainer) {
@@ -1146,7 +1145,7 @@ TEST(ContainsTest, SetMatchesWhenElementIsInContainer) {
another_set.insert("fie");
another_set.insert("foe");
another_set.insert("fum");
- EXPECT_THAT(another_set, Contains(Eq(string("fum"))));
+ EXPECT_THAT(another_set, Contains(Eq(std::string("fum"))));
}
TEST(ContainsTest, SetDoesNotMatchWhenElementIsNotInContainer) {
@@ -1157,7 +1156,7 @@ TEST(ContainsTest, SetDoesNotMatchWhenElementIsNotInContainer) {
set<const char*> c_string_set;
c_string_set.insert("hello");
- EXPECT_THAT(c_string_set, Not(Contains(string("hello").c_str())));
+ EXPECT_THAT(c_string_set, Not(Contains(std::string("hello").c_str())));
}
TEST(ContainsTest, ExplainsMatchResultCorrectly) {
@@ -1189,13 +1188,14 @@ TEST(ContainsTest, MapMatchesWhenElementIsInContainer) {
my_map[bar] = 2;
EXPECT_THAT(my_map, Contains(pair<const char* const, int>(bar, 2)));
- map<string, int> another_map;
+ map<std::string, int> another_map;
another_map["fee"] = 1;
another_map["fie"] = 2;
another_map["foe"] = 3;
another_map["fum"] = 4;
- EXPECT_THAT(another_map, Contains(pair<const string, int>(string("fee"), 1)));
- EXPECT_THAT(another_map, Contains(pair<const string, int>("fie", 2)));
+ EXPECT_THAT(another_map,
+ Contains(pair<const std::string, int>(std::string("fee"), 1)));
+ EXPECT_THAT(another_map, Contains(pair<const std::string, int>("fie", 2)));
}
TEST(ContainsTest, MapDoesNotMatchWhenElementIsNotInContainer) {
@@ -1207,7 +1207,7 @@ TEST(ContainsTest, MapDoesNotMatchWhenElementIsNotInContainer) {
TEST(ContainsTest, ArrayMatchesWhenElementIsInContainer) {
const char* string_array[] = { "fee", "fie", "foe", "fum" };
- EXPECT_THAT(string_array, Contains(Eq(string("fum"))));
+ EXPECT_THAT(string_array, Contains(Eq(std::string("fum"))));
}
TEST(ContainsTest, ArrayDoesNotMatchWhenElementIsNotInContainer) {
diff --git a/googlemock/test/gmock-internal-utils_test.cc b/googlemock/test/gmock-internal-utils_test.cc
index 9d5ec609..9c2423ec 100644
--- a/googlemock/test/gmock-internal-utils_test.cc
+++ b/googlemock/test/gmock-internal-utils_test.cc
@@ -319,11 +319,10 @@ TEST(TupleMatchesTest, WorksForSize2) {
TEST(TupleMatchesTest, WorksForSize5) {
tuple<Matcher<int>, Matcher<char>, Matcher<bool>, Matcher<long>, // NOLINT
- Matcher<string> >
+ Matcher<std::string> >
matchers(Eq(1), Eq('a'), Eq(true), Eq(2L), Eq("hi"));
- tuple<int, char, bool, long, string> // NOLINT
- values1(1, 'a', true, 2L, "hi"),
- values2(1, 'a', true, 2L, "hello"),
+ tuple<int, char, bool, long, std::string> // NOLINT
+ values1(1, 'a', true, 2L, "hi"), values2(1, 'a', true, 2L, "hello"),
values3(2, 'a', true, 2L, "hi");
EXPECT_TRUE(TupleMatches(matchers, values1));
@@ -375,7 +374,7 @@ class LogIsVisibleTest : public ::testing::Test {
virtual void TearDown() { GMOCK_FLAG(verbose) = original_verbose_; }
- string original_verbose_;
+ std::string original_verbose_;
};
TEST_F(LogIsVisibleTest, AlwaysReturnsTrueIfVerbosityIsInfo) {
@@ -402,9 +401,9 @@ TEST_F(LogIsVisibleTest, WorksWhenVerbosityIsWarning) {
// Verifies that Log() behaves correctly for the given verbosity level
// and log severity.
-void TestLogWithSeverity(const string& verbosity, LogSeverity severity,
+void TestLogWithSeverity(const std::string& verbosity, LogSeverity severity,
bool should_print) {
- const string old_flag = GMOCK_FLAG(verbose);
+ const std::string old_flag = GMOCK_FLAG(verbose);
GMOCK_FLAG(verbose) = verbosity;
CaptureStdout();
Log(severity, "Test log.\n", 0);
@@ -423,7 +422,7 @@ void TestLogWithSeverity(const string& verbosity, LogSeverity severity,
// Tests that when the stack_frames_to_skip parameter is negative,
// Log() doesn't include the stack trace in the output.
TEST(LogTest, NoStackTraceWhenStackFramesToSkipIsNegative) {
- const string saved_flag = GMOCK_FLAG(verbose);
+ const std::string saved_flag = GMOCK_FLAG(verbose);
GMOCK_FLAG(verbose) = kInfoVerbosity;
CaptureStdout();
Log(kInfo, "Test log.\n", -1);
@@ -432,7 +431,7 @@ TEST(LogTest, NoStackTraceWhenStackFramesToSkipIsNegative) {
}
struct MockStackTraceGetter : testing::internal::OsStackTraceGetterInterface {
- virtual string CurrentStackTrace(int max_depth, int skip_count) {
+ virtual std::string CurrentStackTrace(int max_depth, int skip_count) {
return (testing::Message() << max_depth << "::" << skip_count << "\n")
.GetString();
}
@@ -447,11 +446,11 @@ TEST(LogTest, NoSkippingStackFrameInOptMode) {
CaptureStdout();
Log(kWarning, "Test log.\n", 100);
- const string log = GetCapturedStdout();
+ const std::string log = GetCapturedStdout();
- string expected_trace =
+ std::string expected_trace =
(testing::Message() << GTEST_FLAG(stack_trace_depth) << "::").GetString();
- string expected_message =
+ std::string expected_message =
"\nGMOCK WARNING:\n"
"Test log.\n"
"Stack trace:\n" +
@@ -547,7 +546,7 @@ TEST(TypeTraitsTest, remove_reference) {
// Verifies that Log() behaves correctly for the given verbosity level
// and log severity.
std::string GrabOutput(void(*logger)(), const char* verbosity) {
- const string saved_flag = GMOCK_FLAG(verbose);
+ const std::string saved_flag = GMOCK_FLAG(verbose);
GMOCK_FLAG(verbose) = verbosity;
CaptureStdout();
logger();
diff --git a/googlemock/test/gmock-matchers_test.cc b/googlemock/test/gmock-matchers_test.cc
index 78c4c901..f5ab7c81 100644
--- a/googlemock/test/gmock-matchers_test.cc
+++ b/googlemock/test/gmock-matchers_test.cc
@@ -189,7 +189,7 @@ Matcher<int> GreaterThan(int n) {
return MakeMatcher(new GreaterThanMatcher(n));
}
-string OfType(const string& type_name) {
+std::string OfType(const std::string& type_name) {
#if GTEST_HAS_RTTI
return " (of type " + type_name + ")";
#else
@@ -199,7 +199,7 @@ string OfType(const string& type_name) {
// Returns the description of the given matcher.
template <typename T>
-string Describe(const Matcher<T>& m) {
+std::string Describe(const Matcher<T>& m) {
stringstream ss;
m.DescribeTo(&ss);
return ss.str();
@@ -207,7 +207,7 @@ string Describe(const Matcher<T>& m) {
// Returns the description of the negation of the given matcher.
template <typename T>
-string DescribeNegation(const Matcher<T>& m) {
+std::string DescribeNegation(const Matcher<T>& m) {
stringstream ss;
m.DescribeNegationTo(&ss);
return ss.str();
@@ -215,7 +215,7 @@ string DescribeNegation(const Matcher<T>& m) {
// Returns the reason why x matches, or doesn't match, m.
template <typename MatcherType, typename Value>
-string Explain(const MatcherType& m, const Value& x) {
+std::string Explain(const MatcherType& m, const Value& x) {
StringMatchResultListener listener;
ExplainMatchResult(m, x, &listener);
return listener.str();
@@ -613,7 +613,7 @@ TEST(MatcherCastTest, FromSameType) {
struct ConvertibleFromAny {
ConvertibleFromAny(int a_value) : value(a_value) {}
template <typename T>
- ConvertibleFromAny(const T& /*a_value*/) : value(-1) {
+ explicit ConvertibleFromAny(const T& /*a_value*/) : value(-1) {
ADD_FAILURE() << "Conversion constructor called";
}
int value;
@@ -867,11 +867,15 @@ class Unprintable {
public:
Unprintable() : c_('a') {}
- bool operator==(const Unprintable& /* rhs */) { return true; }
private:
char c_;
};
+inline bool operator==(const Unprintable& /* lhs */,
+ const Unprintable& /* rhs */) {
+ return true;
+}
+
TEST(EqTest, CanDescribeSelf) {
Matcher<Unprintable> m = Eq(Unprintable());
EXPECT_EQ("is equal to 1-byte object <61>", Describe(m));
@@ -969,7 +973,7 @@ TEST(LeTest, CanDescribeSelf) {
// Tests that Lt(v) matches anything < v.
TEST(LtTest, ImplementsLessThan) {
- Matcher<const string&> m1 = Lt("Hello");
+ Matcher<const std::string&> m1 = Lt("Hello");
EXPECT_TRUE(m1.Matches("Abc"));
EXPECT_FALSE(m1.Matches("Hello"));
EXPECT_FALSE(m1.Matches("Hello, world!"));
@@ -1121,7 +1125,7 @@ TEST(RefTest, CanDescribeSelf) {
Matcher<int&> m = Ref(n);
stringstream ss;
ss << "references the variable @" << &n << " 5";
- EXPECT_EQ(string(ss.str()), Describe(m));
+ EXPECT_EQ(ss.str(), Describe(m));
}
// Test that Ref(non_const_varialbe) can be used as a matcher for a
@@ -1165,27 +1169,27 @@ TEST(RefTest, ExplainsResult) {
// Tests string comparison matchers.
TEST(StrEqTest, MatchesEqualString) {
- Matcher<const char*> m = StrEq(string("Hello"));
+ Matcher<const char*> m = StrEq(std::string("Hello"));
EXPECT_TRUE(m.Matches("Hello"));
EXPECT_FALSE(m.Matches("hello"));
EXPECT_FALSE(m.Matches(NULL));
- Matcher<const string&> m2 = StrEq("Hello");
+ Matcher<const std::string&> m2 = StrEq("Hello");
EXPECT_TRUE(m2.Matches("Hello"));
EXPECT_FALSE(m2.Matches("Hi"));
}
TEST(StrEqTest, CanDescribeSelf) {
- Matcher<string> m = StrEq("Hi-\'\"?\\\a\b\f\n\r\t\v\xD3");
+ Matcher<std::string> m = StrEq("Hi-\'\"?\\\a\b\f\n\r\t\v\xD3");
EXPECT_EQ("is equal to \"Hi-\'\\\"?\\\\\\a\\b\\f\\n\\r\\t\\v\\xD3\"",
Describe(m));
- string str("01204500800");
+ std::string str("01204500800");
str[3] = '\0';
- Matcher<string> m2 = StrEq(str);
+ Matcher<std::string> m2 = StrEq(str);
EXPECT_EQ("is equal to \"012\\04500800\"", Describe(m2));
str[0] = str[6] = str[7] = str[9] = str[10] = '\0';
- Matcher<string> m3 = StrEq(str);
+ Matcher<std::string> m3 = StrEq(str);
EXPECT_EQ("is equal to \"\\012\\045\\0\\08\\0\\0\"", Describe(m3));
}
@@ -1195,7 +1199,7 @@ TEST(StrNeTest, MatchesUnequalString) {
EXPECT_TRUE(m.Matches(NULL));
EXPECT_FALSE(m.Matches("Hello"));
- Matcher<string> m2 = StrNe(string("Hello"));
+ Matcher<std::string> m2 = StrNe(std::string("Hello"));
EXPECT_TRUE(m2.Matches("hello"));
EXPECT_FALSE(m2.Matches("Hello"));
}
@@ -1218,32 +1222,32 @@ TEST(StrCaseEqTest, MatchesEqualStringIgnoringCase) {
}
TEST(StrCaseEqTest, MatchesEqualStringWith0IgnoringCase) {
- string str1("oabocdooeoo");
- string str2("OABOCDOOEOO");
- Matcher<const string&> m0 = StrCaseEq(str1);
- EXPECT_FALSE(m0.Matches(str2 + string(1, '\0')));
+ std::string str1("oabocdooeoo");
+ std::string str2("OABOCDOOEOO");
+ Matcher<const std::string&> m0 = StrCaseEq(str1);
+ EXPECT_FALSE(m0.Matches(str2 + std::string(1, '\0')));
str1[3] = str2[3] = '\0';
- Matcher<const string&> m1 = StrCaseEq(str1);
+ Matcher<const std::string&> m1 = StrCaseEq(str1);
EXPECT_TRUE(m1.Matches(str2));
str1[0] = str1[6] = str1[7] = str1[10] = '\0';
str2[0] = str2[6] = str2[7] = str2[10] = '\0';
- Matcher<const string&> m2 = StrCaseEq(str1);
+ Matcher<const std::string&> m2 = StrCaseEq(str1);
str1[9] = str2[9] = '\0';
EXPECT_FALSE(m2.Matches(str2));
- Matcher<const string&> m3 = StrCaseEq(str1);
+ Matcher<const std::string&> m3 = StrCaseEq(str1);
EXPECT_TRUE(m3.Matches(str2));
EXPECT_FALSE(m3.Matches(str2 + "x"));
str2.append(1, '\0');
EXPECT_FALSE(m3.Matches(str2));
- EXPECT_FALSE(m3.Matches(string(str2, 0, 9)));
+ EXPECT_FALSE(m3.Matches(std::string(str2, 0, 9)));
}
TEST(StrCaseEqTest, CanDescribeSelf) {
- Matcher<string> m = StrCaseEq("Hi");
+ Matcher<std::string> m = StrCaseEq("Hi");
EXPECT_EQ("is equal to (ignoring case) \"Hi\"", Describe(m));
}
@@ -1254,7 +1258,7 @@ TEST(StrCaseNeTest, MatchesUnequalStringIgnoringCase) {
EXPECT_FALSE(m.Matches("Hello"));
EXPECT_FALSE(m.Matches("hello"));
- Matcher<string> m2 = StrCaseNe(string("Hello"));
+ Matcher<std::string> m2 = StrCaseNe(std::string("Hello"));
EXPECT_TRUE(m2.Matches(""));
EXPECT_FALSE(m2.Matches("Hello"));
}
@@ -1266,9 +1270,9 @@ TEST(StrCaseNeTest, CanDescribeSelf) {
// Tests that HasSubstr() works for matching string-typed values.
TEST(HasSubstrTest, WorksForStringClasses) {
- const Matcher<string> m1 = HasSubstr("foo");
- EXPECT_TRUE(m1.Matches(string("I love food.")));
- EXPECT_FALSE(m1.Matches(string("tofo")));
+ const Matcher<std::string> m1 = HasSubstr("foo");
+ EXPECT_TRUE(m1.Matches(std::string("I love food.")));
+ EXPECT_FALSE(m1.Matches(std::string("tofo")));
const Matcher<const std::string&> m2 = HasSubstr("foo");
EXPECT_TRUE(m2.Matches(std::string("I love food.")));
@@ -1290,7 +1294,7 @@ TEST(HasSubstrTest, WorksForCStrings) {
// Tests that HasSubstr(s) describes itself properly.
TEST(HasSubstrTest, CanDescribeSelf) {
- Matcher<string> m = HasSubstr("foo\n\"");
+ Matcher<std::string> m = HasSubstr("foo\n\"");
EXPECT_EQ("has substring \"foo\\n\\\"\"", Describe(m));
}
@@ -1456,12 +1460,12 @@ TEST(PairTest, InsideContainsUsingMap) {
// Tests StartsWith(s).
TEST(StartsWithTest, MatchesStringWithGivenPrefix) {
- const Matcher<const char*> m1 = StartsWith(string(""));
+ const Matcher<const char*> m1 = StartsWith(std::string(""));
EXPECT_TRUE(m1.Matches("Hi"));
EXPECT_TRUE(m1.Matches(""));
EXPECT_FALSE(m1.Matches(NULL));
- const Matcher<const string&> m2 = StartsWith("Hi");
+ const Matcher<const std::string&> m2 = StartsWith("Hi");
EXPECT_TRUE(m2.Matches("Hi"));
EXPECT_TRUE(m2.Matches("Hi Hi!"));
EXPECT_TRUE(m2.Matches("High"));
@@ -1503,14 +1507,14 @@ TEST(MatchesRegexTest, MatchesStringMatchingGivenRegex) {
EXPECT_TRUE(m1.Matches("abcz"));
EXPECT_FALSE(m1.Matches(NULL));
- const Matcher<const string&> m2 = MatchesRegex(new RE("a.*z"));
+ const Matcher<const std::string&> m2 = MatchesRegex(new RE("a.*z"));
EXPECT_TRUE(m2.Matches("azbz"));
EXPECT_FALSE(m2.Matches("az1"));
EXPECT_FALSE(m2.Matches("1az"));
}
TEST(MatchesRegexTest, CanDescribeSelf) {
- Matcher<const std::string> m1 = MatchesRegex(string("Hi.*"));
+ Matcher<const std::string> m1 = MatchesRegex(std::string("Hi.*"));
EXPECT_EQ("matches regular expression \"Hi.*\"", Describe(m1));
Matcher<const char*> m2 = MatchesRegex(new RE("a.*"));
@@ -1520,12 +1524,12 @@ TEST(MatchesRegexTest, CanDescribeSelf) {
// Tests ContainsRegex().
TEST(ContainsRegexTest, MatchesStringContainingGivenRegex) {
- const Matcher<const char*> m1 = ContainsRegex(string("a.*z"));
+ const Matcher<const char*> m1 = ContainsRegex(std::string("a.*z"));
EXPECT_TRUE(m1.Matches("az"));
EXPECT_TRUE(m1.Matches("0abcz1"));
EXPECT_FALSE(m1.Matches(NULL));
- const Matcher<const string&> m2 = ContainsRegex(new RE("a.*z"));
+ const Matcher<const std::string&> m2 = ContainsRegex(new RE("a.*z"));
EXPECT_TRUE(m2.Matches("azbz"));
EXPECT_TRUE(m2.Matches("az1"));
EXPECT_FALSE(m2.Matches("1a"));
@@ -2681,9 +2685,9 @@ TEST(MatcherAssertionTest, WorksForMonomorphicMatcher) {
Matcher<const char*> starts_with_he = StartsWith("he");
ASSERT_THAT("hello", starts_with_he);
- Matcher<const string&> ends_with_ok = EndsWith("ok");
+ Matcher<const std::string&> ends_with_ok = EndsWith("ok");
ASSERT_THAT("book", ends_with_ok);
- const string bad = "bad";
+ const std::string bad = "bad";
EXPECT_NONFATAL_FAILURE(EXPECT_THAT(bad, ends_with_ok),
"Value of: bad\n"
"Expected: ends with \"ok\"\n"
@@ -3095,7 +3099,8 @@ TEST_F(DoubleNearTest, ExplainsResultWhenMatchFails) {
EXPECT_EQ("which is 0.2 from 2", Explain(DoubleNear(2.0, 0.1), 2.2));
EXPECT_EQ("which is -0.3 from 2", Explain(DoubleNear(2.0, 0.1), 1.7));
- const string explanation = Explain(DoubleNear(2.1, 1e-10), 2.1 + 1.2e-10);
+ const std::string explanation =
+ Explain(DoubleNear(2.1, 1e-10), 2.1 + 1.2e-10);
// Different C++ implementations may print floating-point numbers
// slightly differently.
EXPECT_TRUE(explanation == "which is 1.2e-10 from 2.1" || // GCC
@@ -3333,9 +3338,9 @@ TEST(PointeeTest, CanDescribeSelf) {
}
TEST(PointeeTest, CanExplainMatchResult) {
- const Matcher<const string*> m = Pointee(StartsWith("Hi"));
+ const Matcher<const std::string*> m = Pointee(StartsWith("Hi"));
- EXPECT_EQ("", Explain(m, static_cast<const string*>(NULL)));
+ EXPECT_EQ("", Explain(m, static_cast<const std::string*>(NULL)));
const Matcher<long*> m2 = Pointee(GreaterThan(1)); // NOLINT
long n = 3; // NOLINT
@@ -3581,15 +3586,15 @@ class AClass {
void set_n(int new_n) { n_ = new_n; }
// A getter that returns a reference to const.
- const string& s() const { return s_; }
+ const std::string& s() const { return s_; }
- void set_s(const string& new_s) { s_ = new_s; }
+ void set_s(const std::string& new_s) { s_ = new_s; }
// A getter that returns a reference to non-const.
double& x() const { return x_; }
private:
int n_;
- string s_;
+ std::string s_;
static double x_;
};
@@ -3795,10 +3800,12 @@ TEST(PropertyForPointerTest, CanExplainMatchResult) {
// Tests that ResultOf(f, ...) compiles and works as expected when f is a
// function pointer.
-string IntToStringFunction(int input) { return input == 1 ? "foo" : "bar"; }
+std::string IntToStringFunction(int input) {
+ return input == 1 ? "foo" : "bar";
+}
TEST(ResultOfTest, WorksForFunctionPointers) {
- Matcher<int> matcher = ResultOf(&IntToStringFunction, Eq(string("foo")));
+ Matcher<int> matcher = ResultOf(&IntToStringFunction, Eq(std::string("foo")));
EXPECT_TRUE(matcher.Matches(1));
EXPECT_FALSE(matcher.Matches(2));
@@ -3864,12 +3871,12 @@ TEST(ResultOfTest, WorksForReferenceToNonConstResults) {
// Tests that ResultOf(f, ...) compiles and works as expected when f(x)
// returns a reference to const.
-const string& StringFunction(const string& input) { return input; }
+const std::string& StringFunction(const std::string& input) { return input; }
TEST(ResultOfTest, WorksForReferenceToConstResults) {
- string s = "foo";
- string s2 = s;
- Matcher<const string&> matcher = ResultOf(&StringFunction, Ref(s));
+ std::string s = "foo";
+ std::string s2 = s;
+ Matcher<const std::string&> matcher = ResultOf(&StringFunction, Ref(s));
EXPECT_TRUE(matcher.Matches(s));
EXPECT_FALSE(matcher.Matches(s2));
@@ -3889,8 +3896,9 @@ TEST(ResultOfTest, WorksForCompatibleMatcherTypes) {
// a NULL function pointer.
TEST(ResultOfDeathTest, DiesOnNullFunctionPointers) {
EXPECT_DEATH_IF_SUPPORTED(
- ResultOf(static_cast<string(*)(int dummy)>(NULL), Eq(string("foo"))),
- "NULL function pointer is passed into ResultOf\\(\\)\\.");
+ ResultOf(static_cast<std::string (*)(int dummy)>(NULL),
+ Eq(std::string("foo"))),
+ "NULL function pointer is passed into ResultOf\\(\\)\\.");
}
// Tests that ResultOf(f, ...) compiles and works as expected when f is a
@@ -3903,14 +3911,14 @@ TEST(ResultOfTest, WorksForFunctionReferences) {
// Tests that ResultOf(f, ...) compiles and works as expected when f is a
// function object.
-struct Functor : public ::std::unary_function<int, string> {
+struct Functor : public ::std::unary_function<int, std::string> {
result_type operator()(argument_type input) const {
return IntToStringFunction(input);
}
};
TEST(ResultOfTest, WorksForFunctors) {
- Matcher<int> matcher = ResultOf(Functor(), Eq(string("foo")));
+ Matcher<int> matcher = ResultOf(Functor(), Eq(std::string("foo")));
EXPECT_TRUE(matcher.Matches(1));
EXPECT_FALSE(matcher.Matches(2));
@@ -4076,11 +4084,11 @@ TEST(IsEmptyTest, ImplementsIsEmpty) {
}
TEST(IsEmptyTest, WorksWithString) {
- string text;
+ std::string text;
EXPECT_THAT(text, IsEmpty());
text = "foo";
EXPECT_THAT(text, Not(IsEmpty()));
- text = string("\0", 1);
+ text = std::string("\0", 1);
EXPECT_THAT(text, Not(IsEmpty()));
}
@@ -4111,7 +4119,7 @@ TEST(SizeIsTest, ImplementsSizeIs) {
}
TEST(SizeIsTest, WorksWithMap) {
- map<string, int> container;
+ map<std::string, int> container;
EXPECT_THAT(container, SizeIs(0));
EXPECT_THAT(container, Not(SizeIs(1)));
container.insert(make_pair("foo", 1));
@@ -4376,13 +4384,13 @@ TEST(WhenSortedByTest, WorksForNonEmptyContainer) {
}
TEST(WhenSortedByTest, WorksForNonVectorContainer) {
- list<string> words;
+ list<std::string> words;
words.push_back("say");
words.push_back("hello");
words.push_back("world");
- EXPECT_THAT(words, WhenSortedBy(less<string>(),
+ EXPECT_THAT(words, WhenSortedBy(less<std::string>(),
ElementsAre("hello", "say", "world")));
- EXPECT_THAT(words, Not(WhenSortedBy(less<string>(),
+ EXPECT_THAT(words, Not(WhenSortedBy(less<std::string>(),
ElementsAre("say", "hello", "world"))));
}
@@ -4425,7 +4433,7 @@ TEST(WhenSortedTest, WorksForEmptyContainer) {
}
TEST(WhenSortedTest, WorksForNonEmptyContainer) {
- list<string> words;
+ list<std::string> words;
words.push_back("3");
words.push_back("1");
words.push_back("2");
@@ -4435,14 +4443,16 @@ TEST(WhenSortedTest, WorksForNonEmptyContainer) {
}
TEST(WhenSortedTest, WorksForMapTypes) {
- map<string, int> word_counts;
- word_counts["and"] = 1;
- word_counts["the"] = 1;
- word_counts["buffalo"] = 2;
- EXPECT_THAT(word_counts, WhenSorted(ElementsAre(
- Pair("and", 1), Pair("buffalo", 2), Pair("the", 1))));
- EXPECT_THAT(word_counts, Not(WhenSorted(ElementsAre(
- Pair("and", 1), Pair("the", 1), Pair("buffalo", 2)))));
+ map<std::string, int> word_counts;
+ word_counts["and"] = 1;
+ word_counts["the"] = 1;
+ word_counts["buffalo"] = 2;
+ EXPECT_THAT(word_counts,
+ WhenSorted(ElementsAre(Pair("and", 1), Pair("buffalo", 2),
+ Pair("the", 1))));
+ EXPECT_THAT(word_counts,
+ Not(WhenSorted(ElementsAre(Pair("and", 1), Pair("the", 1),
+ Pair("buffalo", 2)))));
}
TEST(WhenSortedTest, WorksForMultiMapTypes) {
@@ -4759,7 +4769,7 @@ TEST(UnorderedElementsAreArrayTest, TakesInitializerList) {
}
TEST(UnorderedElementsAreArrayTest, TakesInitializerListOfCStrings) {
- const string a[5] = {"a", "b", "c", "d", "e"};
+ const std::string a[5] = {"a", "b", "c", "d", "e"};
EXPECT_THAT(a, UnorderedElementsAreArray({"a", "b", "c", "d", "e"}));
EXPECT_THAT(a, Not(UnorderedElementsAreArray({"a", "b", "c", "d", "ef"})));
}
@@ -4933,7 +4943,7 @@ TEST_F(UnorderedElementsAreTest, FailMessageUnmatchedMatcherAndElement) {
}
// Test helper for formatting element, matcher index pairs in expectations.
-static string EMString(int element, int matcher) {
+static std::string EMString(int element, int matcher) {
stringstream ss;
ss << "(element #" << element << ", matcher #" << matcher << ")";
return ss.str();
@@ -4942,7 +4952,7 @@ static string EMString(int element, int matcher) {
TEST_F(UnorderedElementsAreTest, FailMessageImperfectMatchOnly) {
// A situation where all elements and matchers have a match
// associated with them, but the max matching is not perfect.
- std::vector<string> v;
+ std::vector<std::string> v;
v.push_back("a");
v.push_back("b");
v.push_back("c");
@@ -4951,7 +4961,7 @@ TEST_F(UnorderedElementsAreTest, FailMessageImperfectMatchOnly) {
UnorderedElementsAre("a", "a", AnyOf("b", "c")), v, &listener))
<< listener.str();
- string prefix =
+ std::string prefix =
"where no permutation of the elements can satisfy all matchers, "
"and the closest match is 2 of 3 matchers with the "
"pairings:\n";
@@ -5362,13 +5372,13 @@ TEST(EachTest, MatchesVectorWhenAllElementsMatch) {
EXPECT_THAT(some_vector, Not(Each(3)));
EXPECT_THAT(some_vector, Each(Lt(3.5)));
- vector<string> another_vector;
+ vector<std::string> another_vector;
another_vector.push_back("fee");
- EXPECT_THAT(another_vector, Each(string("fee")));
+ EXPECT_THAT(another_vector, Each(std::string("fee")));
another_vector.push_back("fie");
another_vector.push_back("foe");
another_vector.push_back("fum");
- EXPECT_THAT(another_vector, Not(Each(string("fee"))));
+ EXPECT_THAT(another_vector, Not(Each(std::string("fee"))));
}
TEST(EachTest, MatchesMapWhenAllElementsMatch) {
@@ -5377,15 +5387,15 @@ TEST(EachTest, MatchesMapWhenAllElementsMatch) {
my_map[bar] = 2;
EXPECT_THAT(my_map, Each(make_pair(bar, 2)));
- map<string, int> another_map;
- EXPECT_THAT(another_map, Each(make_pair(string("fee"), 1)));
+ map<std::string, int> another_map;
+ EXPECT_THAT(another_map, Each(make_pair(std::string("fee"), 1)));
another_map["fee"] = 1;
- EXPECT_THAT(another_map, Each(make_pair(string("fee"), 1)));
+ EXPECT_THAT(another_map, Each(make_pair(std::string("fee"), 1)));
another_map["fie"] = 2;
another_map["foe"] = 3;
another_map["fum"] = 4;
- EXPECT_THAT(another_map, Not(Each(make_pair(string("fee"), 1))));
- EXPECT_THAT(another_map, Not(Each(make_pair(string("fum"), 1))));
+ EXPECT_THAT(another_map, Not(Each(make_pair(std::string("fee"), 1))));
+ EXPECT_THAT(another_map, Not(Each(make_pair(std::string("fum"), 1))));
EXPECT_THAT(another_map, Each(Pair(_, Gt(0))));
}
diff --git a/googlemock/test/gmock-more-actions_test.cc b/googlemock/test/gmock-more-actions_test.cc
index 77e15bd5..f5e28eae 100644
--- a/googlemock/test/gmock-more-actions_test.cc
+++ b/googlemock/test/gmock-more-actions_test.cc
@@ -94,12 +94,12 @@ const char* Plus1(const char* s) { return s + 1; }
void VoidUnary(int /* n */) { g_done = true; }
-bool ByConstRef(const string& s) { return s == "Hi"; }
+bool ByConstRef(const std::string& s) { return s == "Hi"; }
const double g_double = 0;
bool ReferencesGlobalDouble(const double& x) { return &x == &g_double; }
-string ByNonConstRef(string& s) { return s += "+"; } // NOLINT
+std::string ByNonConstRef(std::string& s) { return s += "+"; } // NOLINT
struct UnaryFunctor {
int operator()(bool x) { return x ? 1 : -1; }
@@ -119,9 +119,9 @@ int SumOfFirst2(int a, int b, Unused, Unused) { return a + b; }
void VoidFunctionWithFourArguments(char, int, float, double) { g_done = true; }
-string Concat4(const char* s1, const char* s2, const char* s3,
- const char* s4) {
- return string(s1) + s2 + s3 + s4;
+std::string Concat4(const char* s1, const char* s2, const char* s3,
+ const char* s4) {
+ return std::string(s1) + s2 + s3 + s4;
}
int SumOf5(int a, int b, int c, int d, int e) { return a + b + c + d + e; }
@@ -132,9 +132,9 @@ struct SumOf5Functor {
}
};
-string Concat5(const char* s1, const char* s2, const char* s3,
- const char* s4, const char* s5) {
- return string(s1) + s2 + s3 + s4 + s5;
+std::string Concat5(const char* s1, const char* s2, const char* s3,
+ const char* s4, const char* s5) {
+ return std::string(s1) + s2 + s3 + s4 + s5;
}
int SumOf6(int a, int b, int c, int d, int e, int f) {
@@ -147,34 +147,34 @@ struct SumOf6Functor {
}
};
-string Concat6(const char* s1, const char* s2, const char* s3,
- const char* s4, const char* s5, const char* s6) {
- return string(s1) + s2 + s3 + s4 + s5 + s6;
+std::string Concat6(const char* s1, const char* s2, const char* s3,
+ const char* s4, const char* s5, const char* s6) {
+ return std::string(s1) + s2 + s3 + s4 + s5 + s6;
}
-string Concat7(const char* s1, const char* s2, const char* s3,
- const char* s4, const char* s5, const char* s6,
- const char* s7) {
- return string(s1) + s2 + s3 + s4 + s5 + s6 + s7;
+std::string Concat7(const char* s1, const char* s2, const char* s3,
+ const char* s4, const char* s5, const char* s6,
+ const char* s7) {
+ return std::string(s1) + s2 + s3 + s4 + s5 + s6 + s7;
}
-string Concat8(const char* s1, const char* s2, const char* s3,
- const char* s4, const char* s5, const char* s6,
- const char* s7, const char* s8) {
- return string(s1) + s2 + s3 + s4 + s5 + s6 + s7 + s8;
+std::string Concat8(const char* s1, const char* s2, const char* s3,
+ const char* s4, const char* s5, const char* s6,
+ const char* s7, const char* s8) {
+ return std::string(s1) + s2 + s3 + s4 + s5 + s6 + s7 + s8;
}
-string Concat9(const char* s1, const char* s2, const char* s3,
- const char* s4, const char* s5, const char* s6,
- const char* s7, const char* s8, const char* s9) {
- return string(s1) + s2 + s3 + s4 + s5 + s6 + s7 + s8 + s9;
+std::string Concat9(const char* s1, const char* s2, const char* s3,
+ const char* s4, const char* s5, const char* s6,
+ const char* s7, const char* s8, const char* s9) {
+ return std::string(s1) + s2 + s3 + s4 + s5 + s6 + s7 + s8 + s9;
}
-string Concat10(const char* s1, const char* s2, const char* s3,
- const char* s4, const char* s5, const char* s6,
- const char* s7, const char* s8, const char* s9,
- const char* s10) {
- return string(s1) + s2 + s3 + s4 + s5 + s6 + s7 + s8 + s9 + s10;
+std::string Concat10(const char* s1, const char* s2, const char* s3,
+ const char* s4, const char* s5, const char* s6,
+ const char* s7, const char* s8, const char* s9,
+ const char* s10) {
+ return std::string(s1) + s2 + s3 + s4 + s5 + s6 + s7 + s8 + s9 + s10;
}
class Foo {
@@ -185,7 +185,7 @@ class Foo {
short Unary(long x) { return static_cast<short>(value_ + x); } // NOLINT
- string Binary(const string& str, char c) const { return str + c; }
+ std::string Binary(const std::string& str, char c) const { return str + c; }
int Ternary(int x, bool y, char z) { return value_ + x + y*z; }
@@ -201,29 +201,29 @@ class Foo {
return a + b + c + d + e + f;
}
- string Concat7(const char* s1, const char* s2, const char* s3,
- const char* s4, const char* s5, const char* s6,
- const char* s7) {
- return string(s1) + s2 + s3 + s4 + s5 + s6 + s7;
+ std::string Concat7(const char* s1, const char* s2, const char* s3,
+ const char* s4, const char* s5, const char* s6,
+ const char* s7) {
+ return std::string(s1) + s2 + s3 + s4 + s5 + s6 + s7;
}
- string Concat8(const char* s1, const char* s2, const char* s3,
- const char* s4, const char* s5, const char* s6,
- const char* s7, const char* s8) {
- return string(s1) + s2 + s3 + s4 + s5 + s6 + s7 + s8;
+ std::string Concat8(const char* s1, const char* s2, const char* s3,
+ const char* s4, const char* s5, const char* s6,
+ const char* s7, const char* s8) {
+ return std::string(s1) + s2 + s3 + s4 + s5 + s6 + s7 + s8;
}
- string Concat9(const char* s1, const char* s2, const char* s3,
- const char* s4, const char* s5, const char* s6,
- const char* s7, const char* s8, const char* s9) {
- return string(s1) + s2 + s3 + s4 + s5 + s6 + s7 + s8 + s9;
+ std::string Concat9(const char* s1, const char* s2, const char* s3,
+ const char* s4, const char* s5, const char* s6,
+ const char* s7, const char* s8, const char* s9) {
+ return std::string(s1) + s2 + s3 + s4 + s5 + s6 + s7 + s8 + s9;
}
- string Concat10(const char* s1, const char* s2, const char* s3,
- const char* s4, const char* s5, const char* s6,
- const char* s7, const char* s8, const char* s9,
- const char* s10) {
- return string(s1) + s2 + s3 + s4 + s5 + s6 + s7 + s8 + s9 + s10;
+ std::string Concat10(const char* s1, const char* s2, const char* s3,
+ const char* s4, const char* s5, const char* s6,
+ const char* s7, const char* s8, const char* s9,
+ const char* s10) {
+ return std::string(s1) + s2 + s3 + s4 + s5 + s6 + s7 + s8 + s9 + s10;
}
private:
@@ -280,9 +280,9 @@ inline const char* CharPtr(const char* s) { return s; }
// Tests using Invoke() with a 7-argument function.
TEST(InvokeTest, FunctionThatTakes7Arguments) {
- Action<string(const char*, const char*, const char*, const char*,
- const char*, const char*, const char*)> a =
- Invoke(Concat7);
+ Action<std::string(const char*, const char*, const char*, const char*,
+ const char*, const char*, const char*)>
+ a = Invoke(Concat7);
EXPECT_EQ("1234567",
a.Perform(make_tuple(CharPtr("1"), CharPtr("2"), CharPtr("3"),
CharPtr("4"), CharPtr("5"), CharPtr("6"),
@@ -291,9 +291,9 @@ TEST(InvokeTest, FunctionThatTakes7Arguments) {
// Tests using Invoke() with a 8-argument function.
TEST(InvokeTest, FunctionThatTakes8Arguments) {
- Action<string(const char*, const char*, const char*, const char*,
- const char*, const char*, const char*, const char*)> a =
- Invoke(Concat8);
+ Action<std::string(const char*, const char*, const char*, const char*,
+ const char*, const char*, const char*, const char*)>
+ a = Invoke(Concat8);
EXPECT_EQ("12345678",
a.Perform(make_tuple(CharPtr("1"), CharPtr("2"), CharPtr("3"),
CharPtr("4"), CharPtr("5"), CharPtr("6"),
@@ -302,9 +302,10 @@ TEST(InvokeTest, FunctionThatTakes8Arguments) {
// Tests using Invoke() with a 9-argument function.
TEST(InvokeTest, FunctionThatTakes9Arguments) {
- Action<string(const char*, const char*, const char*, const char*,
- const char*, const char*, const char*, const char*,
- const char*)> a = Invoke(Concat9);
+ Action<std::string(const char*, const char*, const char*, const char*,
+ const char*, const char*, const char*, const char*,
+ const char*)>
+ a = Invoke(Concat9);
EXPECT_EQ("123456789",
a.Perform(make_tuple(CharPtr("1"), CharPtr("2"), CharPtr("3"),
CharPtr("4"), CharPtr("5"), CharPtr("6"),
@@ -313,9 +314,10 @@ TEST(InvokeTest, FunctionThatTakes9Arguments) {
// Tests using Invoke() with a 10-argument function.
TEST(InvokeTest, FunctionThatTakes10Arguments) {
- Action<string(const char*, const char*, const char*, const char*,
- const char*, const char*, const char*, const char*,
- const char*, const char*)> a = Invoke(Concat10);
+ Action<std::string(const char*, const char*, const char*, const char*,
+ const char*, const char*, const char*, const char*,
+ const char*, const char*)>
+ a = Invoke(Concat10);
EXPECT_EQ("1234567890",
a.Perform(make_tuple(CharPtr("1"), CharPtr("2"), CharPtr("3"),
CharPtr("4"), CharPtr("5"), CharPtr("6"),
@@ -339,8 +341,7 @@ TEST(InvokeTest, FunctionWithUnusedParameters) {
// Tests using Invoke() with methods with parameters declared as Unused.
TEST(InvokeTest, MethodWithUnusedParameters) {
Foo foo;
- Action<int(string, bool, int, int)> a1 =
- Invoke(&foo, &Foo::SumOfLast2);
+ Action<int(std::string, bool, int, int)> a1 = Invoke(&foo, &Foo::SumOfLast2);
EXPECT_EQ(12, a1.Perform(make_tuple(CharPtr("hi"), true, 10, 2)));
Action<int(char, double, int, int)> a2 =
@@ -417,9 +418,9 @@ TEST(InvokeMethodTest, MethodThatTakes6Arguments) {
// Tests using Invoke() with a 7-argument method.
TEST(InvokeMethodTest, MethodThatTakes7Arguments) {
Foo foo;
- Action<string(const char*, const char*, const char*, const char*,
- const char*, const char*, const char*)> a =
- Invoke(&foo, &Foo::Concat7);
+ Action<std::string(const char*, const char*, const char*, const char*,
+ const char*, const char*, const char*)>
+ a = Invoke(&foo, &Foo::Concat7);
EXPECT_EQ("1234567",
a.Perform(make_tuple(CharPtr("1"), CharPtr("2"), CharPtr("3"),
CharPtr("4"), CharPtr("5"), CharPtr("6"),
@@ -429,9 +430,9 @@ TEST(InvokeMethodTest, MethodThatTakes7Arguments) {
// Tests using Invoke() with a 8-argument method.
TEST(InvokeMethodTest, MethodThatTakes8Arguments) {
Foo foo;
- Action<string(const char*, const char*, const char*, const char*,
- const char*, const char*, const char*, const char*)> a =
- Invoke(&foo, &Foo::Concat8);
+ Action<std::string(const char*, const char*, const char*, const char*,
+ const char*, const char*, const char*, const char*)>
+ a = Invoke(&foo, &Foo::Concat8);
EXPECT_EQ("12345678",
a.Perform(make_tuple(CharPtr("1"), CharPtr("2"), CharPtr("3"),
CharPtr("4"), CharPtr("5"), CharPtr("6"),
@@ -441,9 +442,10 @@ TEST(InvokeMethodTest, MethodThatTakes8Arguments) {
// Tests using Invoke() with a 9-argument method.
TEST(InvokeMethodTest, MethodThatTakes9Arguments) {
Foo foo;
- Action<string(const char*, const char*, const char*, const char*,
- const char*, const char*, const char*, const char*,
- const char*)> a = Invoke(&foo, &Foo::Concat9);
+ Action<std::string(const char*, const char*, const char*, const char*,
+ const char*, const char*, const char*, const char*,
+ const char*)>
+ a = Invoke(&foo, &Foo::Concat9);
EXPECT_EQ("123456789",
a.Perform(make_tuple(CharPtr("1"), CharPtr("2"), CharPtr("3"),
CharPtr("4"), CharPtr("5"), CharPtr("6"),
@@ -453,9 +455,10 @@ TEST(InvokeMethodTest, MethodThatTakes9Arguments) {
// Tests using Invoke() with a 10-argument method.
TEST(InvokeMethodTest, MethodThatTakes10Arguments) {
Foo foo;
- Action<string(const char*, const char*, const char*, const char*,
- const char*, const char*, const char*, const char*,
- const char*, const char*)> a = Invoke(&foo, &Foo::Concat10);
+ Action<std::string(const char*, const char*, const char*, const char*,
+ const char*, const char*, const char*, const char*,
+ const char*, const char*)>
+ a = Invoke(&foo, &Foo::Concat10);
EXPECT_EQ("1234567890",
a.Perform(make_tuple(CharPtr("1"), CharPtr("2"), CharPtr("3"),
CharPtr("4"), CharPtr("5"), CharPtr("6"),
@@ -495,8 +498,8 @@ TEST(ReturnArgActionTest, WorksForMultiArgBoolArg0) {
}
TEST(ReturnArgActionTest, WorksForMultiArgStringArg2) {
- const Action<string(int, int, string, int)> a = ReturnArg<2>();
- EXPECT_EQ("seven", a.Perform(make_tuple(5, 6, string("seven"), 8)));
+ const Action<std::string(int, int, std::string, int)> a = ReturnArg<2>();
+ EXPECT_EQ("seven", a.Perform(make_tuple(5, 6, std::string("seven"), 8)));
}
TEST(SaveArgActionTest, WorksForSameType) {
diff --git a/googlemock/test/gmock-nice-strict_test.cc b/googlemock/test/gmock-nice-strict_test.cc
index d0adcbbe..5d6ccc4f 100644
--- a/googlemock/test/gmock-nice-strict_test.cc
+++ b/googlemock/test/gmock-nice-strict_test.cc
@@ -51,7 +51,6 @@ class Mock {
namespace testing {
namespace gmock_nice_strict_test {
-using testing::internal::string;
using testing::GMOCK_FLAG(verbose);
using testing::HasSubstr;
using testing::NaggyMock;
@@ -87,23 +86,23 @@ class MockFoo : public Foo {
class MockBar {
public:
- explicit MockBar(const string& s) : str_(s) {}
+ explicit MockBar(const std::string& s) : str_(s) {}
- MockBar(char a1, char a2, string a3, string a4, int a5, int a6,
- const string& a7, const string& a8, bool a9, bool a10) {
- str_ = string() + a1 + a2 + a3 + a4 + static_cast<char>(a5) +
+ MockBar(char a1, char a2, std::string a3, std::string a4, int a5, int a6,
+ const std::string& a7, const std::string& a8, bool a9, bool a10) {
+ str_ = std::string() + a1 + a2 + a3 + a4 + static_cast<char>(a5) +
static_cast<char>(a6) + a7 + a8 + (a9 ? 'T' : 'F') + (a10 ? 'T' : 'F');
}
virtual ~MockBar() {}
- const string& str() const { return str_; }
+ const std::string& str() const { return str_; }
MOCK_METHOD0(This, int());
- MOCK_METHOD2(That, string(int, bool));
+ MOCK_METHOD2(That, std::string(int, bool));
private:
- string str_;
+ std::string str_;
GTEST_DISALLOW_COPY_AND_ASSIGN_(MockBar);
};
@@ -112,7 +111,7 @@ class MockBar {
// Tests that a raw mock generates warnings for uninteresting calls.
TEST(RawMockTest, WarningForUninterestingCall) {
- const string saved_flag = GMOCK_FLAG(verbose);
+ const std::string saved_flag = GMOCK_FLAG(verbose);
GMOCK_FLAG(verbose) = "warning";
MockFoo raw_foo;
@@ -129,7 +128,7 @@ TEST(RawMockTest, WarningForUninterestingCall) {
// Tests that a raw mock generates warnings for uninteresting calls
// that delete the mock object.
TEST(RawMockTest, WarningForUninterestingCallAfterDeath) {
- const string saved_flag = GMOCK_FLAG(verbose);
+ const std::string saved_flag = GMOCK_FLAG(verbose);
GMOCK_FLAG(verbose) = "warning";
MockFoo* const raw_foo = new MockFoo;
@@ -150,7 +149,7 @@ TEST(RawMockTest, WarningForUninterestingCallAfterDeath) {
TEST(RawMockTest, InfoForUninterestingCall) {
MockFoo raw_foo;
- const string saved_flag = GMOCK_FLAG(verbose);
+ const std::string saved_flag = GMOCK_FLAG(verbose);
GMOCK_FLAG(verbose) = "info";
CaptureStdout();
raw_foo.DoThis();
@@ -188,7 +187,7 @@ TEST(NiceMockTest, NoWarningForUninterestingCallAfterDeath) {
TEST(NiceMockTest, InfoForUninterestingCall) {
NiceMock<MockFoo> nice_foo;
- const string saved_flag = GMOCK_FLAG(verbose);
+ const std::string saved_flag = GMOCK_FLAG(verbose);
GMOCK_FLAG(verbose) = "info";
CaptureStdout();
nice_foo.DoThis();
@@ -257,7 +256,7 @@ TEST(NiceMockTest, AcceptsClassNamedMock) {
// Tests that a naggy mock generates warnings for uninteresting calls.
TEST(NaggyMockTest, WarningForUninterestingCall) {
- const string saved_flag = GMOCK_FLAG(verbose);
+ const std::string saved_flag = GMOCK_FLAG(verbose);
GMOCK_FLAG(verbose) = "warning";
NaggyMock<MockFoo> naggy_foo;
@@ -274,7 +273,7 @@ TEST(NaggyMockTest, WarningForUninterestingCall) {
// Tests that a naggy mock generates a warning for an uninteresting call
// that deletes the mock object.
TEST(NaggyMockTest, WarningForUninterestingCallAfterDeath) {
- const string saved_flag = GMOCK_FLAG(verbose);
+ const std::string saved_flag = GMOCK_FLAG(verbose);
GMOCK_FLAG(verbose) = "warning";
NaggyMock<MockFoo>* const naggy_foo = new NaggyMock<MockFoo>;
diff --git a/googlemock/test/gmock-spec-builders_test.cc b/googlemock/test/gmock-spec-builders_test.cc
index 342c22f5..389e0709 100644
--- a/googlemock/test/gmock-spec-builders_test.cc
+++ b/googlemock/test/gmock-spec-builders_test.cc
@@ -97,7 +97,6 @@ using testing::internal::kErrorVerbosity;
using testing::internal::kInfoVerbosity;
using testing::internal::kWarningVerbosity;
using testing::internal::linked_ptr;
-using testing::internal::string;
#if GTEST_HAS_STREAM_REDIRECTION
using testing::HasSubstr;
@@ -1954,7 +1953,7 @@ class MockC {
public:
MockC() {}
- MOCK_METHOD6(VoidMethod, void(bool cond, int n, string s, void* p,
+ MOCK_METHOD6(VoidMethod, void(bool cond, int n, std::string s, void* p,
const Printable& x, Unprintable y));
MOCK_METHOD0(NonVoidMethod, int()); // NOLINT
@@ -1970,7 +1969,7 @@ class VerboseFlagPreservingFixture : public testing::Test {
~VerboseFlagPreservingFixture() { GMOCK_FLAG(verbose) = saved_verbose_flag_; }
private:
- const string saved_verbose_flag_;
+ const std::string saved_verbose_flag_;
GTEST_DISALLOW_COPY_AND_ASSIGN_(VerboseFlagPreservingFixture);
};
@@ -2062,8 +2061,8 @@ class GMockVerboseFlagTest : public VerboseFlagPreservingFixture {
// contain the given function name in the stack trace. When it's
// false, the output should be empty.)
void VerifyOutput(const std::string& output, bool should_print,
- const string& expected_substring,
- const string& function_name) {
+ const std::string& expected_substring,
+ const std::string& function_name) {
if (should_print) {
EXPECT_THAT(output.c_str(), HasSubstr(expected_substring));
# ifndef NDEBUG
@@ -2113,12 +2112,12 @@ class GMockVerboseFlagTest : public VerboseFlagPreservingFixture {
// Tests how the flag affects uninteresting calls on a naggy mock.
void TestUninterestingCallOnNaggyMock(bool should_print) {
NaggyMock<MockA> a;
- const string note =
+ const std::string note =
"NOTE: You can safely ignore the above warning unless this "
"call should not happen. Do not suppress it by blindly adding "
"an EXPECT_CALL() if you don't mean to enforce the call. "
- "See http://code.google.com/p/googlemock/wiki/CookBook#"
- "Knowing_When_to_Expect for details.";
+ "See https://github.com/google/googletest/blob/master/googlemock/docs/CookBook.md#"
+ "knowing-when-to-expect for details.";
// A void-returning function.
CaptureStdout();
diff --git a/googlemock/test/gmock_output_test_golden.txt b/googlemock/test/gmock_output_test_golden.txt
index 650a8f07..689d5eeb 100644
--- a/googlemock/test/gmock_output_test_golden.txt
+++ b/googlemock/test/gmock_output_test_golden.txt
@@ -75,14 +75,14 @@ GMOCK WARNING:
Uninteresting mock function call - returning default value.
Function call: Bar2(0, 1)
Returns: false
-NOTE: You can safely ignore the above warning unless this call should not happen. Do not suppress it by blindly adding an EXPECT_CALL() if you don't mean to enforce the call. See http://code.google.com/p/googlemock/wiki/CookBook#Knowing_When_to_Expect for details.
+NOTE: You can safely ignore the above warning unless this call should not happen. Do not suppress it by blindly adding an EXPECT_CALL() if you don't mean to enforce the call. See https://github.com/google/googletest/blob/master/googlemock/docs/CookBook.md#knowing-when-to-expect for details.
[ OK ] GMockOutputTest.UninterestingCall
[ RUN ] GMockOutputTest.UninterestingCallToVoidFunction
GMOCK WARNING:
Uninteresting mock function call - returning directly.
Function call: Bar3(0, 1)
-NOTE: You can safely ignore the above warning unless this call should not happen. Do not suppress it by blindly adding an EXPECT_CALL() if you don't mean to enforce the call. See http://code.google.com/p/googlemock/wiki/CookBook#Knowing_When_to_Expect for details.
+NOTE: You can safely ignore the above warning unless this call should not happen. Do not suppress it by blindly adding an EXPECT_CALL() if you don't mean to enforce the call. See https://github.com/google/googletest/blob/master/googlemock/docs/CookBook.md#knowing-when-to-expect for details.
[ OK ] GMockOutputTest.UninterestingCallToVoidFunction
[ RUN ] GMockOutputTest.RetiredExpectation
unknown file: Failure
@@ -266,14 +266,14 @@ Uninteresting mock function call - taking default action specified at:
FILE:#:
Function call: Bar2(2, 2)
Returns: true
-NOTE: You can safely ignore the above warning unless this call should not happen. Do not suppress it by blindly adding an EXPECT_CALL() if you don't mean to enforce the call. See http://code.google.com/p/googlemock/wiki/CookBook#Knowing_When_to_Expect for details.
+NOTE: You can safely ignore the above warning unless this call should not happen. Do not suppress it by blindly adding an EXPECT_CALL() if you don't mean to enforce the call. See https://github.com/google/googletest/blob/master/googlemock/docs/CookBook.md#knowing-when-to-expect for details.
GMOCK WARNING:
Uninteresting mock function call - taking default action specified at:
FILE:#:
Function call: Bar2(1, 1)
Returns: false
-NOTE: You can safely ignore the above warning unless this call should not happen. Do not suppress it by blindly adding an EXPECT_CALL() if you don't mean to enforce the call. See http://code.google.com/p/googlemock/wiki/CookBook#Knowing_When_to_Expect for details.
+NOTE: You can safely ignore the above warning unless this call should not happen. Do not suppress it by blindly adding an EXPECT_CALL() if you don't mean to enforce the call. See https://github.com/google/googletest/blob/master/googlemock/docs/CookBook.md#knowing-when-to-expect for details.
[ OK ] GMockOutputTest.UninterestingCallWithDefaultAction
[ RUN ] GMockOutputTest.ExplicitActionsRunOutWithDefaultAction
diff --git a/googlemock/test/gmock_stress_test.cc b/googlemock/test/gmock_stress_test.cc
index 0e97aeed..c16badda 100644
--- a/googlemock/test/gmock_stress_test.cc
+++ b/googlemock/test/gmock_stress_test.cc
@@ -51,7 +51,7 @@ const int kRepeat = 50;
class MockFoo {
public:
MOCK_METHOD1(Bar, int(int n)); // NOLINT
- MOCK_METHOD2(Baz, char(const char* s1, const internal::string& s2)); // NOLINT
+ MOCK_METHOD2(Baz, char(const char* s1, const std::string& s2)); // NOLINT
};
// Helper for waiting for the given thread to finish and then deleting it.
diff --git a/googletest/.gitignore b/googletest/.gitignore
new file mode 100644
index 00000000..4b7be4b9
--- /dev/null
+++ b/googletest/.gitignore
@@ -0,0 +1,2 @@
+# python
+*.pyc
diff --git a/googletest/CMakeLists.txt b/googletest/CMakeLists.txt
index 621d0f04..36d0a9ec 100644
--- a/googletest/CMakeLists.txt
+++ b/googletest/CMakeLists.txt
@@ -45,7 +45,7 @@ endif()
# ${gtest_BINARY_DIR}.
# Language "C" is required for find_package(Threads).
project(gtest CXX C)
-cmake_minimum_required(VERSION 2.6.2)
+cmake_minimum_required(VERSION 2.6.4)
if (COMMAND set_up_hermetic_build)
set_up_hermetic_build()
diff --git a/googletest/README.md b/googletest/README.md
index e0ea1b0f..0a3474c0 100644
--- a/googletest/README.md
+++ b/googletest/README.md
@@ -59,7 +59,13 @@ cross-platform.). If you don't have CMake installed already, you can
download it for free from <http://www.cmake.org/>.
CMake works by generating native makefiles or build projects that can
-be used in the compiler environment of your choice. The typical
+be used in the compiler environment of your choice. You can either
+build Google Test as a standalone project or it can be incorporated
+into an existing CMake build for another project.
+
+#### Standalone CMake Project ####
+
+When building Google Test as a standalone project, the typical
workflow starts with:
mkdir mybuild # Create a directory to hold the build output.
@@ -80,13 +86,110 @@ using Visual Studio.
On Mac OS X with Xcode installed, a `.xcodeproj` file will be generated.
+#### Incorporating Into An Existing CMake Project ####
+
+If you want to use gtest in a project which already uses CMake, then a
+more robust and flexible approach is to build gtest as part of that
+project directly. This is done by making the GoogleTest source code
+available to the main build and adding it using CMake's
+`add_subdirectory()` command. This has the significant advantage that
+the same compiler and linker settings are used between gtest and the
+rest of your project, so issues associated with using incompatible
+libraries (eg debug/release), etc. are avoided. This is particularly
+useful on Windows. Making GoogleTest's source code available to the
+main build can be done a few different ways:
+
+* Download the GoogleTest source code manually and place it at a
+ known location. This is the least flexible approach and can make
+ it more difficult to use with continuous integration systems, etc.
+* Embed the GoogleTest source code as a direct copy in the main
+ project's source tree. This is often the simplest approach, but is
+ also the hardest to keep up to date. Some organizations may not
+ permit this method.
+* Add GoogleTest as a git submodule or equivalent. This may not
+ always be possible or appropriate. Git submodules, for example,
+ have their own set of advantages and drawbacks.
+* Use CMake to download GoogleTest as part of the build's configure
+ step. This is just a little more complex, but doesn't have the
+ limitations of the other methods.
+
+The last of the above methods is implemented with a small piece
+of CMake code in a separate file (e.g. `CMakeLists.txt.in`) which
+is copied to the build area and then invoked as a sub-build
+_during the CMake stage_. That directory is then pulled into the
+main build with `add_subdirectory()`. For example:
+
+New file `CMakeLists.txt.in`:
+
+ cmake_minimum_required(VERSION 2.8.2)
+
+ project(googletest-download NONE)
+
+ include(ExternalProject)
+ ExternalProject_Add(googletest
+ GIT_REPOSITORY https://github.com/google/googletest.git
+ GIT_TAG master
+ SOURCE_DIR "${CMAKE_BINARY_DIR}/googletest-src"
+ BINARY_DIR "${CMAKE_BINARY_DIR}/googletest-build"
+ CONFIGURE_COMMAND ""
+ BUILD_COMMAND ""
+ INSTALL_COMMAND ""
+ TEST_COMMAND ""
+ )
+
+Existing build's `CMakeLists.txt`:
+
+ # Download and unpack googletest at configure time
+ configure_file(CMakeLists.txt.in googletest-download/CMakeLists.txt)
+ execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" .
+ RESULT_VARIABLE result
+ WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/googletest-download )
+ if(result)
+ message(FATAL_ERROR "CMake step for googletest failed: ${result}")
+ endif()
+ execute_process(COMMAND ${CMAKE_COMMAND} --build .
+ RESULT_VARIABLE result
+ WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/googletest-download )
+ if(result)
+ message(FATAL_ERROR "Build step for googletest failed: ${result}")
+ endif()
+
+ # Prevent overriding the parent project's compiler/linker
+ # settings on Windows
+ set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
+
+ # 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)
+
+ # The gtest/gtest_main targets carry header search path
+ # dependencies automatically when using CMake 2.8.11 or
+ # later. Otherwise we have to add them here ourselves.
+ if (CMAKE_VERSION VERSION_LESS 2.8.11)
+ include_directories("${gtest_SOURCE_DIR}/include")
+ endif()
+
+ # Now simply link against gtest or gtest_main as needed. Eg
+ add_executable(example example.cpp)
+ target_link_libraries(example gtest_main)
+ add_test(NAME example_test COMMAND example)
+
+Note that this approach requires CMake 2.8.2 or later due to
+its use of the `ExternalProject_Add()` command. The above
+technique is discussed in more detail in
+[this separate article](http://crascit.com/2015/07/25/cmake-gtest/)
+which also contains a link to a fully generalized implementation
+of the technique.
+
+
### Legacy Build Scripts ###
Before settling on CMake, we have been providing hand-maintained build
projects/scripts for Visual Studio, Xcode, and Autotools. While we
continue to provide them for convenience, they are not actively
maintained any more. We highly recommend that you follow the
-instructions in the previous two sections to integrate Google Test
+instructions in the above sections to integrate Google Test
with your existing build system.
If you still need to use the legacy build scripts, here's how:
@@ -221,7 +324,7 @@ your build script.
### Avoiding Macro Name Clashes ###
In C++, macros don't obey namespaces. Therefore two libraries that
-both define a macro of the same name will clash if you #include both
+both define a macro of the same name will clash if you `#include` both
definitions. In case a Google Test macro clashes with another
library, you can force Google Test to rename its macro to avoid the
conflict.
diff --git a/googletest/cmake/internal_utils.cmake b/googletest/cmake/internal_utils.cmake
index 93e6dbb7..8878dc1a 100644
--- a/googletest/cmake/internal_utils.cmake
+++ b/googletest/cmake/internal_utils.cmake
@@ -46,7 +46,9 @@ endmacro()
# Google Mock. You can tweak these definitions to suit your need. A
# variable's value is empty before it's explicitly assigned to.
macro(config_compiler_and_linker)
- if (NOT gtest_disable_pthreads)
+ # Note: pthreads on MinGW is not supported, even if available
+ # instead, we use windows threading primitives
+ if (NOT gtest_disable_pthreads AND NOT MINGW)
# Defines CMAKE_USE_PTHREADS_INIT and CMAKE_THREAD_LIBS_INIT.
find_package(Threads)
endif()
@@ -80,6 +82,10 @@ 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")
@@ -235,8 +241,16 @@ function(py_test name)
# 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
+ 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>)
+ else (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 3.1)
+ 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()
endfunction()
diff --git a/googletest/docs/AdvancedGuide.md b/googletest/docs/AdvancedGuide.md
index 5ad10e10..6c25db86 100644
--- a/googletest/docs/AdvancedGuide.md
+++ b/googletest/docs/AdvancedGuide.md
@@ -306,14 +306,14 @@ carefully choose the error bound. If they don't want or care to, comparing in
terms of Units in the Last Place (ULPs) is a good default, and Google Test
provides assertions to do this. Full details about ULPs are quite long; if you
want to learn more, see
-[this article on float comparison](http://www.cygnus-software.com/papers/comparingfloats/comparingfloats.htm).
+[this article on float comparison](https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/).
### Floating-Point Macros ###
| **Fatal assertion** | **Nonfatal assertion** | **Verifies** |
|:--------------------|:-----------------------|:-------------|
-| `ASSERT_FLOAT_EQ(`_expected, actual_`);` | `EXPECT_FLOAT_EQ(`_expected, actual_`);` | the two `float` values are almost equal |
-| `ASSERT_DOUBLE_EQ(`_expected, actual_`);` | `EXPECT_DOUBLE_EQ(`_expected, actual_`);` | the two `double` values are almost equal |
+| `ASSERT_FLOAT_EQ(`_val1, val2_`);` | `EXPECT_FLOAT_EQ(`_val1, val2_`);` | the two `float` values are almost equal |
+| `ASSERT_DOUBLE_EQ(`_val1, val2_`);` | `EXPECT_DOUBLE_EQ(`_val1, val2_`);` | the two `double` values are almost equal |
By "almost equal", we mean the two values are within 4 ULP's from each
other.
@@ -1450,7 +1450,7 @@ two cases to consider:
Both static functions and definitions/declarations in an unnamed namespace are
only visible within the same translation unit. To test them, you can `#include`
-the entire `.cc` file being tested in your `*_test.cc` file. (#including `.cc`
+the entire `.cc` file being tested in your `*_test.cc` file. (`#include`ing `.cc`
files is not a good way to reuse code - you should not do this in production
code!)
@@ -1551,8 +1551,8 @@ exception, you could catch the exception and assert on it. But Google
Test doesn't use exceptions, so how do we test that a piece of code
generates an expected failure?
-`"gtest/gtest-spi.h"` contains some constructs to do this. After
-#including this header, you can use
+`"gtest/gtest-spi.h"` contains some constructs to do this. After
+`#include`ing this header, you can use
| `EXPECT_FATAL_FAILURE(`_statement, substring_`);` |
|:--------------------------------------------------|
@@ -1571,15 +1571,14 @@ For technical reasons, there are some caveats:
1. _statement_ in `EXPECT_FATAL_FAILURE()` cannot reference local non-static variables or non-static members of `this` object.
1. _statement_ in `EXPECT_FATAL_FAILURE()` cannot return a value.
-_Note:_ Google Test is designed with threads in mind. Once the
+_Note:_ Google Test is designed with threads in mind. Once the
synchronization primitives in `"gtest/internal/gtest-port.h"` have
been implemented, Google Test will become thread-safe, meaning that
-you can then use assertions in multiple threads concurrently. Before
-
-that, however, Google Test only supports single-threaded usage. Once
+you can then use assertions in multiple threads concurrently. Before
+that, however, Google Test only supports single-threaded usage. Once
thread-safe, `EXPECT_FATAL_FAILURE()` and `EXPECT_NONFATAL_FAILURE()`
will capture failures in the current thread only. If _statement_
-creates new threads, failures in these threads will be ignored. If
+creates new threads, failures in these threads will be ignored. If
you want to capture failures from all threads instead, you should use
the following macros:
diff --git a/googletest/docs/FAQ.md b/googletest/docs/FAQ.md
index 639c2509..5fd6cb72 100644
--- a/googletest/docs/FAQ.md
+++ b/googletest/docs/FAQ.md
@@ -994,7 +994,7 @@ you can use the _horrible_ hack of sniffing your executable name
## Google Test defines a macro that clashes with one defined by another library. How do I deal with that? ##
In C++, macros don't obey namespaces. Therefore two libraries that
-both define a macro of the same name will clash if you #include both
+both define a macro of the same name will clash if you `#include` both
definitions. In case a Google Test macro clashes with another
library, you can force Google Test to rename its macro to avoid the
conflict.
diff --git a/googletest/docs/Primer.md b/googletest/docs/Primer.md
index 9218fd51..474c1d2a 100644
--- a/googletest/docs/Primer.md
+++ b/googletest/docs/Primer.md
@@ -127,18 +127,14 @@ This section describes assertions that compare two values.
| **Fatal assertion** | **Nonfatal assertion** | **Verifies** |
|:--------------------|:-----------------------|:-------------|
-|`ASSERT_EQ(`_expected_`, `_actual_`);`|`EXPECT_EQ(`_expected_`, `_actual_`);`| _expected_ `==` _actual_ |
-|`ASSERT_NE(`_val1_`, `_val2_`);` |`EXPECT_NE(`_val1_`, `_val2_`);` | _val1_ `!=` _val2_ |
-|`ASSERT_LT(`_val1_`, `_val2_`);` |`EXPECT_LT(`_val1_`, `_val2_`);` | _val1_ `<` _val2_ |
-|`ASSERT_LE(`_val1_`, `_val2_`);` |`EXPECT_LE(`_val1_`, `_val2_`);` | _val1_ `<=` _val2_ |
-|`ASSERT_GT(`_val1_`, `_val2_`);` |`EXPECT_GT(`_val1_`, `_val2_`);` | _val1_ `>` _val2_ |
-|`ASSERT_GE(`_val1_`, `_val2_`);` |`EXPECT_GE(`_val1_`, `_val2_`);` | _val1_ `>=` _val2_ |
-
-In the event of a failure, Google Test prints both _val1_ and _val2_
-. In `ASSERT_EQ*` and `EXPECT_EQ*` (and all other equality assertions
-we'll introduce later), you should put the expression you want to test
-in the position of _actual_, and put its expected value in _expected_,
-as Google Test's failure messages are optimized for this convention.
+|`ASSERT_EQ(`_val1_`, `_val2_`);`|`EXPECT_EQ(`_val1_`, `_val2_`);`| _val1_ `==` _val2_ |
+|`ASSERT_NE(`_val1_`, `_val2_`);`|`EXPECT_NE(`_val1_`, `_val2_`);`| _val1_ `!=` _val2_ |
+|`ASSERT_LT(`_val1_`, `_val2_`);`|`EXPECT_LT(`_val1_`, `_val2_`);`| _val1_ `<` _val2_ |
+|`ASSERT_LE(`_val1_`, `_val2_`);`|`EXPECT_LE(`_val1_`, `_val2_`);`| _val1_ `<=` _val2_ |
+|`ASSERT_GT(`_val1_`, `_val2_`);`|`EXPECT_GT(`_val1_`, `_val2_`);`| _val1_ `>` _val2_ |
+|`ASSERT_GE(`_val1_`, `_val2_`);`|`EXPECT_GE(`_val1_`, `_val2_`);`| _val1_ `>=` _val2_ |
+
+In the event of a failure, Google Test prints both _val1_ and _val2_.
Value arguments must be comparable by the assertion's comparison
operator or you'll get a compiler error. We used to require the
@@ -172,6 +168,10 @@ and `wstring`).
_Availability_: Linux, Windows, Mac.
+_Historical note_: Before February 2016 `*_EQ` had a convention of calling it as
+`ASSERT_EQ(expected, actual)`, so lots of existing code uses this order.
+Now `*_EQ` treats both parameters in the same way.
+
## String Comparison ##
The assertions in this group compare two **C strings**. If you want to compare
@@ -179,9 +179,9 @@ two `string` objects, use `EXPECT_EQ`, `EXPECT_NE`, and etc instead.
| **Fatal assertion** | **Nonfatal assertion** | **Verifies** |
|:--------------------|:-----------------------|:-------------|
-| `ASSERT_STREQ(`_expected\_str_`, `_actual\_str_`);` | `EXPECT_STREQ(`_expected\_str_`, `_actual\_str_`);` | the two C strings have the same content |
+| `ASSERT_STREQ(`_str1_`, `_str2_`);` | `EXPECT_STREQ(`_str1_`, `_str_2`);` | the two C strings have the same content |
| `ASSERT_STRNE(`_str1_`, `_str2_`);` | `EXPECT_STRNE(`_str1_`, `_str2_`);` | the two C strings have different content |
-| `ASSERT_STRCASEEQ(`_expected\_str_`, `_actual\_str_`);`| `EXPECT_STRCASEEQ(`_expected\_str_`, `_actual\_str_`);` | the two C strings have the same content, ignoring case |
+| `ASSERT_STRCASEEQ(`_str1_`, `_str2_`);`| `EXPECT_STRCASEEQ(`_str1_`, `_str2_`);` | the two C strings have the same content, ignoring case |
| `ASSERT_STRCASENE(`_str1_`, `_str2_`);`| `EXPECT_STRCASENE(`_str1_`, `_str2_`);` | the two C strings have different content, ignoring case |
Note that "CASE" in an assertion name means that case is ignored.
diff --git a/googletest/docs/V1_5_AdvancedGuide.md b/googletest/docs/V1_5_AdvancedGuide.md
index 9511f226..34e19c26 100644
--- a/googletest/docs/V1_5_AdvancedGuide.md
+++ b/googletest/docs/V1_5_AdvancedGuide.md
@@ -1365,7 +1365,7 @@ two cases to consider:
Both static functions and definitions/declarations in an unnamed namespace are
only visible within the same translation unit. To test them, you can `#include`
-the entire `.cc` file being tested in your `*_test.cc` file. (#including `.cc`
+the entire `.cc` file being tested in your `*_test.cc` file. (`#include`ing `.cc`
files is not a good way to reuse code - you should not do this in production
code!)
@@ -1467,7 +1467,7 @@ Test doesn't use exceptions, so how do we test that a piece of code
generates an expected failure?
`<gtest/gtest-spi.h>` contains some constructs to do this. After
-#including this header, you can use
+`#include`ing this header, you can use
| `EXPECT_FATAL_FAILURE(`_statement, substring_`);` |
|:--------------------------------------------------|
diff --git a/googletest/docs/V1_6_AdvancedGuide.md b/googletest/docs/V1_6_AdvancedGuide.md
index 5225341a..78864b16 100644
--- a/googletest/docs/V1_6_AdvancedGuide.md
+++ b/googletest/docs/V1_6_AdvancedGuide.md
@@ -1447,7 +1447,7 @@ two cases to consider:
Both static functions and definitions/declarations in an unnamed namespace are
only visible within the same translation unit. To test them, you can `#include`
-the entire `.cc` file being tested in your `*_test.cc` file. (#including `.cc`
+the entire `.cc` file being tested in your `*_test.cc` file. (`#include`ing `.cc`
files is not a good way to reuse code - you should not do this in production
code!)
@@ -1549,7 +1549,7 @@ Test doesn't use exceptions, so how do we test that a piece of code
generates an expected failure?
`"gtest/gtest-spi.h"` contains some constructs to do this. After
-#including this header, you can use
+`#include`ing this header, you can use
| `EXPECT_FATAL_FAILURE(`_statement, substring_`);` |
|:--------------------------------------------------|
diff --git a/googletest/docs/V1_6_FAQ.md b/googletest/docs/V1_6_FAQ.md
index 6d5d128a..2b7f7840 100644
--- a/googletest/docs/V1_6_FAQ.md
+++ b/googletest/docs/V1_6_FAQ.md
@@ -989,7 +989,7 @@ you can use the _horrible_ hack of sniffing your executable name
## Google Test defines a macro that clashes with one defined by another library. How do I deal with that? ##
In C++, macros don't obey namespaces. Therefore two libraries that
-both define a macro of the same name will clash if you #include both
+both define a macro of the same name will clash if you `#include` both
definitions. In case a Google Test macro clashes with another
library, you can force Google Test to rename its macro to avoid the
conflict.
diff --git a/googletest/docs/V1_7_AdvancedGuide.md b/googletest/docs/V1_7_AdvancedGuide.md
index 83a8f798..dd4af8f3 100644
--- a/googletest/docs/V1_7_AdvancedGuide.md
+++ b/googletest/docs/V1_7_AdvancedGuide.md
@@ -1448,7 +1448,7 @@ two cases to consider:
Both static functions and definitions/declarations in an unnamed namespace are
only visible within the same translation unit. To test them, you can `#include`
-the entire `.cc` file being tested in your `*_test.cc` file. (#including `.cc`
+the entire `.cc` file being tested in your `*_test.cc` file. (`#include`ing `.cc`
files is not a good way to reuse code - you should not do this in production
code!)
@@ -1550,7 +1550,7 @@ Test doesn't use exceptions, so how do we test that a piece of code
generates an expected failure?
`"gtest/gtest-spi.h"` contains some constructs to do this. After
-#including this header, you can use
+`#include`ing this header, you can use
| `EXPECT_FATAL_FAILURE(`_statement, substring_`);` |
|:--------------------------------------------------|
diff --git a/googletest/docs/V1_7_FAQ.md b/googletest/docs/V1_7_FAQ.md
index ded1a48b..3dd914dc 100644
--- a/googletest/docs/V1_7_FAQ.md
+++ b/googletest/docs/V1_7_FAQ.md
@@ -989,7 +989,7 @@ you can use the _horrible_ hack of sniffing your executable name
## Google Test defines a macro that clashes with one defined by another library. How do I deal with that? ##
In C++, macros don't obey namespaces. Therefore two libraries that
-both define a macro of the same name will clash if you #include both
+both define a macro of the same name will clash if you `#include` both
definitions. In case a Google Test macro clashes with another
library, you can force Google Test to rename its macro to avoid the
conflict.
diff --git a/googletest/include/gtest/gtest-printers.h b/googletest/include/gtest/gtest-printers.h
index 8a33164c..e850d605 100644
--- a/googletest/include/gtest/gtest-printers.h
+++ b/googletest/include/gtest/gtest-printers.h
@@ -151,10 +151,10 @@ template <typename T>
class TypeWithoutFormatter<T, kProtobuf> {
public:
static void PrintValue(const T& value, ::std::ostream* os) {
- const ::testing::internal::string short_str = value.ShortDebugString();
- const ::testing::internal::string pretty_str =
- short_str.length() <= kProtobufOneLinerMaxLength ?
- short_str : ("\n" + value.DebugString());
+ std::string pretty_str = value.ShortDebugString();
+ if (pretty_str.length() > kProtobufOneLinerMaxLength) {
+ pretty_str = "\n" + value.DebugString();
+ }
*os << ("<" + pretty_str + ">");
}
};
@@ -364,11 +364,18 @@ class UniversalPrinter;
template <typename T>
void UniversalPrint(const T& value, ::std::ostream* os);
+enum DefaultPrinterType {
+ kPrintContainer,
+ kPrintPointer,
+ kPrintFunctionPointer,
+ kPrintOther,
+};
+template <DefaultPrinterType type> struct WrapPrinterType {};
+
// Used to print an STL-style container when the user doesn't define
// a PrintTo() for it.
template <typename C>
-void DefaultPrintTo(IsContainer /* dummy */,
- false_type /* is not a pointer */,
+void DefaultPrintTo(WrapPrinterType<kPrintContainer> /* dummy */,
const C& container, ::std::ostream* os) {
const size_t kMaxCount = 32; // The maximum number of elements to print.
*os << '{';
@@ -401,40 +408,38 @@ void DefaultPrintTo(IsContainer /* dummy */,
// implementation-defined. Therefore they will be printed as raw
// bytes.)
template <typename T>
-void DefaultPrintTo(IsNotContainer /* dummy */,
- true_type /* is a pointer */,
+void DefaultPrintTo(WrapPrinterType<kPrintPointer> /* dummy */,
T* p, ::std::ostream* os) {
if (p == NULL) {
*os << "NULL";
} else {
- // C++ doesn't allow casting from a function pointer to any object
- // pointer.
- //
- // IsTrue() silences warnings: "Condition is always true",
- // "unreachable code".
- if (IsTrue(ImplicitlyConvertible<T*, const void*>::value)) {
- // T is not a function type. We just call << to print p,
- // relying on ADL to pick up user-defined << for their pointer
- // types, if any.
- *os << p;
- } else {
- // T is a function type, so '*os << p' doesn't do what we want
- // (it just prints p as bool). We want to print p as a const
- // void*. However, we cannot cast it to const void* directly,
- // even using reinterpret_cast, as earlier versions of gcc
- // (e.g. 3.4.5) cannot compile the cast when p is a function
- // pointer. Casting to UInt64 first solves the problem.
- *os << reinterpret_cast<const void*>(
- reinterpret_cast<internal::UInt64>(p));
- }
+ // T is not a function type. We just call << to print p,
+ // relying on ADL to pick up user-defined << for their pointer
+ // types, if any.
+ *os << p;
+ }
+}
+template <typename T>
+void DefaultPrintTo(WrapPrinterType<kPrintFunctionPointer> /* dummy */,
+ T* p, ::std::ostream* os) {
+ if (p == NULL) {
+ *os << "NULL";
+ } else {
+ // T is a function type, so '*os << p' doesn't do what we want
+ // (it just prints p as bool). We want to print p as a const
+ // void*. However, we cannot cast it to const void* directly,
+ // even using reinterpret_cast, as earlier versions of gcc
+ // (e.g. 3.4.5) cannot compile the cast when p is a function
+ // pointer. Casting to UInt64 first solves the problem.
+ *os << reinterpret_cast<const void*>(
+ reinterpret_cast<internal::UInt64>(p));
}
}
// Used to print a non-container, non-pointer value when the user
// doesn't define PrintTo() for it.
template <typename T>
-void DefaultPrintTo(IsNotContainer /* dummy */,
- false_type /* is not a pointer */,
+void DefaultPrintTo(WrapPrinterType<kPrintOther> /* dummy */,
const T& value, ::std::ostream* os) {
::testing_internal::DefaultPrintNonContainerTo(value, os);
}
@@ -452,11 +457,8 @@ void DefaultPrintTo(IsNotContainer /* dummy */,
// wants).
template <typename T>
void PrintTo(const T& value, ::std::ostream* os) {
- // DefaultPrintTo() is overloaded. The type of its first two
- // arguments determine which version will be picked. If T is an
- // STL-style container, the version for container will be called; if
- // T is a pointer, the pointer version will be called; otherwise the
- // generic version will be called.
+ // DefaultPrintTo() is overloaded. The type of its first argument
+ // determines which version will be picked.
//
// Note that we check for container types here, prior to we check
// for protocol message types in our operator<<. The rationale is:
@@ -468,13 +470,24 @@ void PrintTo(const T& value, ::std::ostream* os) {
// elements; therefore we check for container types here to ensure
// that our format is used.
//
- // The second argument of DefaultPrintTo() is needed to bypass a bug
- // in Symbian's C++ compiler that prevents it from picking the right
- // overload between:
- //
- // PrintTo(const T& x, ...);
- // PrintTo(T* x, ...);
- DefaultPrintTo(IsContainerTest<T>(0), is_pointer<T>(), value, os);
+ // Note that MSVC and clang-cl do allow an implicit conversion from
+ // pointer-to-function to pointer-to-object, but clang-cl warns on it.
+ // So don't use ImplicitlyConvertible if it can be helped since it will
+ // cause this warning, and use a separate overload of DefaultPrintTo for
+ // function pointers so that the `*os << p` in the object pointer overload
+ // doesn't cause that warning either.
+ DefaultPrintTo(
+ WrapPrinterType<sizeof(IsContainerTest<T>(0)) == sizeof(IsContainer)
+ ? kPrintContainer : !is_pointer<T>::value
+ ? kPrintOther
+#if GTEST_LANG_CXX11
+ : std::is_function<typename std::remove_pointer<T>::type>::value
+#else
+ : !internal::ImplicitlyConvertible<T, const void*>::value
+#endif
+ ? kPrintFunctionPointer
+ : kPrintPointer>(),
+ value, os);
}
// The following list of PrintTo() overloads tells
@@ -805,7 +818,7 @@ class UniversalTersePrinter<const char*> {
if (str == NULL) {
*os << "NULL";
} else {
- UniversalPrint(string(str), os);
+ UniversalPrint(std::string(str), os);
}
}
};
diff --git a/googletest/include/gtest/gtest-spi.h b/googletest/include/gtest/gtest-spi.h
index f63fa9a1..0e5c10cf 100644
--- a/googletest/include/gtest/gtest-spi.h
+++ b/googletest/include/gtest/gtest-spi.h
@@ -97,13 +97,12 @@ class GTEST_API_ SingleFailureChecker {
public:
// The constructor remembers the arguments.
SingleFailureChecker(const TestPartResultArray* results,
- TestPartResult::Type type,
- const string& substr);
+ TestPartResult::Type type, const std::string& substr);
~SingleFailureChecker();
private:
const TestPartResultArray* const results_;
const TestPartResult::Type type_;
- const string substr_;
+ const std::string substr_;
GTEST_DISALLOW_COPY_AND_ASSIGN_(SingleFailureChecker);
};
diff --git a/googletest/include/gtest/gtest-typed-test.h b/googletest/include/gtest/gtest-typed-test.h
index 5f69d567..20726b2c 100644
--- a/googletest/include/gtest/gtest-typed-test.h
+++ b/googletest/include/gtest/gtest-typed-test.h
@@ -241,9 +241,10 @@ INSTANTIATE_TYPED_TEST_CASE_P(My, FooTest, MyTypes);
namespace GTEST_CASE_NAMESPACE_(CaseName) { \
typedef ::testing::internal::Templates<__VA_ARGS__>::type gtest_AllTests_; \
} \
- static const char* const GTEST_REGISTERED_TEST_NAMES_(CaseName) = \
- GTEST_TYPED_TEST_CASE_P_STATE_(CaseName).VerifyRegisteredTestNames(\
- __FILE__, __LINE__, #__VA_ARGS__)
+ static const char* const GTEST_REGISTERED_TEST_NAMES_(CaseName) \
+ GTEST_ATTRIBUTE_UNUSED_ = \
+ GTEST_TYPED_TEST_CASE_P_STATE_(CaseName).VerifyRegisteredTestNames(\
+ __FILE__, __LINE__, #__VA_ARGS__)
// The 'Types' template argument below must have spaces around it
// since some compilers may choke on '>>' when passing a template
diff --git a/googletest/include/gtest/gtest.h b/googletest/include/gtest/gtest.h
index 7b59c492..c1cd69ab 100644
--- a/googletest/include/gtest/gtest.h
+++ b/googletest/include/gtest/gtest.h
@@ -1287,7 +1287,7 @@ class GTEST_API_ UnitTest {
internal::UnitTestImpl* impl() { return impl_; }
const internal::UnitTestImpl* impl() const { return impl_; }
- // These classes and funcions are friends as they need to access private
+ // These classes and functions are friends as they need to access private
// members of UnitTest.
friend class Test;
friend class internal::AssertHelper;
@@ -1372,39 +1372,38 @@ namespace internal {
// frame size of CmpHelperEQ. This helps reduce the overhead of some sanitizers
// when calling EXPECT_* in a tight loop.
template <typename T1, typename T2>
-AssertionResult CmpHelperEQFailure(const char* expected_expression,
- const char* actual_expression,
- const T1& expected, const T2& actual) {
- return EqFailure(expected_expression,
- actual_expression,
- FormatForComparisonFailureMessage(expected, actual),
- FormatForComparisonFailureMessage(actual, expected),
+AssertionResult CmpHelperEQFailure(const char* lhs_expression,
+ const char* rhs_expression,
+ const T1& lhs, const T2& rhs) {
+ return EqFailure(lhs_expression,
+ rhs_expression,
+ FormatForComparisonFailureMessage(lhs, rhs),
+ FormatForComparisonFailureMessage(rhs, lhs),
false);
}
// The helper function for {ASSERT|EXPECT}_EQ.
template <typename T1, typename T2>
-AssertionResult CmpHelperEQ(const char* expected_expression,
- const char* actual_expression,
- const T1& expected,
- const T2& actual) {
+AssertionResult CmpHelperEQ(const char* lhs_expression,
+ const char* rhs_expression,
+ const T1& lhs,
+ const T2& rhs) {
GTEST_DISABLE_MSC_WARNINGS_PUSH_(4389 /* signed/unsigned mismatch */)
- if (expected == actual) {
+ if (lhs == rhs) {
return AssertionSuccess();
}
GTEST_DISABLE_MSC_WARNINGS_POP_()
- return CmpHelperEQFailure(expected_expression, actual_expression, expected,
- actual);
+ return CmpHelperEQFailure(lhs_expression, rhs_expression, lhs, rhs);
}
// With this overloaded version, we allow anonymous enums to be used
// in {ASSERT|EXPECT}_EQ when compiled with gcc 4, as anonymous enums
// can be implicitly cast to BiggestInt.
-GTEST_API_ AssertionResult CmpHelperEQ(const char* expected_expression,
- const char* actual_expression,
- BiggestInt expected,
- BiggestInt actual);
+GTEST_API_ AssertionResult CmpHelperEQ(const char* lhs_expression,
+ const char* rhs_expression,
+ BiggestInt lhs,
+ BiggestInt rhs);
// The helper class for {ASSERT|EXPECT}_EQ. The template argument
// lhs_is_null_literal is true iff the first argument to ASSERT_EQ()
@@ -1415,12 +1414,11 @@ class EqHelper {
public:
// This templatized version is for the general case.
template <typename T1, typename T2>
- static AssertionResult Compare(const char* expected_expression,
- const char* actual_expression,
- const T1& expected,
- const T2& actual) {
- return CmpHelperEQ(expected_expression, actual_expression, expected,
- actual);
+ static AssertionResult Compare(const char* lhs_expression,
+ const char* rhs_expression,
+ const T1& lhs,
+ const T2& rhs) {
+ return CmpHelperEQ(lhs_expression, rhs_expression, lhs, rhs);
}
// With this overloaded version, we allow anonymous enums to be used
@@ -1429,12 +1427,11 @@ class EqHelper {
//
// Even though its body looks the same as the above version, we
// cannot merge the two, as it will make anonymous enums unhappy.
- static AssertionResult Compare(const char* expected_expression,
- const char* actual_expression,
- BiggestInt expected,
- BiggestInt actual) {
- return CmpHelperEQ(expected_expression, actual_expression, expected,
- actual);
+ static AssertionResult Compare(const char* lhs_expression,
+ const char* rhs_expression,
+ BiggestInt lhs,
+ BiggestInt rhs) {
+ return CmpHelperEQ(lhs_expression, rhs_expression, lhs, rhs);
}
};
@@ -1449,37 +1446,36 @@ class EqHelper<true> {
// EXPECT_EQ(false, a_bool).
template <typename T1, typename T2>
static AssertionResult Compare(
- const char* expected_expression,
- const char* actual_expression,
- const T1& expected,
- const T2& actual,
+ const char* lhs_expression,
+ const char* rhs_expression,
+ const T1& lhs,
+ const T2& rhs,
// The following line prevents this overload from being considered if T2
// is not a pointer type. We need this because ASSERT_EQ(NULL, my_ptr)
// expands to Compare("", "", NULL, my_ptr), which requires a conversion
// to match the Secret* in the other overload, which would otherwise make
// this template match better.
typename EnableIf<!is_pointer<T2>::value>::type* = 0) {
- return CmpHelperEQ(expected_expression, actual_expression, expected,
- actual);
+ return CmpHelperEQ(lhs_expression, rhs_expression, lhs, rhs);
}
// This version will be picked when the second argument to ASSERT_EQ() is a
// pointer, e.g. ASSERT_EQ(NULL, a_pointer).
template <typename T>
static AssertionResult Compare(
- const char* expected_expression,
- const char* actual_expression,
+ const char* lhs_expression,
+ const char* rhs_expression,
// We used to have a second template parameter instead of Secret*. That
// template parameter would deduce to 'long', making this a better match
// than the first overload even without the first overload's EnableIf.
// Unfortunately, gcc with -Wconversion-null warns when "passing NULL to
// non-pointer argument" (even a deduced integral argument), so the old
// implementation caused warnings in user code.
- Secret* /* expected (NULL) */,
- T* actual) {
- // We already know that 'expected' is a null pointer.
- return CmpHelperEQ(expected_expression, actual_expression,
- static_cast<T*>(NULL), actual);
+ Secret* /* lhs (NULL) */,
+ T* rhs) {
+ // We already know that 'lhs' is a null pointer.
+ return CmpHelperEQ(lhs_expression, rhs_expression,
+ static_cast<T*>(NULL), rhs);
}
};
@@ -1538,18 +1534,18 @@ GTEST_IMPL_CMP_HELPER_(GT, >);
// The helper function for {ASSERT|EXPECT}_STREQ.
//
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
-GTEST_API_ AssertionResult CmpHelperSTREQ(const char* expected_expression,
- const char* actual_expression,
- const char* expected,
- const char* actual);
+GTEST_API_ AssertionResult CmpHelperSTREQ(const char* s1_expression,
+ const char* s2_expression,
+ const char* s1,
+ const char* s2);
// The helper function for {ASSERT|EXPECT}_STRCASEEQ.
//
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
-GTEST_API_ AssertionResult CmpHelperSTRCASEEQ(const char* expected_expression,
- const char* actual_expression,
- const char* expected,
- const char* actual);
+GTEST_API_ AssertionResult CmpHelperSTRCASEEQ(const char* s1_expression,
+ const char* s2_expression,
+ const char* s1,
+ const char* s2);
// The helper function for {ASSERT|EXPECT}_STRNE.
//
@@ -1571,10 +1567,10 @@ GTEST_API_ AssertionResult CmpHelperSTRCASENE(const char* s1_expression,
// Helper function for *_STREQ on wide strings.
//
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
-GTEST_API_ AssertionResult CmpHelperSTREQ(const char* expected_expression,
- const char* actual_expression,
- const wchar_t* expected,
- const wchar_t* actual);
+GTEST_API_ AssertionResult CmpHelperSTREQ(const char* s1_expression,
+ const char* s2_expression,
+ const wchar_t* s1,
+ const wchar_t* s2);
// Helper function for *_STRNE on wide strings.
//
@@ -1632,28 +1628,28 @@ namespace internal {
//
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
template <typename RawType>
-AssertionResult CmpHelperFloatingPointEQ(const char* expected_expression,
- const char* actual_expression,
- RawType expected,
- RawType actual) {
- const FloatingPoint<RawType> lhs(expected), rhs(actual);
+AssertionResult CmpHelperFloatingPointEQ(const char* lhs_expression,
+ const char* rhs_expression,
+ RawType lhs_value,
+ RawType rhs_value) {
+ const FloatingPoint<RawType> lhs(lhs_value), rhs(rhs_value);
if (lhs.AlmostEquals(rhs)) {
return AssertionSuccess();
}
- ::std::stringstream expected_ss;
- expected_ss << std::setprecision(std::numeric_limits<RawType>::digits10 + 2)
- << expected;
+ ::std::stringstream lhs_ss;
+ lhs_ss << std::setprecision(std::numeric_limits<RawType>::digits10 + 2)
+ << lhs_value;
- ::std::stringstream actual_ss;
- actual_ss << std::setprecision(std::numeric_limits<RawType>::digits10 + 2)
- << actual;
+ ::std::stringstream rhs_ss;
+ rhs_ss << std::setprecision(std::numeric_limits<RawType>::digits10 + 2)
+ << rhs_value;
- return EqFailure(expected_expression,
- actual_expression,
- StringStreamToString(&expected_ss),
- StringStreamToString(&actual_ss),
+ return EqFailure(lhs_expression,
+ rhs_expression,
+ StringStreamToString(&lhs_ss),
+ StringStreamToString(&rhs_ss),
false);
}
@@ -1861,13 +1857,13 @@ class TestWithParam : public Test, public WithParamInterface<T> {
// AssertionResult. For more information on how to use AssertionResult with
// these macros see comments on that class.
#define EXPECT_TRUE(condition) \
- GTEST_TEST_BOOLEAN_(condition, #condition, false, true, \
+ GTEST_TEST_BOOLEAN_((condition), #condition, false, true, \
GTEST_NONFATAL_FAILURE_)
#define EXPECT_FALSE(condition) \
GTEST_TEST_BOOLEAN_(!(condition), #condition, true, false, \
GTEST_NONFATAL_FAILURE_)
#define ASSERT_TRUE(condition) \
- GTEST_TEST_BOOLEAN_(condition, #condition, false, true, \
+ GTEST_TEST_BOOLEAN_((condition), #condition, false, true, \
GTEST_FATAL_FAILURE_)
#define ASSERT_FALSE(condition) \
GTEST_TEST_BOOLEAN_(!(condition), #condition, true, false, \
@@ -1879,12 +1875,12 @@ class TestWithParam : public Test, public WithParamInterface<T> {
// Macros for testing equalities and inequalities.
//
-// * {ASSERT|EXPECT}_EQ(expected, actual): Tests that expected == actual
-// * {ASSERT|EXPECT}_NE(v1, v2): Tests that v1 != v2
-// * {ASSERT|EXPECT}_LT(v1, v2): Tests that v1 < v2
-// * {ASSERT|EXPECT}_LE(v1, v2): Tests that v1 <= v2
-// * {ASSERT|EXPECT}_GT(v1, v2): Tests that v1 > v2
-// * {ASSERT|EXPECT}_GE(v1, v2): Tests that v1 >= v2
+// * {ASSERT|EXPECT}_EQ(v1, v2): Tests that v1 == v2
+// * {ASSERT|EXPECT}_NE(v1, v2): Tests that v1 != v2
+// * {ASSERT|EXPECT}_LT(v1, v2): Tests that v1 < v2
+// * {ASSERT|EXPECT}_LE(v1, v2): Tests that v1 <= v2
+// * {ASSERT|EXPECT}_GT(v1, v2): Tests that v1 > v2
+// * {ASSERT|EXPECT}_GE(v1, v2): Tests that v1 >= v2
//
// When they are not, Google Test prints both the tested expressions and
// their actual values. The values must be compatible built-in types,
@@ -1906,8 +1902,8 @@ class TestWithParam : public Test, public WithParamInterface<T> {
// are related, not how their content is related. To compare two C
// strings by content, use {ASSERT|EXPECT}_STR*().
//
-// 3. {ASSERT|EXPECT}_EQ(expected, actual) is preferred to
-// {ASSERT|EXPECT}_TRUE(expected == actual), as the former tells you
+// 3. {ASSERT|EXPECT}_EQ(v1, v2) is preferred to
+// {ASSERT|EXPECT}_TRUE(v1 == v2), as the former tells you
// what the actual value is when it fails, and similarly for the
// other comparisons.
//
@@ -1923,12 +1919,12 @@ class TestWithParam : public Test, public WithParamInterface<T> {
// ASSERT_LT(i, array_size);
// ASSERT_GT(records.size(), 0) << "There is no record left.";
-#define EXPECT_EQ(expected, actual) \
+#define EXPECT_EQ(val1, val2) \
EXPECT_PRED_FORMAT2(::testing::internal:: \
- EqHelper<GTEST_IS_NULL_LITERAL_(expected)>::Compare, \
- expected, actual)
-#define EXPECT_NE(expected, actual) \
- EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperNE, expected, actual)
+ EqHelper<GTEST_IS_NULL_LITERAL_(val1)>::Compare, \
+ val1, val2)
+#define EXPECT_NE(val1, val2) \
+ EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperNE, val1, val2)
#define EXPECT_LE(val1, val2) \
EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperLE, val1, val2)
#define EXPECT_LT(val1, val2) \
@@ -1938,10 +1934,10 @@ class TestWithParam : public Test, public WithParamInterface<T> {
#define EXPECT_GT(val1, val2) \
EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperGT, val1, val2)
-#define GTEST_ASSERT_EQ(expected, actual) \
+#define GTEST_ASSERT_EQ(val1, val2) \
ASSERT_PRED_FORMAT2(::testing::internal:: \
- EqHelper<GTEST_IS_NULL_LITERAL_(expected)>::Compare, \
- expected, actual)
+ EqHelper<GTEST_IS_NULL_LITERAL_(val1)>::Compare, \
+ val1, val2)
#define GTEST_ASSERT_NE(val1, val2) \
ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperNE, val1, val2)
#define GTEST_ASSERT_LE(val1, val2) \
@@ -1996,29 +1992,29 @@ class TestWithParam : public Test, public WithParamInterface<T> {
//
// These macros evaluate their arguments exactly once.
-#define EXPECT_STREQ(expected, actual) \
- EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTREQ, expected, actual)
+#define EXPECT_STREQ(s1, s2) \
+ EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTREQ, s1, s2)
#define EXPECT_STRNE(s1, s2) \
EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTRNE, s1, s2)
-#define EXPECT_STRCASEEQ(expected, actual) \
- EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASEEQ, expected, actual)
+#define EXPECT_STRCASEEQ(s1, s2) \
+ EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASEEQ, s1, s2)
#define EXPECT_STRCASENE(s1, s2)\
EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASENE, s1, s2)
-#define ASSERT_STREQ(expected, actual) \
- ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTREQ, expected, actual)
+#define ASSERT_STREQ(s1, s2) \
+ ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTREQ, s1, s2)
#define ASSERT_STRNE(s1, s2) \
ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTRNE, s1, s2)
-#define ASSERT_STRCASEEQ(expected, actual) \
- ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASEEQ, expected, actual)
+#define ASSERT_STRCASEEQ(s1, s2) \
+ ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASEEQ, s1, s2)
#define ASSERT_STRCASENE(s1, s2)\
ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASENE, s1, s2)
// Macros for comparing floating-point numbers.
//
-// * {ASSERT|EXPECT}_FLOAT_EQ(expected, actual):
+// * {ASSERT|EXPECT}_FLOAT_EQ(val1, val2):
// Tests that two float values are almost equal.
-// * {ASSERT|EXPECT}_DOUBLE_EQ(expected, actual):
+// * {ASSERT|EXPECT}_DOUBLE_EQ(val1, val2):
// Tests that two double values are almost equal.
// * {ASSERT|EXPECT}_NEAR(v1, v2, abs_error):
// Tests that v1 and v2 are within the given distance to each other.
@@ -2028,21 +2024,21 @@ class TestWithParam : public Test, public WithParamInterface<T> {
// FloatingPoint template class in gtest-internal.h if you are
// interested in the implementation details.
-#define EXPECT_FLOAT_EQ(expected, actual)\
+#define EXPECT_FLOAT_EQ(val1, val2)\
EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<float>, \
- expected, actual)
+ val1, val2)
-#define EXPECT_DOUBLE_EQ(expected, actual)\
+#define EXPECT_DOUBLE_EQ(val1, val2)\
EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<double>, \
- expected, actual)
+ val1, val2)
-#define ASSERT_FLOAT_EQ(expected, actual)\
+#define ASSERT_FLOAT_EQ(val1, val2)\
ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<float>, \
- expected, actual)
+ val1, val2)
-#define ASSERT_DOUBLE_EQ(expected, actual)\
+#define ASSERT_DOUBLE_EQ(val1, val2)\
ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<double>, \
- expected, actual)
+ val1, val2)
#define EXPECT_NEAR(val1, val2, abs_error)\
EXPECT_PRED_FORMAT3(::testing::internal::DoubleNearPredFormat, \
@@ -2198,7 +2194,7 @@ bool StaticAssertTypeEq() {
// name of the test within the test case.
//
// A test fixture class must be declared earlier. The user should put
-// his test code between braces after using this macro. Example:
+// the test code between braces after using this macro. Example:
//
// class FooTest : public testing::Test {
// protected:
@@ -2221,6 +2217,10 @@ bool StaticAssertTypeEq() {
GTEST_TEST_(test_fixture, test_name, test_fixture, \
::testing::internal::GetTypeId<test_fixture>())
+// Returns a path to temporary directory.
+// Tries to determine an appropriate directory for the platform.
+GTEST_API_ std::string TempDir();
+
} // namespace testing
// Use this function in main() to run all tests. It returns 0 if all
diff --git a/googletest/include/gtest/internal/custom/gtest-port.h b/googletest/include/gtest/internal/custom/gtest-port.h
index 7e744bd3..c85f5d58 100644
--- a/googletest/include/gtest/internal/custom/gtest-port.h
+++ b/googletest/include/gtest/internal/custom/gtest-port.h
@@ -61,6 +61,9 @@
// GTEST_EXCLUSIVE_LOCK_REQUIRED_(locks)
// GTEST_LOCK_EXCLUDED_(locks)
//
+// Exporting API symbols:
+// GTEST_API_ - Specifier for exported symbols.
+//
// ** Custom implementation starts here **
#ifndef GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PORT_H_
diff --git a/googletest/include/gtest/internal/custom/gtest.h b/googletest/include/gtest/internal/custom/gtest.h
index c27412a8..b2fd4ae5 100644
--- a/googletest/include/gtest/internal/custom/gtest.h
+++ b/googletest/include/gtest/internal/custom/gtest.h
@@ -33,9 +33,32 @@
// GTEST_OS_STACK_TRACE_GETTER_ - The name of an implementation of
// OsStackTraceGetterInterface.
//
+// GTEST_CUSTOM_TEMPDIR_FUNCTION_ - An override for testing::TempDir().
+// See testing::TempDir for semantics and
+// signature.
+//
// ** Custom implementation starts here **
#ifndef GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_H_
#define GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_H_
+#define GTEST_CUSTOM_TEMPDIR_FUNCTION_ GetAndroidTempDir
+static inline std::string GetAndroidTempDir() {
+ // Android doesn't have /tmp, and /sdcard is no longer accessible from
+ // an app context starting from Android O. On Android, /data/local/tmp
+ // is usually used as the temporary directory, so try that first...
+ if (access("/data/local/tmp", R_OK | W_OK | X_OK) == 0) return "/data/local/tmp/";
+
+ // Processes running in an app context can't write to /data/local/tmp,
+ // so fall back to the current directory...
+ std::string result = "./";
+ char* cwd = getcwd(NULL, 0);
+ if (cwd != NULL) {
+ result = cwd;
+ result += "/";
+ free(cwd);
+ }
+ return result;
+}
+
#endif // GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_H_
diff --git a/googletest/include/gtest/internal/gtest-internal.h b/googletest/include/gtest/internal/gtest-internal.h
index ebd1cf61..72d83f0b 100644
--- a/googletest/include/gtest/internal/gtest-internal.h
+++ b/googletest/include/gtest/internal/gtest-internal.h
@@ -175,7 +175,7 @@ namespace edit_distance {
// Returns the optimal edits to go from 'left' to 'right'.
// All edits cost the same, with replace having lower priority than
// add/remove.
-// Simple implementation of the Wagner–Fischer algorithm.
+// Simple implementation of the Wagner-Fischer algorithm.
// See http://en.wikipedia.org/wiki/Wagner-Fischer_algorithm
enum EditType { kMatch, kAdd, kRemove, kReplace };
GTEST_API_ std::vector<EditType> CalculateOptimalEdits(
@@ -502,9 +502,10 @@ typedef void (*SetUpTestCaseFunc)();
typedef void (*TearDownTestCaseFunc)();
struct CodeLocation {
- CodeLocation(const string& a_file, int a_line) : file(a_file), line(a_line) {}
+ CodeLocation(const std::string& a_file, int a_line)
+ : file(a_file), line(a_line) {}
- string file;
+ std::string file;
int line;
};
diff --git a/googletest/include/gtest/internal/gtest-param-util.h b/googletest/include/gtest/internal/gtest-param-util.h
index 82cab9b0..3142f742 100644
--- a/googletest/include/gtest/internal/gtest-param-util.h
+++ b/googletest/include/gtest/internal/gtest-param-util.h
@@ -472,7 +472,7 @@ class ParameterizedTestCaseInfoBase {
virtual ~ParameterizedTestCaseInfoBase() {}
// Base part of test case name for display purposes.
- virtual const string& GetTestCaseName() const = 0;
+ virtual const std::string& GetTestCaseName() const = 0;
// Test case id to verify identity.
virtual TypeId GetTestCaseTypeId() const = 0;
// UnitTest class invokes this method to register tests in this
@@ -511,7 +511,7 @@ class ParameterizedTestCaseInfo : public ParameterizedTestCaseInfoBase {
: test_case_name_(name), code_location_(code_location) {}
// Test case base name for display purposes.
- virtual const string& GetTestCaseName() const { return test_case_name_; }
+ virtual const std::string& GetTestCaseName() const { return test_case_name_; }
// Test case id to verify identity.
virtual TypeId GetTestCaseTypeId() const { return GetTypeId<TestCase>(); }
// TEST_P macro uses AddTestPattern() to record information
@@ -529,11 +529,10 @@ class ParameterizedTestCaseInfo : public ParameterizedTestCaseInfoBase {
}
// INSTANTIATE_TEST_CASE_P macro uses AddGenerator() to record information
// about a generator.
- int AddTestCaseInstantiation(const string& instantiation_name,
+ int AddTestCaseInstantiation(const std::string& instantiation_name,
GeneratorCreationFunc* func,
ParamNameGeneratorFunc* name_func,
- const char* file,
- int line) {
+ const char* file, int line) {
instantiations_.push_back(
InstantiationInfo(instantiation_name, func, name_func, file, line));
return 0; // Return value used only to run this method in namespace scope.
@@ -550,13 +549,13 @@ class ParameterizedTestCaseInfo : public ParameterizedTestCaseInfoBase {
for (typename InstantiationContainer::iterator gen_it =
instantiations_.begin(); gen_it != instantiations_.end();
++gen_it) {
- const string& instantiation_name = gen_it->name;
+ const std::string& instantiation_name = gen_it->name;
ParamGenerator<ParamType> generator((*gen_it->generator)());
ParamNameGeneratorFunc* name_func = gen_it->name_func;
const char* file = gen_it->file;
int line = gen_it->line;
- string test_case_name;
+ std::string test_case_name;
if ( !instantiation_name.empty() )
test_case_name = instantiation_name + "/";
test_case_name += test_info->test_case_base_name;
@@ -609,8 +608,8 @@ class ParameterizedTestCaseInfo : public ParameterizedTestCaseInfoBase {
test_base_name(a_test_base_name),
test_meta_factory(a_test_meta_factory) {}
- const string test_case_base_name;
- const string test_base_name;
+ const std::string test_case_base_name;
+ const std::string test_base_name;
const scoped_ptr<TestMetaFactoryBase<ParamType> > test_meta_factory;
};
typedef ::std::vector<linked_ptr<TestInfo> > TestInfoContainer;
@@ -651,7 +650,7 @@ class ParameterizedTestCaseInfo : public ParameterizedTestCaseInfoBase {
return true;
}
- const string test_case_name_;
+ const std::string test_case_name_;
CodeLocation code_location_;
TestInfoContainer tests_;
InstantiationContainer instantiations_;
diff --git a/googletest/include/gtest/internal/gtest-port.h b/googletest/include/gtest/internal/gtest-port.h
index 7d6e4658..5e4f8ba8 100644
--- a/googletest/include/gtest/internal/gtest-port.h
+++ b/googletest/include/gtest/internal/gtest-port.h
@@ -396,10 +396,16 @@
# include <io.h>
# endif
// In order to avoid having to include <windows.h>, use forward declaration
-// assuming CRITICAL_SECTION is a typedef of _RTL_CRITICAL_SECTION.
+#if GTEST_OS_WINDOWS_MINGW && !defined(__MINGW64_VERSION_MAJOR)
+// MinGW defined _CRITICAL_SECTION and _RTL_CRITICAL_SECTION as two
+// separate (equivalent) structs, instead of using typedef
+typedef struct _CRITICAL_SECTION GTEST_CRITICAL_SECTION;
+#else
+// Assume CRITICAL_SECTION is a typedef of _RTL_CRITICAL_SECTION.
// This assumption is verified by
// WindowsTypesTest.CRITICAL_SECTIONIs_RTL_CRITICAL_SECTION.
-struct _RTL_CRITICAL_SECTION;
+typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION;
+#endif
#else
// This assumes that non-Windows OSes provide unistd.h. For OSes where this
// is not the case, we need to include headers that provide the functions
@@ -616,7 +622,7 @@ struct _RTL_CRITICAL_SECTION;
// Determines if hash_map/hash_set are available.
// Only used for testing against those containers.
#if !defined(GTEST_HAS_HASH_MAP_)
-# if _MSC_VER
+# if defined(_MSC_VER) && (_MSC_VER < 1900)
# define GTEST_HAS_HASH_MAP_ 1 // Indicates that hash_map is available.
# define GTEST_HAS_HASH_SET_ 1 // Indicates that hash_set is available.
# endif // _MSC_VER
@@ -754,8 +760,12 @@ using ::std::tuple_size;
# if GTEST_OS_LINUX && !defined(__ia64__)
# if GTEST_OS_LINUX_ANDROID
-// On Android, clone() is only available on ARM starting with Gingerbread.
-# if defined(__arm__) && __ANDROID_API__ >= 9
+// On Android, clone() became available at different API levels for each 32-bit
+// architecture.
+# if defined(__LP64__) || \
+ (defined(__arm__) && __ANDROID_API__ >= 9) || \
+ (defined(__mips__) && __ANDROID_API__ >= 12) || \
+ (defined(__i386__) && __ANDROID_API__ >= 17)
# define GTEST_HAS_CLONE 1
# else
# define GTEST_HAS_CLONE 0
@@ -864,6 +874,23 @@ using ::std::tuple_size;
# define GTEST_ATTRIBUTE_UNUSED_
#endif
+// Use this annotation before a function that takes a printf format string.
+#if defined(__GNUC__) && !defined(COMPILER_ICC)
+# if defined(__MINGW_PRINTF_FORMAT)
+// MinGW has two different printf implementations. Ensure the format macro
+// matches the selected implementation. See
+// https://sourceforge.net/p/mingw-w64/wiki2/gnu%20printf/.
+# define GTEST_ATTRIBUTE_PRINTF_(string_index, first_to_check) \
+ __attribute__((__format__(__MINGW_PRINTF_FORMAT, string_index, \
+ first_to_check)))
+# else
+# define GTEST_ATTRIBUTE_PRINTF_(string_index, first_to_check) \
+ __attribute__((__format__(__printf__, string_index, first_to_check)))
+# endif
+#else
+# define GTEST_ATTRIBUTE_PRINTF_(string_index, first_to_check)
+#endif
+
// A macro to disallow operator=
// This should be used in the private: declarations for a class.
#define GTEST_DISALLOW_ASSIGN_(type)\
@@ -920,6 +947,11 @@ using ::std::tuple_size;
#endif // GTEST_HAS_SEH
+// GTEST_API_ qualifies all symbols that must be exported. The definitions below
+// are guarded by #ifndef to give embedders a chance to define GTEST_API_ in
+// gtest/internal/custom/gtest-port.h
+#ifndef GTEST_API_
+
#ifdef _MSC_VER
# if GTEST_LINKED_AS_SHARED_LIBRARY
# define GTEST_API_ __declspec(dllimport)
@@ -930,9 +962,11 @@ using ::std::tuple_size;
# define GTEST_API_ __attribute__((visibility ("default")))
#endif // _MSC_VER
+#endif // GTEST_API_
+
#ifndef GTEST_API_
# define GTEST_API_
-#endif
+#endif // GTEST_API_
#ifdef __GNUC__
// Ask the compiler to never inline a given function.
@@ -1418,9 +1452,6 @@ GTEST_API_ std::string GetCapturedStderr();
#endif // GTEST_HAS_STREAM_REDIRECTION
-// Returns a path to temporary directory.
-GTEST_API_ std::string TempDir();
-
// Returns the size (in bytes) of a file.
GTEST_API_ size_t GetFileSize(FILE* file);
@@ -1693,7 +1724,7 @@ class GTEST_API_ Mutex {
// by the linker.
MutexType type_;
long critical_section_init_phase_; // NOLINT
- _RTL_CRITICAL_SECTION* critical_section_;
+ GTEST_CRITICAL_SECTION* critical_section_;
GTEST_DISALLOW_COPY_AND_ASSIGN_(Mutex);
};
@@ -2546,10 +2577,14 @@ bool ParseInt32(const Message& src_text, const char* str, Int32* value);
// corresponding to the given Google Test flag.
bool BoolFromGTestEnv(const char* flag, bool default_val);
GTEST_API_ Int32 Int32FromGTestEnv(const char* flag, Int32 default_val);
-const char* StringFromGTestEnv(const char* flag, const char* default_val);
+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/scripts/fuse_gtest_files.py b/googletest/scripts/fuse_gtest_files.py
index 57ef72f0..3f3e9f36 100755
--- a/googletest/scripts/fuse_gtest_files.py
+++ b/googletest/scripts/fuse_gtest_files.py
@@ -60,7 +60,10 @@ __author__ = 'wan@google.com (Zhanyong Wan)'
import os
import re
-import sets
+try:
+ from sets import Set as set # For Python 2.3 compatibility
+except ImportError:
+ pass
import sys
# We assume that this file is in the scripts/ directory in the Google
@@ -90,10 +93,10 @@ def VerifyFileExists(directory, relative_path):
"""
if not os.path.isfile(os.path.join(directory, relative_path)):
- print 'ERROR: Cannot find %s in directory %s.' % (relative_path,
- directory)
- print ('Please either specify a valid project root directory '
- 'or omit it on the command line.')
+ print('ERROR: Cannot find %s in directory %s.' % (relative_path,
+ directory))
+ print('Please either specify a valid project root directory '
+ 'or omit it on the command line.')
sys.exit(1)
@@ -119,11 +122,11 @@ def VerifyOutputFile(output_dir, relative_path):
# TODO(wan@google.com): The following user-interaction doesn't
# work with automated processes. We should provide a way for the
# Makefile to force overwriting the files.
- print ('%s already exists in directory %s - overwrite it? (y/N) ' %
- (relative_path, output_dir))
+ print('%s already exists in directory %s - overwrite it? (y/N) ' %
+ (relative_path, output_dir))
answer = sys.stdin.readline().strip()
if answer not in ['y', 'Y']:
- print 'ABORTED.'
+ print('ABORTED.')
sys.exit(1)
# Makes sure the directory holding the output file exists; creates
@@ -146,8 +149,8 @@ def ValidateOutputDir(output_dir):
def FuseGTestH(gtest_root, output_dir):
"""Scans folder gtest_root to generate gtest/gtest.h in output_dir."""
- output_file = file(os.path.join(output_dir, GTEST_H_OUTPUT), 'w')
- processed_files = sets.Set() # Holds all gtest headers we've processed.
+ output_file = open(os.path.join(output_dir, GTEST_H_OUTPUT), 'w')
+ processed_files = set() # Holds all gtest headers we've processed.
def ProcessFile(gtest_header_path):
"""Processes the given gtest header file."""
@@ -159,7 +162,7 @@ def FuseGTestH(gtest_root, output_dir):
processed_files.add(gtest_header_path)
# Reads each line in the given gtest header.
- for line in file(os.path.join(gtest_root, gtest_header_path), 'r'):
+ for line in open(os.path.join(gtest_root, gtest_header_path), 'r'):
m = INCLUDE_GTEST_FILE_REGEX.match(line)
if m:
# It's '#include "gtest/..."' - let's process it recursively.
@@ -175,7 +178,7 @@ def FuseGTestH(gtest_root, output_dir):
def FuseGTestAllCcToFile(gtest_root, output_file):
"""Scans folder gtest_root to generate gtest/gtest-all.cc in output_file."""
- processed_files = sets.Set()
+ processed_files = set()
def ProcessFile(gtest_source_file):
"""Processes the given gtest source file."""
@@ -187,7 +190,7 @@ def FuseGTestAllCcToFile(gtest_root, output_file):
processed_files.add(gtest_source_file)
# Reads each line in the given gtest source file.
- for line in file(os.path.join(gtest_root, gtest_source_file), 'r'):
+ for line in open(os.path.join(gtest_root, gtest_source_file), 'r'):
m = INCLUDE_GTEST_FILE_REGEX.match(line)
if m:
if 'include/' + m.group(1) == GTEST_SPI_H_SEED:
@@ -218,7 +221,7 @@ def FuseGTestAllCcToFile(gtest_root, output_file):
def FuseGTestAllCc(gtest_root, output_dir):
"""Scans folder gtest_root to generate gtest/gtest-all.cc in output_dir."""
- output_file = file(os.path.join(output_dir, GTEST_ALL_CC_OUTPUT), 'w')
+ output_file = open(os.path.join(output_dir, GTEST_ALL_CC_OUTPUT), 'w')
FuseGTestAllCcToFile(gtest_root, output_file)
output_file.close()
@@ -242,7 +245,7 @@ def main():
# fuse_gtest_files.py GTEST_ROOT_DIR OUTPUT_DIR
FuseGTest(sys.argv[1], sys.argv[2])
else:
- print __doc__
+ print(__doc__)
sys.exit(1)
diff --git a/googletest/src/gtest-death-test.cc b/googletest/src/gtest-death-test.cc
index a01a3698..fd1cc3fc 100644
--- a/googletest/src/gtest-death-test.cc
+++ b/googletest/src/gtest-death-test.cc
@@ -883,11 +883,10 @@ class ExecDeathTest : public ForkingDeathTest {
ForkingDeathTest(a_statement, a_regex), file_(file), line_(line) { }
virtual TestRole AssumeRole();
private:
- static ::std::vector<testing::internal::string>
- GetArgvsForDeathTestChildProcess() {
- ::std::vector<testing::internal::string> args = GetInjectableArgvs();
+ static ::std::vector<std::string> GetArgvsForDeathTestChildProcess() {
+ ::std::vector<std::string> args = GetInjectableArgvs();
# if defined(GTEST_EXTRA_DEATH_TEST_COMMAND_LINE_ARGS_)
- ::std::vector<testing::internal::string> extra_args =
+ ::std::vector<std::string> extra_args =
GTEST_EXTRA_DEATH_TEST_COMMAND_LINE_ARGS_();
args.insert(args.end(), extra_args.begin(), extra_args.end());
# endif // defined(GTEST_EXTRA_DEATH_TEST_COMMAND_LINE_ARGS_)
diff --git a/googletest/src/gtest-internal-inl.h b/googletest/src/gtest-internal-inl.h
index ed8a682a..021feb16 100644
--- a/googletest/src/gtest-internal-inl.h
+++ b/googletest/src/gtest-internal-inl.h
@@ -426,7 +426,7 @@ class OsStackTraceGetterInterface {
// in the trace.
// skip_count - the number of top frames to be skipped; doesn't count
// against max_depth.
- virtual string CurrentStackTrace(int max_depth, int skip_count) = 0;
+ virtual std::string CurrentStackTrace(int max_depth, int skip_count) = 0;
// UponLeavingGTest() should be called immediately before Google Test calls
// user code. It saves some information about the current stack that
@@ -446,7 +446,7 @@ class OsStackTraceGetter : public OsStackTraceGetterInterface {
public:
OsStackTraceGetter() {}
- virtual string CurrentStackTrace(int max_depth, int skip_count);
+ virtual std::string CurrentStackTrace(int max_depth, int skip_count);
virtual void UponLeavingGTest();
private:
@@ -1040,21 +1040,19 @@ class GTEST_API_ StreamingListener : public EmptyTestEventListener {
virtual ~AbstractSocketWriter() {}
// Sends a string to the socket.
- virtual void Send(const string& message) = 0;
+ virtual void Send(const std::string& message) = 0;
// Closes the socket.
virtual void CloseConnection() {}
// Sends a string and a newline to the socket.
- void SendLn(const string& message) {
- Send(message + "\n");
- }
+ void SendLn(const std::string& message) { Send(message + "\n"); }
};
// Concrete class for actually writing strings to a socket.
class SocketWriter : public AbstractSocketWriter {
public:
- SocketWriter(const string& host, const string& port)
+ SocketWriter(const std::string& host, const std::string& port)
: sockfd_(-1), host_name_(host), port_num_(port) {
MakeConnection();
}
@@ -1065,7 +1063,7 @@ class GTEST_API_ StreamingListener : public EmptyTestEventListener {
}
// Sends a string to the socket.
- virtual void Send(const string& message) {
+ virtual void Send(const std::string& message) {
GTEST_CHECK_(sockfd_ != -1)
<< "Send() can be called only when there is a connection.";
@@ -1091,17 +1089,19 @@ class GTEST_API_ StreamingListener : public EmptyTestEventListener {
}
int sockfd_; // socket file descriptor
- const string host_name_;
- const string port_num_;
+ const std::string host_name_;
+ const std::string port_num_;
GTEST_DISALLOW_COPY_AND_ASSIGN_(SocketWriter);
}; // class SocketWriter
// Escapes '=', '&', '%', and '\n' characters in str as "%xx".
- static string UrlEncode(const char* str);
+ static std::string UrlEncode(const char* str);
- StreamingListener(const string& host, const string& port)
- : socket_writer_(new SocketWriter(host, port)) { Start(); }
+ StreamingListener(const std::string& host, const std::string& port)
+ : socket_writer_(new SocketWriter(host, port)) {
+ Start();
+ }
explicit StreamingListener(AbstractSocketWriter* socket_writer)
: socket_writer_(socket_writer) { Start(); }
@@ -1162,13 +1162,13 @@ class GTEST_API_ StreamingListener : public EmptyTestEventListener {
private:
// Sends the given message and a newline to the socket.
- void SendLn(const string& message) { socket_writer_->SendLn(message); }
+ void SendLn(const std::string& message) { socket_writer_->SendLn(message); }
// Called at the start of streaming to notify the receiver what
// protocol we are using.
void Start() { SendLn("gtest_streaming_protocol_version=1.0"); }
- string FormatBool(bool value) { return value ? "1" : "0"; }
+ std::string FormatBool(bool value) { return value ? "1" : "0"; }
const scoped_ptr<AbstractSocketWriter> socket_writer_;
diff --git a/googletest/src/gtest-port.cc b/googletest/src/gtest-port.cc
index e8f8d89a..6f924246 100644
--- a/googletest/src/gtest-port.cc
+++ b/googletest/src/gtest-port.cc
@@ -93,7 +93,7 @@ const int kStdErrFileno = STDERR_FILENO;
namespace {
template <typename T>
-T ReadProcFileField(const string& filename, int field) {
+T ReadProcFileField(const std::string& filename, int field) {
std::string dummy;
std::ifstream file(filename.c_str());
while (field-- > 0) {
@@ -107,7 +107,7 @@ T ReadProcFileField(const string& filename, int field) {
// Returns the number of active threads, or 0 when there is an error.
size_t GetThreadCount() {
- const string filename =
+ const std::string filename =
(Message() << "/proc/" << getpid() << "/stat").GetString();
return ReadProcFileField<int>(filename, 19);
}
@@ -1041,39 +1041,6 @@ std::string GetCapturedStderr() {
#endif // GTEST_HAS_STREAM_REDIRECTION
-std::string TempDir() {
-#if GTEST_OS_WINDOWS_MOBILE
- return "\\temp\\";
-#elif GTEST_OS_WINDOWS
- const char* temp_dir = posix::GetEnv("TEMP");
- if (temp_dir == NULL || temp_dir[0] == '\0')
- return "\\temp\\";
- else if (temp_dir[strlen(temp_dir) - 1] == '\\')
- return temp_dir;
- else
- return std::string(temp_dir) + "\\";
-#elif GTEST_OS_LINUX_ANDROID
- // Android doesn't have /tmp, and /sdcard is no longer accessible from
- // app context starting from Android O. On Android, /data/local/tmp
- // is usually used as the temporary directory. But processes running
- // in app context can't write to /data/local/tmp, so also try the
- // current directory.
- if (access("/data/local/tmp", R_OK | W_OK | X_OK) == 0) {
- return "/data/local/tmp/";
- }
- std::string result = "./";
- char* cwd = getcwd(NULL, 0);
- if (cwd != NULL) {
- result = cwd;
- result += "/";
- free(cwd);
- }
- return result;
-#else
- return "/tmp/";
-#endif // GTEST_OS_WINDOWS_MOBILE
-}
-
size_t GetFileSize(FILE* file) {
fseek(file, 0, SEEK_END);
return static_cast<size_t>(ftell(file));
@@ -1227,13 +1194,33 @@ Int32 Int32FromGTestEnv(const char* flag, Int32 default_value) {
// Reads and returns the string environment variable corresponding to
// the given flag; if it's not set, returns default_value.
-const char* StringFromGTestEnv(const char* flag, const char* default_value) {
+std::string StringFromGTestEnv(const char* flag, const char* default_value) {
#if defined(GTEST_GET_STRING_FROM_ENV_)
return GTEST_GET_STRING_FROM_ENV_(flag, default_value);
#endif // defined(GTEST_GET_STRING_FROM_ENV_)
const std::string env_var = FlagToEnvVar(flag);
- const char* const value = posix::GetEnv(env_var.c_str());
- return value == NULL ? default_value : value;
+ const char* value = posix::GetEnv(env_var.c_str());
+ if (value != NULL) {
+ return value;
+ }
+
+ // As a special case for the 'output' flag, if GTEST_OUTPUT is not
+ // set, we look for XML_OUTPUT_FILE, which is set by the Bazel build
+ // system. The value of XML_OUTPUT_FILE is a filename without the
+ // "xml:" prefix of GTEST_OUTPUT.
+ //
+ // The net priority order after flag processing is thus:
+ // --gtest_output command line flag
+ // GTEST_OUTPUT environment variable
+ // XML_OUTPUT_FILE environment variable
+ // 'default_value'
+ if (strcmp(flag, "output") == 0) {
+ value = posix::GetEnv("XML_OUTPUT_FILE");
+ if (value != NULL) {
+ return std::string("xml:") + value;
+ }
+ }
+ return default_value;
}
} // namespace internal
diff --git a/googletest/src/gtest.cc b/googletest/src/gtest.cc
index 4170e5c7..3a18f25d 100644
--- a/googletest/src/gtest.cc
+++ b/googletest/src/gtest.cc
@@ -633,7 +633,7 @@ AssertionResult HasOneFailure(const char* /* results_expr */,
const char* /* substr_expr */,
const TestPartResultArray& results,
TestPartResult::Type type,
- const string& substr) {
+ const std::string& substr) {
const std::string expected(type == TestPartResult::kFatalFailure ?
"1 fatal failure" :
"1 non-fatal failure");
@@ -667,13 +667,10 @@ AssertionResult HasOneFailure(const char* /* results_expr */,
// The constructor of SingleFailureChecker remembers where to look up
// test part results, what type of failure we expect, and what
// substring the failure message should contain.
-SingleFailureChecker:: SingleFailureChecker(
- const TestPartResultArray* results,
- TestPartResult::Type type,
- const string& substr)
- : results_(results),
- type_(type),
- substr_(substr) {}
+SingleFailureChecker::SingleFailureChecker(const TestPartResultArray* results,
+ TestPartResult::Type type,
+ const std::string& substr)
+ : results_(results), type_(type), substr_(substr) {}
// The destructor of SingleFailureChecker verifies that the given
// TestPartResultArray contains exactly one failure that has the given
@@ -1301,41 +1298,41 @@ std::vector<std::string> SplitEscapedString(const std::string& str) {
// and their values, as strings. For example, for ASSERT_EQ(foo, bar)
// where foo is 5 and bar is 6, we have:
//
-// expected_expression: "foo"
-// actual_expression: "bar"
-// expected_value: "5"
-// actual_value: "6"
+// lhs_expression: "foo"
+// rhs_expression: "bar"
+// lhs_value: "5"
+// rhs_value: "6"
//
// The ignoring_case parameter is true iff the assertion is a
-// *_STRCASEEQ*. When it's true, the string " (ignoring case)" will
+// *_STRCASEEQ*. When it's true, the string "Ignoring case" will
// be inserted into the message.
-AssertionResult EqFailure(const char* expected_expression,
- const char* actual_expression,
- const std::string& expected_value,
- const std::string& actual_value,
+AssertionResult EqFailure(const char* lhs_expression,
+ const char* rhs_expression,
+ const std::string& lhs_value,
+ const std::string& rhs_value,
bool ignoring_case) {
Message msg;
- msg << "Value of: " << actual_expression;
- if (actual_value != actual_expression) {
- msg << "\n Actual: " << actual_value;
+ msg << " Expected: " << lhs_expression;
+ if (lhs_value != lhs_expression) {
+ msg << "\n Which is: " << lhs_value;
+ }
+ msg << "\nTo be equal to: " << rhs_expression;
+ if (rhs_value != rhs_expression) {
+ msg << "\n Which is: " << rhs_value;
}
- msg << "\nExpected: " << expected_expression;
if (ignoring_case) {
- msg << " (ignoring case)";
- }
- if (expected_value != expected_expression) {
- msg << "\nWhich is: " << expected_value;
+ msg << "\nIgnoring case";
}
- if (!expected_value.empty() && !actual_value.empty()) {
- const std::vector<std::string> expected_lines =
- SplitEscapedString(expected_value);
- const std::vector<std::string> actual_lines =
- SplitEscapedString(actual_value);
- if (expected_lines.size() > 1 || actual_lines.size() > 1) {
+ if (!lhs_value.empty() && !rhs_value.empty()) {
+ const std::vector<std::string> lhs_lines =
+ SplitEscapedString(lhs_value);
+ const std::vector<std::string> rhs_lines =
+ SplitEscapedString(rhs_value);
+ if (lhs_lines.size() > 1 || rhs_lines.size() > 1) {
msg << "\nWith diff:\n"
- << edit_distance::CreateUnifiedDiff(expected_lines, actual_lines);
+ << edit_distance::CreateUnifiedDiff(lhs_lines, rhs_lines);
}
}
@@ -1434,18 +1431,18 @@ namespace internal {
// The helper function for {ASSERT|EXPECT}_EQ with int or enum
// arguments.
-AssertionResult CmpHelperEQ(const char* expected_expression,
- const char* actual_expression,
- BiggestInt expected,
- BiggestInt actual) {
- if (expected == actual) {
+AssertionResult CmpHelperEQ(const char* lhs_expression,
+ const char* rhs_expression,
+ BiggestInt lhs,
+ BiggestInt rhs) {
+ if (lhs == rhs) {
return AssertionSuccess();
}
- return EqFailure(expected_expression,
- actual_expression,
- FormatForComparisonFailureMessage(expected, actual),
- FormatForComparisonFailureMessage(actual, expected),
+ return EqFailure(lhs_expression,
+ rhs_expression,
+ FormatForComparisonFailureMessage(lhs, rhs),
+ FormatForComparisonFailureMessage(rhs, lhs),
false);
}
@@ -1484,34 +1481,34 @@ GTEST_IMPL_CMP_HELPER_(GT, > )
#undef GTEST_IMPL_CMP_HELPER_
// The helper function for {ASSERT|EXPECT}_STREQ.
-AssertionResult CmpHelperSTREQ(const char* expected_expression,
- const char* actual_expression,
- const char* expected,
- const char* actual) {
- if (String::CStringEquals(expected, actual)) {
+AssertionResult CmpHelperSTREQ(const char* lhs_expression,
+ const char* rhs_expression,
+ const char* lhs,
+ const char* rhs) {
+ if (String::CStringEquals(lhs, rhs)) {
return AssertionSuccess();
}
- return EqFailure(expected_expression,
- actual_expression,
- PrintToString(expected),
- PrintToString(actual),
+ return EqFailure(lhs_expression,
+ rhs_expression,
+ PrintToString(lhs),
+ PrintToString(rhs),
false);
}
// The helper function for {ASSERT|EXPECT}_STRCASEEQ.
-AssertionResult CmpHelperSTRCASEEQ(const char* expected_expression,
- const char* actual_expression,
- const char* expected,
- const char* actual) {
- if (String::CaseInsensitiveCStringEquals(expected, actual)) {
+AssertionResult CmpHelperSTRCASEEQ(const char* lhs_expression,
+ const char* rhs_expression,
+ const char* lhs,
+ const char* rhs) {
+ if (String::CaseInsensitiveCStringEquals(lhs, rhs)) {
return AssertionSuccess();
}
- return EqFailure(expected_expression,
- actual_expression,
- PrintToString(expected),
- PrintToString(actual),
+ return EqFailure(lhs_expression,
+ rhs_expression,
+ PrintToString(lhs),
+ PrintToString(rhs),
true);
}
@@ -1866,18 +1863,18 @@ bool String::WideCStringEquals(const wchar_t * lhs, const wchar_t * rhs) {
}
// Helper function for *_STREQ on wide strings.
-AssertionResult CmpHelperSTREQ(const char* expected_expression,
- const char* actual_expression,
- const wchar_t* expected,
- const wchar_t* actual) {
- if (String::WideCStringEquals(expected, actual)) {
+AssertionResult CmpHelperSTREQ(const char* lhs_expression,
+ const char* rhs_expression,
+ const wchar_t* lhs,
+ const wchar_t* rhs) {
+ if (String::WideCStringEquals(lhs, rhs)) {
return AssertionSuccess();
}
- return EqFailure(expected_expression,
- actual_expression,
- PrintToString(expected),
- PrintToString(actual),
+ return EqFailure(lhs_expression,
+ rhs_expression,
+ PrintToString(lhs),
+ PrintToString(rhs),
false);
}
@@ -2930,6 +2927,8 @@ bool ShouldUseColor(bool stdout_is_tty) {
String::CStringEquals(term, "xterm-256color") ||
String::CStringEquals(term, "screen") ||
String::CStringEquals(term, "screen-256color") ||
+ String::CStringEquals(term, "tmux") ||
+ String::CStringEquals(term, "tmux-256color") ||
String::CStringEquals(term, "rxvt-unicode") ||
String::CStringEquals(term, "rxvt-unicode-256color") ||
String::CStringEquals(term, "linux") ||
@@ -2951,6 +2950,7 @@ bool ShouldUseColor(bool stdout_is_tty) {
// cannot simply emit special characters and have the terminal change colors.
// This routine must actually emit the characters rather than return a string
// that would be colored when printed, as can be done on Linux.
+GTEST_ATTRIBUTE_PRINTF_(2, 3)
void ColoredPrintf(GTestColor color, const char* fmt, ...) {
va_list args;
va_start(args, fmt);
@@ -3651,13 +3651,14 @@ void XmlUnitTestResultPrinter::OutputXmlTestInfo(::std::ostream* stream,
if (++failures == 1) {
*stream << ">\n";
}
- const string location = internal::FormatCompilerIndependentFileLocation(
- part.file_name(), part.line_number());
- const string summary = location + "\n" + part.summary();
+ const std::string location =
+ internal::FormatCompilerIndependentFileLocation(part.file_name(),
+ part.line_number());
+ const std::string summary = location + "\n" + part.summary();
*stream << " <failure message=\""
<< EscapeXmlAttribute(summary.c_str())
<< "\" type=\"\">";
- const string detail = location + "\n" + part.message();
+ const std::string detail = location + "\n" + part.message();
OutputXmlCDataSection(stream, RemoveInvalidXmlCharacters(detail).c_str());
*stream << "</failure>\n";
}
@@ -3756,8 +3757,8 @@ std::string XmlUnitTestResultPrinter::TestPropertiesAsXmlAttributes(
// example, replaces "=" with "%3D". This algorithm is O(strlen(str))
// in both time and space -- important as the input str may contain an
// arbitrarily long test failure message and stack trace.
-string StreamingListener::UrlEncode(const char* str) {
- string result;
+std::string StreamingListener::UrlEncode(const char* str) {
+ std::string result;
result.reserve(strlen(str) + 1);
for (char ch = *str; ch != '\0'; ch = *++str) {
switch (ch) {
@@ -3845,8 +3846,8 @@ ScopedTrace::~ScopedTrace()
const char* const OsStackTraceGetterInterface::kElidedFramesMarker =
"... " GTEST_NAME_ " internal frames ...";
-string OsStackTraceGetter::CurrentStackTrace(int /*max_depth*/,
- int /*skip_count*/) {
+std::string OsStackTraceGetter::CurrentStackTrace(int /*max_depth*/,
+ int /*skip_count*/) {
return "";
}
@@ -4727,7 +4728,7 @@ bool ShouldShard(const char* total_shards_env,
<< "Invalid environment variables: you have "
<< kTestShardIndex << " = " << shard_index
<< ", but have left " << kTestTotalShards << " unset.\n";
- ColoredPrintf(COLOR_RED, msg.GetString().c_str());
+ ColoredPrintf(COLOR_RED, "%s", msg.GetString().c_str());
fflush(stdout);
exit(EXIT_FAILURE);
} else if (total_shards != -1 && shard_index == -1) {
@@ -4735,7 +4736,7 @@ bool ShouldShard(const char* total_shards_env,
<< "Invalid environment variables: you have "
<< kTestTotalShards << " = " << total_shards
<< ", but have left " << kTestShardIndex << " unset.\n";
- ColoredPrintf(COLOR_RED, msg.GetString().c_str());
+ ColoredPrintf(COLOR_RED, "%s", msg.GetString().c_str());
fflush(stdout);
exit(EXIT_FAILURE);
} else if (shard_index < 0 || shard_index >= total_shards) {
@@ -4744,7 +4745,7 @@ bool ShouldShard(const char* total_shards_env,
<< kTestShardIndex << " < " << kTestTotalShards
<< ", but you have " << kTestShardIndex << "=" << shard_index
<< ", " << kTestTotalShards << "=" << total_shards << ".\n";
- ColoredPrintf(COLOR_RED, msg.GetString().c_str());
+ ColoredPrintf(COLOR_RED, "%s", msg.GetString().c_str());
fflush(stdout);
exit(EXIT_FAILURE);
}
@@ -5383,4 +5384,25 @@ void InitGoogleTest(int* argc, wchar_t** argv) {
#endif // defined(GTEST_CUSTOM_INIT_GOOGLE_TEST_FUNCTION_)
}
+std::string TempDir() {
+#if defined(GTEST_CUSTOM_TEMPDIR_FUNCTION_)
+ return GTEST_CUSTOM_TEMPDIR_FUNCTION_();
+#endif
+#if GTEST_OS_WINDOWS_MOBILE
+ return "\\temp\\";
+#elif GTEST_OS_WINDOWS
+ const char* temp_dir = internal::posix::GetEnv("TEMP");
+ if (temp_dir == NULL || temp_dir[0] == '\0')
+ return "\\temp\\";
+ else if (temp_dir[strlen(temp_dir) - 1] == '\\')
+ return temp_dir;
+ else
+ return std::string(temp_dir) + "\\";
+#elif GTEST_OS_LINUX_ANDROID
+ return "/sdcard/";
+#else
+ return "/tmp/";
+#endif // GTEST_OS_WINDOWS_MOBILE
+}
+
} // namespace testing
diff --git a/googletest/test/gtest-death-test_test.cc b/googletest/test/gtest-death-test_test.cc
index bb4a3d1b..957fe382 100644
--- a/googletest/test/gtest-death-test_test.cc
+++ b/googletest/test/gtest-death-test_test.cc
@@ -505,7 +505,7 @@ TEST_F(TestForDeathTest, AcceptsAnythingConvertibleToRE) {
# if GTEST_HAS_GLOBAL_STRING
- const string regex_str(regex_c_str);
+ const ::string regex_str(regex_c_str);
EXPECT_DEATH(GlobalFunction(), regex_str);
# endif // GTEST_HAS_GLOBAL_STRING
diff --git a/googletest/test/gtest-port_test.cc b/googletest/test/gtest-port_test.cc
index 6ea607bc..c5067a40 100644
--- a/googletest/test/gtest-port_test.cc
+++ b/googletest/test/gtest-port_test.cc
@@ -1295,9 +1295,16 @@ TEST(WindowsTypesTest, HANDLEIsVoidStar) {
StaticAssertTypeEq<HANDLE, void*>();
}
+#if GTEST_OS_WINDOWS_MINGW && !defined(__MINGW64_VERSION_MAJOR)
+TEST(WindowsTypesTest, _CRITICAL_SECTIONIs_CRITICAL_SECTION) {
+ StaticAssertTypeEq<CRITICAL_SECTION, _CRITICAL_SECTION>();
+}
+#else
TEST(WindowsTypesTest, CRITICAL_SECTIONIs_RTL_CRITICAL_SECTION) {
StaticAssertTypeEq<CRITICAL_SECTION, _RTL_CRITICAL_SECTION>();
}
+#endif
+
#endif // GTEST_OS_WINDOWS
} // namespace internal
diff --git a/googletest/test/gtest-printers_test.cc b/googletest/test/gtest-printers_test.cc
index 3e97cc24..b0a83410 100644
--- a/googletest/test/gtest-printers_test.cc
+++ b/googletest/test/gtest-printers_test.cc
@@ -211,9 +211,12 @@ using ::testing::internal::Strings;
using ::testing::internal::UniversalPrint;
using ::testing::internal::UniversalPrinter;
using ::testing::internal::UniversalTersePrint;
+#if GTEST_HAS_TR1_TUPLE || GTEST_HAS_STD_TUPLE_
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 ::.
@@ -228,11 +231,12 @@ using ::stdext::hash_set;
using ::stdext::hash_multimap;
using ::stdext::hash_multiset;
#endif
+#endif
// Prints a value to a string using the universal value printer. This
// is a helper for testing UniversalPrinter<T>::Print() for various types.
template <typename T>
-string Print(const T& value) {
+std::string Print(const T& value) {
::std::stringstream ss;
UniversalPrinter<T>::Print(value, &ss);
return ss.str();
@@ -242,7 +246,7 @@ string Print(const T& value) {
// value printer. This is a helper for testing
// UniversalPrinter<T&>::Print() for various types.
template <typename T>
-string PrintByRef(const T& value) {
+std::string PrintByRef(const T& value) {
::std::stringstream ss;
UniversalPrinter<T&>::Print(value, &ss);
return ss.str();
@@ -379,7 +383,7 @@ TEST(PrintBuiltInTypeTest, FloatingPoints) {
// Since ::std::stringstream::operator<<(const void *) formats the pointer
// output differently with different compilers, we have to create the expected
// output first and use it as our expectation.
-static string PrintPointer(const void *p) {
+static std::string PrintPointer(const void* p) {
::std::stringstream expected_result_stream;
expected_result_stream << p;
return expected_result_stream.str();
@@ -592,7 +596,7 @@ TEST(PrintPointerTest, MemberFunctionPointer) {
// The difference between this and Print() is that it ensures that the
// argument is a reference to an array.
template <typename T, size_t N>
-string PrintArrayHelper(T (&a)[N]) {
+std::string PrintArrayHelper(T (&a)[N]) {
return Print(a);
}
@@ -645,7 +649,7 @@ TEST(PrintArrayTest, WConstCharArrayWithTerminatingNul) {
// Array of objects.
TEST(PrintArrayTest, ObjectArray) {
- string a[3] = { "Hi", "Hello", "Ni hao" };
+ std::string a[3] = {"Hi", "Hello", "Ni hao"};
EXPECT_EQ("{ \"Hi\", \"Hello\", \"Ni hao\" }", PrintArrayHelper(a));
}
@@ -827,7 +831,7 @@ TEST(PrintStlContainerTest, HashMultiMap) {
map1.insert(make_pair(5, false));
// Elements of hash_multimap can be printed in any order.
- const string result = Print(map1);
+ const std::string result = Print(map1);
EXPECT_TRUE(result == "{ (5, true), (5, false) }" ||
result == "{ (5, false), (5, true) }")
<< " where Print(map1) returns \"" << result << "\".";
@@ -838,9 +842,9 @@ TEST(PrintStlContainerTest, HashMultiMap) {
#if GTEST_HAS_HASH_SET_
TEST(PrintStlContainerTest, HashSet) {
- hash_set<string> set1;
- set1.insert("hello");
- EXPECT_EQ("{ \"hello\" }", Print(set1));
+ hash_set<int> set1;
+ set1.insert(1);
+ EXPECT_EQ("{ 1 }", Print(set1));
}
TEST(PrintStlContainerTest, HashMultiSet) {
@@ -849,8 +853,8 @@ TEST(PrintStlContainerTest, HashMultiSet) {
hash_multiset<int> set1(a, a + kSize);
// Elements of hash_multiset can be printed in any order.
- const string result = Print(set1);
- const string expected_pattern = "{ d, d, d, d, d }"; // d means a digit.
+ const std::string result = Print(set1);
+ const std::string expected_pattern = "{ d, d, d, d, d }"; // d means a digit.
// Verifies the result matches the expected pattern; also extracts
// the numbers in the result.
@@ -875,11 +879,8 @@ TEST(PrintStlContainerTest, HashMultiSet) {
#endif // GTEST_HAS_HASH_SET_
TEST(PrintStlContainerTest, List) {
- const string a[] = {
- "hello",
- "world"
- };
- const list<string> strings(a, a + 2);
+ const std::string a[] = {"hello", "world"};
+ const list<std::string> strings(a, a + 2);
EXPECT_EQ("{ \"hello\", \"world\" }", Print(strings));
}
@@ -1035,9 +1036,10 @@ TEST(PrintTr1TupleTest, VariousSizes) {
// VC++ 2010's implementation of tuple of C++0x is deficient, requiring
// an explicit type cast of NULL to be used.
::std::tr1::tuple<bool, char, short, testing::internal::Int32, // NOLINT
- testing::internal::Int64, float, double, const char*, void*, string>
- t10(false, 'a', 3, 4, 5, 1.5F, -2.5, str,
- ImplicitCast_<void*>(NULL), "10");
+ 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");
EXPECT_EQ("(false, 'a' (97, 0x61), 3, 4, 5, 1.5, -2.5, " + PrintPointer(str) +
" pointing to \"8\", NULL, \"10\")",
Print(t10));
@@ -1094,9 +1096,10 @@ TEST(PrintStdTupleTest, VariousSizes) {
// VC++ 2010's implementation of tuple of C++0x is deficient, requiring
// an explicit type cast of NULL to be used.
::std::tuple<bool, char, short, testing::internal::Int32, // NOLINT
- testing::internal::Int64, float, double, const char*, void*, string>
- t10(false, 'a', 3, 4, 5, 1.5F, -2.5, str,
- ImplicitCast_<void*>(NULL), "10");
+ 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");
EXPECT_EQ("(false, 'a' (97, 0x61), 3, 4, 5, 1.5, -2.5, " + PrintPointer(str) +
" pointing to \"8\", NULL, \"10\")",
Print(t10));
@@ -1200,13 +1203,13 @@ TEST(PrintReferenceTest, PrintsAddressAndValue) {
// reference.
TEST(PrintReferenceTest, HandlesFunctionPointer) {
void (*fp)(int n) = &MyFunction;
- const string fp_pointer_string =
+ const std::string fp_pointer_string =
PrintPointer(reinterpret_cast<const void*>(&fp));
// We cannot directly cast &MyFunction to const void* because the
// standard disallows casting between pointers to functions and
// pointers to objects, and some compilers (e.g. GCC 3.4) enforce
// this limitation.
- const string fp_string = PrintPointer(reinterpret_cast<const void*>(
+ const std::string fp_string = PrintPointer(reinterpret_cast<const void*>(
reinterpret_cast<internal::BiggestInt>(fp)));
EXPECT_EQ("@" + fp_pointer_string + " " + fp_string,
PrintByRef(fp));
@@ -1538,12 +1541,12 @@ TEST(UniversalPrintTest, WorksForCString) {
const char* s1 = "abc";
::std::stringstream ss1;
UniversalPrint(s1, &ss1);
- EXPECT_EQ(PrintPointer(s1) + " pointing to \"abc\"", string(ss1.str()));
+ EXPECT_EQ(PrintPointer(s1) + " pointing to \"abc\"", std::string(ss1.str()));
char* s2 = const_cast<char*>(s1);
::std::stringstream ss2;
UniversalPrint(s2, &ss2);
- EXPECT_EQ(PrintPointer(s2) + " pointing to \"abc\"", string(ss2.str()));
+ EXPECT_EQ(PrintPointer(s2) + " pointing to \"abc\"", std::string(ss2.str()));
const char* s3 = NULL;
::std::stringstream ss3;
@@ -1632,4 +1635,3 @@ TEST(UniversalTersePrintTupleFieldsToStringsTestWithStd, PrintsTersely) {
} // namespace gtest_printers_test
} // namespace testing
-
diff --git a/googletest/test/gtest_catch_exceptions_test_.cc b/googletest/test/gtest_catch_exceptions_test_.cc
index d0fc82c9..b42637ec 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
+#if !defined(__GXX_EXPERIMENTAL_CXX0X__) && __cplusplus < 201103L && _MSC_VER < 1900
class CxxExceptionInDestructorTest : public Test {
public:
static void TearDownTestCase() {
diff --git a/googletest/test/gtest_env_var_test.py b/googletest/test/gtest_env_var_test.py
index ac24337f..424075cf 100755
--- a/googletest/test/gtest_env_var_test.py
+++ b/googletest/test/gtest_env_var_test.py
@@ -47,8 +47,8 @@ environ = os.environ.copy()
def AssertEq(expected, actual):
if expected != actual:
- print 'Expected: %s' % (expected,)
- print ' Actual: %s' % (actual,)
+ print('Expected: %s' % (expected,))
+ print(' Actual: %s' % (actual,))
raise AssertionError
@@ -87,6 +87,7 @@ class GTestEnvVarTest(gtest_test_utils.TestCase):
TestFlag('break_on_failure', '1', '0')
TestFlag('color', 'yes', 'auto')
TestFlag('filter', 'FooTest.Bar', '*')
+ SetEnvVar('XML_OUTPUT_FILE', None) # For 'output' test
TestFlag('output', 'xml:tmp/foo.xml', '')
TestFlag('print_time', '0', '1')
TestFlag('repeat', '999', '1')
@@ -98,6 +99,19 @@ class GTestEnvVarTest(gtest_test_utils.TestCase):
TestFlag('death_test_use_fork', '1', '0')
TestFlag('stack_trace_depth', '0', '100')
+ def testXmlOutputFile(self):
+ """Tests that $XML_OUTPUT_FILE affects the output flag."""
+
+ SetEnvVar('GTEST_OUTPUT', None)
+ SetEnvVar('XML_OUTPUT_FILE', 'tmp/bar.xml')
+ AssertEq('xml:tmp/bar.xml', GetFlag('output'))
+
+ def testXmlOutputFileOverride(self):
+ """Tests that $XML_OUTPUT_FILE is overridden by $GTEST_OUTPUT"""
+
+ SetEnvVar('GTEST_OUTPUT', 'xml:tmp/foo.xml')
+ SetEnvVar('XML_OUTPUT_FILE', 'tmp/bar.xml')
+ AssertEq('xml:tmp/foo.xml', GetFlag('output'))
if __name__ == '__main__':
gtest_test_utils.Main()
diff --git a/googletest/test/gtest_filter_unittest.py b/googletest/test/gtest_filter_unittest.py
index 0d1a7700..ec0b151b 100755
--- a/googletest/test/gtest_filter_unittest.py
+++ b/googletest/test/gtest_filter_unittest.py
@@ -44,7 +44,10 @@ __author__ = 'wan@google.com (Zhanyong Wan)'
import os
import re
-import sets
+try:
+ from sets import Set as set # For Python 2.3 compatibility
+except ImportError:
+ pass
import sys
import gtest_test_utils
@@ -58,7 +61,7 @@ import gtest_test_utils
# exception is thrown if the input is anything other than 'True' nor 'False'.
os.environ['EMPTY_VAR'] = ''
child = gtest_test_utils.Subprocess(
- [sys.executable, '-c', 'import os; print \'EMPTY_VAR\' in os.environ'])
+ [sys.executable, '-c', 'import os; print(\'EMPTY_VAR\' in os.environ)'])
CAN_PASS_EMPTY_ENV = eval(child.output)
@@ -71,7 +74,7 @@ CAN_PASS_EMPTY_ENV = eval(child.output)
os.environ['UNSET_VAR'] = 'X'
del os.environ['UNSET_VAR']
child = gtest_test_utils.Subprocess(
- [sys.executable, '-c', 'import os; print \'UNSET_VAR\' not in os.environ'])
+ [sys.executable, '-c', 'import os; print(\'UNSET_VAR\' not in os.environ)'])
CAN_UNSET_ENV = eval(child.output)
@@ -243,14 +246,14 @@ class GTestFilterUnitTest(gtest_test_utils.TestCase):
for slice_var in list_of_sets:
full_partition.extend(slice_var)
self.assertEqual(len(set_var), len(full_partition))
- self.assertEqual(sets.Set(set_var), sets.Set(full_partition))
+ self.assertEqual(set(set_var), set(full_partition))
def AdjustForParameterizedTests(self, tests_to_run):
"""Adjust tests_to_run in case value parameterized tests are disabled."""
global param_tests_present
if not param_tests_present:
- return list(sets.Set(tests_to_run) - sets.Set(PARAM_TESTS))
+ return list(set(tests_to_run) - set(PARAM_TESTS))
else:
return tests_to_run
diff --git a/googletest/test/gtest_list_tests_unittest.py b/googletest/test/gtest_list_tests_unittest.py
index 925b09d9..f2d2fd1b 100755
--- a/googletest/test/gtest_list_tests_unittest.py
+++ b/googletest/test/gtest_list_tests_unittest.py
@@ -71,7 +71,7 @@ FooTest\.
TypedTest/0\. # TypeParam = (VeryLo{245}|class VeryLo{239})\.\.\.
TestA
TestB
-TypedTest/1\. # TypeParam = int\s*\*
+TypedTest/1\. # TypeParam = int\s*\*( __ptr64)?
TestA
TestB
TypedTest/2\. # TypeParam = .*MyArray<bool,\s*42>
@@ -80,7 +80,7 @@ TypedTest/2\. # TypeParam = .*MyArray<bool,\s*42>
My/TypeParamTest/0\. # TypeParam = (VeryLo{245}|class VeryLo{239})\.\.\.
TestA
TestB
-My/TypeParamTest/1\. # TypeParam = int\s*\*
+My/TypeParamTest/1\. # TypeParam = int\s*\*( __ptr64)?
TestA
TestB
My/TypeParamTest/2\. # TypeParam = .*MyArray<bool,\s*42>
diff --git a/googletest/test/gtest_output_test.py b/googletest/test/gtest_output_test.py
index d5c637b4..06dbee09 100755
--- a/googletest/test/gtest_output_test.py
+++ b/googletest/test/gtest_output_test.py
@@ -279,7 +279,7 @@ class GTestOutputTest(gtest_test_utils.TestCase):
def testOutput(self):
output = GetOutputOfAllCommands()
- golden_file = open(GOLDEN_PATH, 'rb')
+ golden_file = open(GOLDEN_PATH, 'r')
# A mis-configured source control system can cause \r appear in EOL
# sequences when we read the golden file irrespective of an operating
# system used. Therefore, we need to strip those \r's from newlines
diff --git a/googletest/test/gtest_output_test_golden_lin.txt b/googletest/test/gtest_output_test_golden_lin.txt
index 7fff8530..2223d560 100644
--- a/googletest/test/gtest_output_test_golden_lin.txt
+++ b/googletest/test/gtest_output_test_golden_lin.txt
@@ -5,8 +5,8 @@ Value of: false
Actual: false
Expected: true
gtest_output_test_.cc:#: Failure
-Value of: 3
-Expected: 2
+ Expected: 2
+To be equal to: 3
[==========] Running 66 tests from 29 test cases.
[----------] Global test environment set-up.
FooEnvironment::SetUp() called.
@@ -34,21 +34,21 @@ BarEnvironment::SetUp() called.
[----------] 2 tests from NonfatalFailureTest
[ RUN ] NonfatalFailureTest.EscapesStringOperands
gtest_output_test_.cc:#: Failure
-Value of: actual
- Actual: "actual \"string\""
-Expected: kGoldenString
-Which is: "\"Line"
+ Expected: kGoldenString
+ Which is: "\"Line"
+To be equal to: actual
+ Which is: "actual \"string\""
gtest_output_test_.cc:#: Failure
-Value of: actual
- Actual: "actual \"string\""
-Expected: golden
-Which is: "\"Line"
+ Expected: golden
+ Which is: "\"Line"
+To be equal to: actual
+ Which is: "actual \"string\""
[ FAILED ] NonfatalFailureTest.EscapesStringOperands
[ RUN ] NonfatalFailureTest.DiffForLongStrings
gtest_output_test_.cc:#: Failure
-Value of: "Line 2"
-Expected: golden_str
-Which is: "\"Line\0 1\"\nLine 2"
+ Expected: golden_str
+ Which is: "\"Line\0 1\"\nLine 2"
+To be equal to: "Line 2"
With diff:
@@ -1,2 @@
-\"Line\0 1\"
@@ -59,16 +59,16 @@ With diff:
[ RUN ] FatalFailureTest.FatalFailureInSubroutine
(expecting a failure that x should be 1)
gtest_output_test_.cc:#: Failure
-Value of: x
- Actual: 2
-Expected: 1
+ Expected: 1
+To be equal to: x
+ Which is: 2
[ FAILED ] FatalFailureTest.FatalFailureInSubroutine
[ RUN ] FatalFailureTest.FatalFailureInNestedSubroutine
(expecting a failure that x should be 1)
gtest_output_test_.cc:#: Failure
-Value of: x
- Actual: 2
-Expected: 1
+ Expected: 1
+To be equal to: x
+ Which is: 2
[ FAILED ] FatalFailureTest.FatalFailureInNestedSubroutine
[ RUN ] FatalFailureTest.NonfatalFailureInSubroutine
(expecting a failure on false)
@@ -107,39 +107,39 @@ This failure is expected, and shouldn't have a trace.
[ RUN ] SCOPED_TRACETest.WorksInLoop
(expected to fail)
gtest_output_test_.cc:#: Failure
-Value of: n
- Actual: 1
-Expected: 2
+ Expected: 2
+To be equal to: n
+ Which is: 1
Google Test trace:
gtest_output_test_.cc:#: i = 1
gtest_output_test_.cc:#: Failure
-Value of: n
- Actual: 2
-Expected: 1
+ Expected: 1
+To be equal to: 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
-Value of: n
- Actual: 1
-Expected: 2
+ Expected: 2
+To be equal to: n
+ Which is: 1
Google Test trace:
gtest_output_test_.cc:#: n = 1
gtest_output_test_.cc:#: Failure
-Value of: n
- Actual: 2
-Expected: 1
+ Expected: 1
+To be equal to: 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
-Value of: n
- Actual: 2
-Expected: 1
+ Expected: 1
+To be equal to: n
+ Which is: 2
Google Test trace:
gtest_output_test_.cc:#: n = 2
gtest_output_test_.cc:#:
@@ -437,9 +437,9 @@ Expected: 1 fatal failure
[ OK ] TypedTest/0.Success
[ RUN ] TypedTest/0.Failure
gtest_output_test_.cc:#: Failure
-Value of: TypeParam()
- Actual: 0
-Expected: 1
+ Expected: 1
+To be equal to: 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 +447,10 @@ Expected failure
[ OK ] Unsigned/TypedTestP/0.Success
[ RUN ] Unsigned/TypedTestP/0.Failure
gtest_output_test_.cc:#: Failure
-Value of: TypeParam()
- Actual: '\0'
-Expected: 1U
-Which is: 1
+ Expected: 1U
+ Which is: 1
+To be equal to: 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 +458,10 @@ Expected failure
[ OK ] Unsigned/TypedTestP/1.Success
[ RUN ] Unsigned/TypedTestP/1.Failure
gtest_output_test_.cc:#: Failure
-Value of: TypeParam()
- Actual: 0
-Expected: 1U
-Which is: 1
+ Expected: 1U
+ Which is: 1
+To be equal to: TypeParam()
+ Which is: 0
Expected failure
[ FAILED ] Unsigned/TypedTestP/1.Failure, where TypeParam = unsigned int
[----------] 4 tests from ExpectFailureTest
@@ -597,18 +597,18 @@ Expected non-fatal failure.
[----------] 1 test from PrintingFailingParams/FailingParamTest
[ RUN ] PrintingFailingParams/FailingParamTest.Fails/0
gtest_output_test_.cc:#: Failure
-Value of: GetParam()
- Actual: 2
-Expected: 1
+ Expected: 1
+To be equal to: 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
-Value of: GetParam()
- Actual: "a"
-Expected: "b"
+ Expected: "b"
+To be equal to: GetParam()
+ Which is: "a"
Expected failure
[ FAILED ] PrintingStrings/ParamTest.Failure/a, where GetParam() = "a"
[----------] Global test environment tear-down
@@ -678,16 +678,16 @@ Expected fatal failure.
[ RUN ] FatalFailureTest.FatalFailureInSubroutine
(expecting a failure that x should be 1)
gtest_output_test_.cc:#: Failure
-Value of: x
- Actual: 2
-Expected: 1
+ Expected: 1
+To be equal to: x
+ Which is: 2
[ FAILED ] FatalFailureTest.FatalFailureInSubroutine (? ms)
[ RUN ] FatalFailureTest.FatalFailureInNestedSubroutine
(expecting a failure that x should be 1)
gtest_output_test_.cc:#: Failure
-Value of: x
- Actual: 2
-Expected: 1
+ Expected: 1
+To be equal to: x
+ Which is: 2
[ FAILED ] FatalFailureTest.FatalFailureInNestedSubroutine (? ms)
[ RUN ] FatalFailureTest.NonfatalFailureInSubroutine
(expecting a failure on false)
diff --git a/googletest/test/gtest_test_utils.py b/googletest/test/gtest_test_utils.py
index 7e3cbcaf..4acd36c9 100755
--- a/googletest/test/gtest_test_utils.py
+++ b/googletest/test/gtest_test_utils.py
@@ -178,7 +178,7 @@ def GetTestExecutablePath(executable_name, build_dir=None):
'Unable to find the test binary "%s". Please make sure to provide\n'
'a path to the binary via the --build_dir flag or the BUILD_DIR\n'
'environment variable.' % path)
- print >> sys.stderr, message
+ sys.stdout.write(message)
sys.exit(1)
return path
diff --git a/googletest/test/gtest_throw_on_failure_test.py b/googletest/test/gtest_throw_on_failure_test.py
index 5678ffea..3e7740ca 100755
--- a/googletest/test/gtest_throw_on_failure_test.py
+++ b/googletest/test/gtest_throw_on_failure_test.py
@@ -70,7 +70,7 @@ def SetEnvVar(env_var, value):
def Run(command):
"""Runs a command; returns True/False if its exit code is/isn't 0."""
- print 'Running "%s". . .' % ' '.join(command)
+ print('Running "%s". . .' % ' '.join(command))
p = gtest_test_utils.Subprocess(command)
return p.exited and p.exit_code == 0
diff --git a/googletest/test/gtest_uninitialized_test.py b/googletest/test/gtest_uninitialized_test.py
index 6ae57eee..43583700 100755
--- a/googletest/test/gtest_uninitialized_test.py
+++ b/googletest/test/gtest_uninitialized_test.py
@@ -46,8 +46,8 @@ def Assert(condition):
def AssertEq(expected, actual):
if expected != actual:
- print 'Expected: %s' % (expected,)
- print ' Actual: %s' % (actual,)
+ print('Expected: %s' % (expected,))
+ print(' Actual: %s' % (actual,))
raise AssertionError
diff --git a/googletest/test/gtest_unittest.cc b/googletest/test/gtest_unittest.cc
index 60aed357..7627b880 100644
--- a/googletest/test/gtest_unittest.cc
+++ b/googletest/test/gtest_unittest.cc
@@ -86,9 +86,9 @@ class StreamingListenerTest : public Test {
class FakeSocketWriter : public StreamingListener::AbstractSocketWriter {
public:
// Sends a string to the socket.
- virtual void Send(const string& message) { output_ += message; }
+ virtual void Send(const std::string& message) { output_ += message; }
- string output_;
+ std::string output_;
};
StreamingListenerTest()
@@ -98,7 +98,7 @@ class StreamingListenerTest : public Test {
CodeLocation(__FILE__, __LINE__), 0, NULL) {}
protected:
- string* output() { return &(fake_sock_writer_->output_); }
+ std::string* output() { return &(fake_sock_writer_->output_); }
FakeSocketWriter* const fake_sock_writer_;
StreamingListener streamer_;
@@ -442,7 +442,7 @@ class FormatEpochTimeInMillisAsIso8601Test : public Test {
// tzset() distinguishes between the TZ variable being present and empty
// and not being present, so we have to consider the case of time_zone
// being NULL.
-#if _MSC_VER
+#if _MSC_VER || GTEST_OS_WINDOWS_MINGW
// ...Unless it's MSVC, whose standard library's _putenv doesn't
// distinguish between an empty and a missing variable.
const std::string env_var =
@@ -2466,7 +2466,7 @@ TEST(StringAssertionTest, ASSERT_STRCASEEQ) {
ASSERT_STRCASEEQ("", "");
EXPECT_FATAL_FAILURE(ASSERT_STRCASEEQ("Hi", "hi2"),
- "(ignoring case)");
+ "Ignoring case");
}
// Tests ASSERT_STRCASENE.
@@ -3260,7 +3260,7 @@ TEST_F(SingleEvaluationTest, ASSERT_STR) {
// failed EXPECT_STRCASEEQ
EXPECT_NONFATAL_FAILURE(EXPECT_STRCASEEQ(p1_++, p2_++),
- "ignoring case");
+ "Ignoring case");
EXPECT_EQ(s1_ + 2, p1_);
EXPECT_EQ(s2_ + 2, p2_);
}
@@ -3528,35 +3528,35 @@ TEST(AssertionTest, EqFailure) {
EqFailure("foo", "bar", foo_val, bar_val, false)
.failure_message());
EXPECT_STREQ(
- "Value of: bar\n"
- " Actual: 6\n"
- "Expected: foo\n"
- "Which is: 5",
+ " Expected: foo\n"
+ " Which is: 5\n"
+ "To be equal to: bar\n"
+ " Which is: 6",
msg1.c_str());
const std::string msg2(
EqFailure("foo", "6", foo_val, bar_val, false)
.failure_message());
EXPECT_STREQ(
- "Value of: 6\n"
- "Expected: foo\n"
- "Which is: 5",
+ " Expected: foo\n"
+ " Which is: 5\n"
+ "To be equal to: 6",
msg2.c_str());
const std::string msg3(
EqFailure("5", "bar", foo_val, bar_val, false)
.failure_message());
EXPECT_STREQ(
- "Value of: bar\n"
- " Actual: 6\n"
- "Expected: 5",
+ " Expected: 5\n"
+ "To be equal to: bar\n"
+ " Which is: 6",
msg3.c_str());
const std::string msg4(
EqFailure("5", "6", foo_val, bar_val, false).failure_message());
EXPECT_STREQ(
- "Value of: 6\n"
- "Expected: 5",
+ " Expected: 5\n"
+ "To be equal to: 6",
msg4.c_str());
const std::string msg5(
@@ -3564,10 +3564,11 @@ TEST(AssertionTest, EqFailure) {
std::string("\"x\""), std::string("\"y\""),
true).failure_message());
EXPECT_STREQ(
- "Value of: bar\n"
- " Actual: \"y\"\n"
- "Expected: foo (ignoring case)\n"
- "Which is: \"x\"",
+ " Expected: foo\n"
+ " Which is: \"x\"\n"
+ "To be equal to: bar\n"
+ " Which is: \"y\"\n"
+ "Ignoring case",
msg5.c_str());
}
@@ -3579,11 +3580,11 @@ TEST(AssertionTest, EqFailureWithDiff) {
const std::string msg1(
EqFailure("left", "right", left, right, false).failure_message());
EXPECT_STREQ(
- "Value of: right\n"
- " Actual: 1\\n2\\n3\\n4\\n5\\n6\\n7\\n8\\n9\\n11\\n12\\n13\\n14\n"
- "Expected: left\n"
- "Which is: "
+ " Expected: 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"
"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());
@@ -3678,9 +3679,9 @@ TEST(ExpectTest, ASSERT_EQ_Double) {
TEST(AssertionTest, ASSERT_EQ) {
ASSERT_EQ(5, 2 + 3);
EXPECT_FATAL_FAILURE(ASSERT_EQ(5, 2*3),
- "Value of: 2*3\n"
- " Actual: 6\n"
- "Expected: 5");
+ " Expected: 5\n"
+ "To be equal to: 2*3\n"
+ " Which is: 6");
}
// Tests ASSERT_EQ(NULL, pointer).
@@ -3697,7 +3698,7 @@ TEST(AssertionTest, ASSERT_EQ_NULL) {
// A failure.
static int n = 0;
EXPECT_FATAL_FAILURE(ASSERT_EQ(NULL, &n),
- "Value of: &n\n");
+ "To be equal to: &n\n");
}
#endif // GTEST_CAN_COMPARE_NULL
@@ -3812,7 +3813,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),
- "Value of: x");
+ "To be equal to: x");
}
// An uncopyable class.
@@ -3861,7 +3862,7 @@ TEST(AssertionTest, AssertWorksWithUncopyableObject) {
EXPECT_FATAL_FAILURE(TestAssertNonPositive(),
"IsPositiveUncopyable(y) evaluates to false, where\ny evaluates to -1");
EXPECT_FATAL_FAILURE(TestAssertEqualsUncopyable(),
- "Value of: y\n Actual: -1\nExpected: x\nWhich is: 5");
+ "Expected: x\n Which is: 5\nTo be equal to: y\n Which is: -1");
}
// Tests that uncopyable objects can be used in expects.
@@ -3873,7 +3874,7 @@ TEST(AssertionTest, ExpectWorksWithUncopyableObject) {
"IsPositiveUncopyable(y) evaluates to false, where\ny evaluates to -1");
EXPECT_EQ(x, x);
EXPECT_NONFATAL_FAILURE(EXPECT_EQ(x, y),
- "Value of: y\n Actual: -1\nExpected: x\nWhich is: 5");
+ "Expected: x\n Which is: 5\nTo be equal to: y\n Which is: -1");
}
enum NamedEnum {
@@ -3885,7 +3886,7 @@ TEST(AssertionTest, NamedEnum) {
EXPECT_EQ(kE1, kE1);
EXPECT_LT(kE1, kE2);
EXPECT_NONFATAL_FAILURE(EXPECT_EQ(kE1, kE2), "Which is: 0");
- EXPECT_NONFATAL_FAILURE(EXPECT_EQ(kE1, kE2), "Actual: 1");
+ EXPECT_NONFATAL_FAILURE(EXPECT_EQ(kE1, kE2), "Which is: 1");
}
// The version of gcc used in XCode 2.2 has a bug and doesn't allow
@@ -3949,9 +3950,9 @@ TEST(AssertionTest, AnonymousEnum) {
// ICE's in C++Builder.
EXPECT_FATAL_FAILURE(ASSERT_EQ(kCaseA, kCaseB),
- "Value of: kCaseB");
+ "To be equal to: kCaseB");
EXPECT_FATAL_FAILURE(ASSERT_EQ(kCaseA, kCaseC),
- "Actual: 42");
+ "Which is: 42");
# endif
EXPECT_FATAL_FAILURE(ASSERT_EQ(kCaseA, kCaseC),
@@ -4389,9 +4390,9 @@ TEST(ExpectTest, ExpectFalseWithAssertionResult) {
TEST(ExpectTest, EXPECT_EQ) {
EXPECT_EQ(5, 2 + 3);
EXPECT_NONFATAL_FAILURE(EXPECT_EQ(5, 2*3),
- "Value of: 2*3\n"
- " Actual: 6\n"
- "Expected: 5");
+ " Expected: 5\n"
+ "To be equal to: 2*3\n"
+ " Which is: 6");
EXPECT_NONFATAL_FAILURE(EXPECT_EQ(5, 2 - 3),
"2 - 3");
}
@@ -4422,7 +4423,7 @@ TEST(ExpectTest, EXPECT_EQ_NULL) {
// A failure.
int n = 0;
EXPECT_NONFATAL_FAILURE(EXPECT_EQ(NULL, &n),
- "Value of: &n\n");
+ "To be equal to: &n\n");
}
#endif // GTEST_CAN_COMPARE_NULL
@@ -4538,7 +4539,7 @@ TEST(ExpectTest, EXPECT_ANY_THROW) {
TEST(ExpectTest, ExpectPrecedence) {
EXPECT_EQ(1 < 2, true);
EXPECT_NONFATAL_FAILURE(EXPECT_EQ(true, true && false),
- "Value of: true && false");
+ "To be equal to: true && false");
}
@@ -4685,7 +4686,7 @@ TEST(EqAssertionTest, Bool) {
EXPECT_FATAL_FAILURE({
bool false_value = false;
ASSERT_EQ(false_value, true);
- }, "Value of: true");
+ }, "To be equal to: true");
}
// Tests using int values in {EXPECT|ASSERT}_EQ.
@@ -4719,10 +4720,10 @@ TEST(EqAssertionTest, WideChar) {
EXPECT_EQ(L'b', L'b');
EXPECT_NONFATAL_FAILURE(EXPECT_EQ(L'\0', L'x'),
- "Value of: L'x'\n"
- " Actual: L'x' (120, 0x78)\n"
- "Expected: L'\0'\n"
- "Which is: L'\0' (0, 0x0)");
+ " Expected: L'\0'\n"
+ " Which is: L'\0' (0, 0x0)\n"
+ "To be equal to: L'x'\n"
+ " Which is: L'x' (120, 0x78)");
static wchar_t wchar;
wchar = L'b';
@@ -4730,7 +4731,7 @@ TEST(EqAssertionTest, WideChar) {
"wchar");
wchar = 0x8119;
EXPECT_FATAL_FAILURE(ASSERT_EQ(static_cast<wchar_t>(0x8120), wchar),
- "Value of: wchar");
+ "To be equal to: wchar");
}
// Tests using ::std::string values in {EXPECT|ASSERT}_EQ.
@@ -4759,8 +4760,8 @@ TEST(EqAssertionTest, StdString) {
static ::std::string str3(str1);
str3.at(2) = '\0';
EXPECT_FATAL_FAILURE(ASSERT_EQ(str1, str3),
- "Value of: str3\n"
- " Actual: \"A \\0 in the middle\"");
+ "To be equal to: str3\n"
+ " Which is: \"A \\0 in the middle\"");
}
#if GTEST_HAS_STD_WSTRING
@@ -4880,7 +4881,7 @@ TEST(EqAssertionTest, CharPointer) {
ASSERT_EQ(p1, p1);
EXPECT_NONFATAL_FAILURE(EXPECT_EQ(p0, p2),
- "Value of: p2");
+ "To be equal to: p2");
EXPECT_NONFATAL_FAILURE(EXPECT_EQ(p1, p2),
"p2");
EXPECT_FATAL_FAILURE(ASSERT_EQ(reinterpret_cast<char*>(0x1234),
@@ -4902,7 +4903,7 @@ TEST(EqAssertionTest, WideCharPointer) {
EXPECT_EQ(p0, p0);
EXPECT_NONFATAL_FAILURE(EXPECT_EQ(p0, p2),
- "Value of: p2");
+ "To be equal to: p2");
EXPECT_NONFATAL_FAILURE(EXPECT_EQ(p1, p2),
"p2");
void* pv3 = (void*)0x1234; // NOLINT
@@ -6410,7 +6411,7 @@ class FlagfileTest : public InitGoogleTestTest {
InitGoogleTestTest::SetUp();
testdata_path_.Set(internal::FilePath(
- internal::TempDir() + internal::GetCurrentExecutableName().string() +
+ testing::TempDir() + internal::GetCurrentExecutableName().string() +
"_flagfile_test"));
testing::internal::posix::RmDir(testdata_path_.c_str());
EXPECT_TRUE(testdata_path_.CreateFolder());
@@ -6840,6 +6841,12 @@ TEST(ColoredOutputTest, UsesColorsWhenTermSupportsColors) {
SetEnv("TERM", "screen-256color"); // TERM supports colors.
EXPECT_TRUE(ShouldUseColor(true)); // Stdout is a TTY.
+ SetEnv("TERM", "tmux"); // TERM supports colors.
+ EXPECT_TRUE(ShouldUseColor(true)); // Stdout is a TTY.
+
+ SetEnv("TERM", "tmux-256color"); // TERM supports colors.
+ EXPECT_TRUE(ShouldUseColor(true)); // Stdout is a TTY.
+
SetEnv("TERM", "rxvt-unicode"); // TERM supports colors.
EXPECT_TRUE(ShouldUseColor(true)); // Stdout is a TTY.
@@ -7696,4 +7703,3 @@ TEST(SkipPrefixTest, DoesNotSkipWhenPrefixDoesNotMatch) {
EXPECT_FALSE(SkipPrefix("world!", &p));
EXPECT_EQ(str, p);
}
-
diff --git a/googletest/test/gtest_xml_output_unittest.py b/googletest/test/gtest_xml_output_unittest.py
index f605d4ee..bcd59759 100755
--- a/googletest/test/gtest_xml_output_unittest.py
+++ b/googletest/test/gtest_xml_output_unittest.py
@@ -64,20 +64,20 @@ 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;Value of: 2&#x0A;Expected: 1" type=""><![CDATA[gtest_xml_output_unittest_.cc:*
-Value of: 2
-Expected: 1%(stack)s]]></failure>
+ <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>
</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;Value of: 2&#x0A;Expected: 1" type=""><![CDATA[gtest_xml_output_unittest_.cc:*
-Value of: 2
-Expected: 1%(stack)s]]></failure>
- <failure message="gtest_xml_output_unittest_.cc:*&#x0A;Value of: 3&#x0A;Expected: 2" type=""><![CDATA[gtest_xml_output_unittest_.cc:*
-Value of: 3
-Expected: 2%(stack)s]]></failure>
+ <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>
</testcase>
<testcase name="DISABLED_test" status="notrun" time="*" classname="MixedResultTest"/>
</testsuite>
@@ -209,7 +209,8 @@ class GTestXMLOutputUnitTest(gtest_xml_test_utils.GTestXMLTestCase):
'gtest_no_test_unittest')
try:
os.remove(output_file)
- except OSError, e:
+ except OSError:
+ e = sys.exc_info()[1]
if e.errno != errno.ENOENT:
raise
diff --git a/googletest/test/gtest_xml_test_utils.py b/googletest/test/gtest_xml_test_utils.py
index 3d0c3b2c..341956b5 100755
--- a/googletest/test/gtest_xml_test_utils.py
+++ b/googletest/test/gtest_xml_test_utils.py
@@ -101,7 +101,7 @@ class GTestXMLTestCase(gtest_test_utils.TestCase):
self.assertEquals(
len(expected_children), len(actual_children),
'number of child elements differ in element ' + actual_node.tagName)
- for child_id, child in expected_children.iteritems():
+ for child_id, child in expected_children.items():
self.assert_(child_id in actual_children,
'<%s> is not in <%s> (in element %s)' %
(child_id, actual_children, actual_node.tagName))
diff --git a/googletest/xcode/gtest.xcodeproj/project.pbxproj b/googletest/xcode/gtest.xcodeproj/project.pbxproj
index aefaa88b..003bff8c 100644
--- a/googletest/xcode/gtest.xcodeproj/project.pbxproj
+++ b/googletest/xcode/gtest.xcodeproj/project.pbxproj
@@ -79,6 +79,13 @@
4539C9390EC280E200A70F4C /* gtest-param-util-generated.h in Copy Headers Internal */ = {isa = PBXBuildFile; fileRef = 4539C9360EC280E200A70F4C /* gtest-param-util-generated.h */; };
4539C93A0EC280E200A70F4C /* gtest-param-util.h in Copy Headers Internal */ = {isa = PBXBuildFile; fileRef = 4539C9370EC280E200A70F4C /* gtest-param-util.h */; };
4567C8181264FF71007740BE /* gtest-printers.h in Headers */ = {isa = PBXBuildFile; fileRef = 4567C8171264FF71007740BE /* gtest-printers.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ F67D4F3E1C7F5D8B0017C729 /* gtest-port-arch.h in Headers */ = {isa = PBXBuildFile; fileRef = F67D4F3D1C7F5D8B0017C729 /* gtest-port-arch.h */; };
+ F67D4F3F1C7F5DA70017C729 /* gtest-port-arch.h in Copy Headers Internal */ = {isa = PBXBuildFile; fileRef = F67D4F3D1C7F5D8B0017C729 /* gtest-port-arch.h */; };
+ F67D4F441C7F5DD00017C729 /* gtest-port.h in Headers */ = {isa = PBXBuildFile; fileRef = F67D4F411C7F5DD00017C729 /* gtest-port.h */; };
+ F67D4F451C7F5DD00017C729 /* gtest-printers.h in Headers */ = {isa = PBXBuildFile; fileRef = F67D4F421C7F5DD00017C729 /* gtest-printers.h */; };
+ F67D4F461C7F5DD00017C729 /* gtest.h in Headers */ = {isa = PBXBuildFile; fileRef = F67D4F431C7F5DD00017C729 /* gtest.h */; };
+ F67D4F481C7F5E160017C729 /* gtest-port.h in Copy Headers Internal Custom */ = {isa = PBXBuildFile; fileRef = F67D4F411C7F5DD00017C729 /* gtest-port.h */; };
+ F67D4F491C7F5E260017C729 /* gtest-printers.h in Copy Headers Internal Custom */ = {isa = PBXBuildFile; fileRef = F67D4F421C7F5DD00017C729 /* gtest-printers.h */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
@@ -182,6 +189,7 @@
dstPath = Headers/internal;
dstSubfolderSpec = 6;
files = (
+ F67D4F3F1C7F5DA70017C729 /* gtest-port-arch.h in Copy Headers Internal */,
404884A00E2F7BE600CF7658 /* gtest-death-test-internal.h in Copy Headers Internal */,
404884A10E2F7BE600CF7658 /* gtest-filepath.h in Copy Headers Internal */,
404884A20E2F7BE600CF7658 /* gtest-internal.h in Copy Headers Internal */,
@@ -196,6 +204,18 @@
name = "Copy Headers Internal";
runOnlyForDeploymentPostprocessing = 0;
};
+ F67D4F471C7F5DF60017C729 /* Copy Headers Internal Custom */ = {
+ isa = PBXCopyFilesBuildPhase;
+ buildActionMask = 2147483647;
+ dstPath = Headers/internal/custom;
+ dstSubfolderSpec = 6;
+ files = (
+ F67D4F491C7F5E260017C729 /* gtest-printers.h in Copy Headers Internal Custom */,
+ F67D4F481C7F5E160017C729 /* gtest-port.h in Copy Headers Internal Custom */,
+ );
+ name = "Copy Headers Internal Custom";
+ runOnlyForDeploymentPostprocessing = 0;
+ };
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
@@ -244,6 +264,10 @@
4539C9360EC280E200A70F4C /* gtest-param-util-generated.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "gtest-param-util-generated.h"; sourceTree = "<group>"; };
4539C9370EC280E200A70F4C /* gtest-param-util.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "gtest-param-util.h"; sourceTree = "<group>"; };
4567C8171264FF71007740BE /* gtest-printers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "gtest-printers.h"; sourceTree = "<group>"; };
+ F67D4F3D1C7F5D8B0017C729 /* gtest-port-arch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "gtest-port-arch.h"; sourceTree = "<group>"; };
+ F67D4F411C7F5DD00017C729 /* gtest-port.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "gtest-port.h"; sourceTree = "<group>"; };
+ F67D4F421C7F5DD00017C729 /* gtest-printers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "gtest-printers.h"; sourceTree = "<group>"; };
+ F67D4F431C7F5DD00017C729 /* gtest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = gtest.h; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -375,6 +399,7 @@
404883E10E2F799B00CF7658 /* internal */ = {
isa = PBXGroup;
children = (
+ F67D4F401C7F5DD00017C729 /* custom */,
404883E20E2F799B00CF7658 /* gtest-death-test-internal.h */,
404883E30E2F799B00CF7658 /* gtest-filepath.h */,
404883E40E2F799B00CF7658 /* gtest-internal.h */,
@@ -382,6 +407,7 @@
4539C9360EC280E200A70F4C /* gtest-param-util-generated.h */,
4539C9370EC280E200A70F4C /* gtest-param-util.h */,
404883E50E2F799B00CF7658 /* gtest-port.h */,
+ F67D4F3D1C7F5D8B0017C729 /* gtest-port-arch.h */,
404883E60E2F799B00CF7658 /* gtest-string.h */,
40899F4D0FFA7271000B29AE /* gtest-tuple.h */,
3BF6F29F0E79B5AD000F2EEE /* gtest-type-util.h */,
@@ -430,6 +456,16 @@
path = Resources;
sourceTree = "<group>";
};
+ F67D4F401C7F5DD00017C729 /* custom */ = {
+ isa = PBXGroup;
+ children = (
+ F67D4F411C7F5DD00017C729 /* gtest-port.h */,
+ F67D4F421C7F5DD00017C729 /* gtest-printers.h */,
+ F67D4F431C7F5DD00017C729 /* gtest.h */,
+ );
+ path = custom;
+ sourceTree = "<group>";
+ };
/* End PBXGroup section */
/* Begin PBXHeadersBuildPhase section */
@@ -437,10 +473,14 @@
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
+ F67D4F451C7F5DD00017C729 /* gtest-printers.h in Headers */,
404884380E2F799B00CF7658 /* gtest-death-test.h in Headers */,
404884390E2F799B00CF7658 /* gtest-message.h in Headers */,
4539C9340EC280AE00A70F4C /* gtest-param-test.h in Headers */,
+ F67D4F461C7F5DD00017C729 /* gtest.h in Headers */,
+ F67D4F441C7F5DD00017C729 /* gtest-port.h in Headers */,
4567C8181264FF71007740BE /* gtest-printers.h in Headers */,
+ F67D4F3E1C7F5D8B0017C729 /* gtest-port-arch.h in Headers */,
3BF6F2A50E79B616000F2EEE /* gtest-typed-test.h in Headers */,
4048843A0E2F799B00CF7658 /* gtest-spi.h in Headers */,
4048843B0E2F799B00CF7658 /* gtest.h in Headers */,
@@ -560,6 +600,7 @@
8D07F2C10486CC7A007CD1D0 /* Sources */,
8D07F2BD0486CC7A007CD1D0 /* Headers */,
404884A50E2F7C0400CF7658 /* Copy Headers Internal */,
+ F67D4F471C7F5DF60017C729 /* Copy Headers Internal Custom */,
8D07F2BF0486CC7A007CD1D0 /* Resources */,
);
buildRules = (
@@ -1026,6 +1067,9 @@
isa = XCBuildConfiguration;
baseConfigurationReference = 40D4CDF10E30E07400294801 /* DebugProject.xcconfig */;
buildSettings = {
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+ CLANG_CXX_LIBRARY = "libc++";
+ MACOSX_DEPLOYMENT_TARGET = 10.7;
};
name = Debug;
};
@@ -1033,6 +1077,9 @@
isa = XCBuildConfiguration;
baseConfigurationReference = 40D4CDF40E30E07400294801 /* ReleaseProject.xcconfig */;
buildSettings = {
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+ CLANG_CXX_LIBRARY = "libc++";
+ MACOSX_DEPLOYMENT_TARGET = 10.7;
};
name = Release;
};
diff --git a/travis.sh b/travis.sh
index 20fe3e39..bdecbd96 100755
--- a/travis.sh
+++ b/travis.sh
@@ -12,4 +12,4 @@ cmake -Dgtest_build_samples=ON \
-DCMAKE_CXX_FLAGS=$CXX_FLAGS \
../../$GTEST_TARGET
make
-make test
+CTEST_OUTPUT_ON_FAILURE=1 make test