mirror of
https://github.com/holub/mame
synced 2025-07-03 17:08:39 +03:00
update googletest/mock (nw)
This commit is contained in:
parent
bb145eb933
commit
b900f66730
1
3rdparty/googletest/.travis.yml
vendored
1
3rdparty/googletest/.travis.yml
vendored
@ -38,6 +38,7 @@ env:
|
|||||||
matrix:
|
matrix:
|
||||||
- GTEST_TARGET=googletest SHARED_LIB=OFF STATIC_LIB=ON CMAKE_PKG=OFF BUILD_TYPE=debug VERBOSE_MAKE=true VERBOSE
|
- GTEST_TARGET=googletest SHARED_LIB=OFF STATIC_LIB=ON CMAKE_PKG=OFF BUILD_TYPE=debug VERBOSE_MAKE=true VERBOSE
|
||||||
- GTEST_TARGET=googlemock SHARED_LIB=OFF STATIC_LIB=ON CMAKE_PKG=OFF BUILD_TYPE=debug VERBOSE_MAKE=true VERBOSE
|
- GTEST_TARGET=googlemock SHARED_LIB=OFF STATIC_LIB=ON CMAKE_PKG=OFF BUILD_TYPE=debug VERBOSE_MAKE=true VERBOSE
|
||||||
|
- GTEST_TARGET=googlemock SHARED_LIB=OFF STATIC_LIB=ON CMAKE_PKG=OFF BUILD_TYPE=debug CXX_FLAGS=-std=c++11 VERBOSE_MAKE=true VERBOSE
|
||||||
# - GTEST_TARGET=googletest SHARED_LIB=ON STATIC_LIB=ON CMAKE_PKG=ON BUILD_TYPE=release VERBOSE_MAKE=false
|
# - GTEST_TARGET=googletest SHARED_LIB=ON STATIC_LIB=ON CMAKE_PKG=ON BUILD_TYPE=release VERBOSE_MAKE=false
|
||||||
# - GTEST_TARGET=googlemock SHARED_LIB=ON STATIC_LIB=ON CMAKE_PKG=ON BUILD_TYPE=release VERBOSE_MAKE=false
|
# - GTEST_TARGET=googlemock SHARED_LIB=ON STATIC_LIB=ON CMAKE_PKG=ON BUILD_TYPE=release VERBOSE_MAKE=false
|
||||||
notifications:
|
notifications:
|
||||||
|
8
3rdparty/googletest/googlemock/Makefile.am
vendored
8
3rdparty/googletest/googlemock/Makefile.am
vendored
@ -42,7 +42,10 @@ pkginclude_internaldir = $(pkgincludedir)/internal
|
|||||||
pkginclude_internal_HEADERS = \
|
pkginclude_internal_HEADERS = \
|
||||||
include/gmock/internal/gmock-generated-internal-utils.h \
|
include/gmock/internal/gmock-generated-internal-utils.h \
|
||||||
include/gmock/internal/gmock-internal-utils.h \
|
include/gmock/internal/gmock-internal-utils.h \
|
||||||
include/gmock/internal/gmock-port.h
|
include/gmock/internal/gmock-port.h \
|
||||||
|
include/gmock/internal/custom/gmock-generated-actions.h \
|
||||||
|
include/gmock/internal/custom/gmock-matchers.h \
|
||||||
|
include/gmock/internal/custom/gmock-port.h
|
||||||
|
|
||||||
lib_libgmock_main_la_SOURCES = src/gmock_main.cc
|
lib_libgmock_main_la_SOURCES = src/gmock_main.cc
|
||||||
lib_libgmock_main_la_LIBADD = lib/libgmock.la
|
lib_libgmock_main_la_LIBADD = lib/libgmock.la
|
||||||
@ -136,7 +139,8 @@ EXTRA_DIST += \
|
|||||||
include/gmock/gmock-generated-function-mockers.h.pump \
|
include/gmock/gmock-generated-function-mockers.h.pump \
|
||||||
include/gmock/gmock-generated-matchers.h.pump \
|
include/gmock/gmock-generated-matchers.h.pump \
|
||||||
include/gmock/gmock-generated-nice-strict.h.pump \
|
include/gmock/gmock-generated-nice-strict.h.pump \
|
||||||
include/gmock/internal/gmock-generated-internal-utils.h.pump
|
include/gmock/internal/gmock-generated-internal-utils.h.pump \
|
||||||
|
include/gmock/internal/custom/gmock-generated-actions.h.pump
|
||||||
|
|
||||||
# Script for fusing Google Mock and Google Test source files.
|
# Script for fusing Google Mock and Google Test source files.
|
||||||
EXTRA_DIST += scripts/fuse_gmock_files.py
|
EXTRA_DIST += scripts/fuse_gmock_files.py
|
||||||
|
8
3rdparty/googletest/googlemock/README.md
vendored
8
3rdparty/googletest/googlemock/README.md
vendored
@ -62,14 +62,14 @@ You can also watch Zhanyong's [talk](http://www.youtube.com/watch?v=sYpCyLI47rM)
|
|||||||
|
|
||||||
Once you understand the basics, check out the rest of the docs:
|
Once you understand the basics, check out the rest of the docs:
|
||||||
|
|
||||||
* [CheatSheet](googlemock/docs/CheatSheet.md) - all the commonly used stuff
|
* [CheatSheet](docs/CheatSheet.md) - all the commonly used stuff
|
||||||
at a glance.
|
at a glance.
|
||||||
* [CookBook](googlemock/docs/CookBook.md) - recipes for getting things done,
|
* [CookBook](docs/CookBook.md) - recipes for getting things done,
|
||||||
including advanced techniques.
|
including advanced techniques.
|
||||||
|
|
||||||
If you need help, please check the
|
If you need help, please check the
|
||||||
[KnownIssues](googlemock/docs/KnownIssues.md) and
|
[KnownIssues](docs/KnownIssues.md) and
|
||||||
[FrequentlyAskedQuestions](googlemock/docs/frequentlyaskedquestions.md) before
|
[FrequentlyAskedQuestions](docs/FrequentlyAskedQuestions.md) before
|
||||||
posting a question on the
|
posting a question on the
|
||||||
[discussion group](http://groups.google.com/group/googlemock).
|
[discussion group](http://groups.google.com/group/googlemock).
|
||||||
|
|
||||||
|
10
3rdparty/googletest/googlemock/configure.ac
vendored
10
3rdparty/googletest/googlemock/configure.ac
vendored
@ -1,4 +1,4 @@
|
|||||||
m4_include(gtest/m4/acx_pthread.m4)
|
m4_include(../googletest/m4/acx_pthread.m4)
|
||||||
|
|
||||||
AC_INIT([Google C++ Mocking Framework],
|
AC_INIT([Google C++ Mocking Framework],
|
||||||
[1.7.0],
|
[1.7.0],
|
||||||
@ -129,14 +129,14 @@ AS_IF([test "x${HAVE_BUILT_GTEST}" = "xyes"],
|
|||||||
GTEST_LDFLAGS=`${GTEST_CONFIG} --ldflags`
|
GTEST_LDFLAGS=`${GTEST_CONFIG} --ldflags`
|
||||||
GTEST_LIBS=`${GTEST_CONFIG} --libs`
|
GTEST_LIBS=`${GTEST_CONFIG} --libs`
|
||||||
GTEST_VERSION=`${GTEST_CONFIG} --version`],
|
GTEST_VERSION=`${GTEST_CONFIG} --version`],
|
||||||
[AC_CONFIG_SUBDIRS([gtest])
|
[AC_CONFIG_SUBDIRS([../googletest])
|
||||||
# GTEST_CONFIG needs to be executable both in a Makefile environmont and
|
# GTEST_CONFIG needs to be executable both in a Makefile environmont and
|
||||||
# in a shell script environment, so resolve an absolute path for it here.
|
# in a shell script environment, so resolve an absolute path for it here.
|
||||||
GTEST_CONFIG="`pwd -P`/gtest/scripts/gtest-config"
|
GTEST_CONFIG="`pwd -P`/../googletest/scripts/gtest-config"
|
||||||
GTEST_CPPFLAGS='-I$(top_srcdir)/gtest/include'
|
GTEST_CPPFLAGS='-I$(top_srcdir)/../googletest/include'
|
||||||
GTEST_CXXFLAGS='-g'
|
GTEST_CXXFLAGS='-g'
|
||||||
GTEST_LDFLAGS=''
|
GTEST_LDFLAGS=''
|
||||||
GTEST_LIBS='$(top_builddir)/gtest/lib/libgtest.la'
|
GTEST_LIBS='$(top_builddir)/../googletest/lib/libgtest.la'
|
||||||
GTEST_VERSION="${GTEST_MIN_VERSION}"])
|
GTEST_VERSION="${GTEST_MIN_VERSION}"])
|
||||||
|
|
||||||
# TODO(chandlerc@google.com) Check the types, structures, and other compiler
|
# TODO(chandlerc@google.com) Check the types, structures, and other compiler
|
||||||
|
2
3rdparty/googletest/googlemock/make/Makefile
vendored
2
3rdparty/googletest/googlemock/make/Makefile
vendored
@ -17,7 +17,7 @@
|
|||||||
# Points to the root of Google Test, relative to where this file is.
|
# 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
|
# Remember to tweak this if you move this file, or if you want to use
|
||||||
# a copy of Google Test at a different location.
|
# 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.
|
# Points to the root of Google Mock, relative to where this file is.
|
||||||
# Remember to tweak this if you move this file.
|
# Remember to tweak this if you move this file.
|
||||||
|
@ -36,8 +36,8 @@ SYNOPSIS
|
|||||||
fuse_gmock_files.py [GMOCK_ROOT_DIR] OUTPUT_DIR
|
fuse_gmock_files.py [GMOCK_ROOT_DIR] OUTPUT_DIR
|
||||||
|
|
||||||
Scans GMOCK_ROOT_DIR for Google Mock and Google Test source
|
Scans GMOCK_ROOT_DIR for Google Mock and Google Test source
|
||||||
code, assuming Google Test is in the GMOCK_ROOT_DIR/gtest
|
code, assuming Google Test is in the GMOCK_ROOT_DIR/../googletest
|
||||||
sub-directory, and generates three files:
|
directory, and generates three files:
|
||||||
OUTPUT_DIR/gtest/gtest.h, OUTPUT_DIR/gmock/gmock.h, and
|
OUTPUT_DIR/gtest/gtest.h, OUTPUT_DIR/gmock/gmock.h, and
|
||||||
OUTPUT_DIR/gmock-gtest-all.cc. Then you can build your tests
|
OUTPUT_DIR/gmock-gtest-all.cc. Then you can build your tests
|
||||||
by adding OUTPUT_DIR to the include search path and linking
|
by adding OUTPUT_DIR to the include search path and linking
|
||||||
@ -70,8 +70,8 @@ import sys
|
|||||||
# Mock root directory.
|
# Mock root directory.
|
||||||
DEFAULT_GMOCK_ROOT_DIR = os.path.join(os.path.dirname(__file__), '..')
|
DEFAULT_GMOCK_ROOT_DIR = os.path.join(os.path.dirname(__file__), '..')
|
||||||
|
|
||||||
# We need to call into gtest/scripts/fuse_gtest_files.py.
|
# We need to call into googletest/scripts/fuse_gtest_files.py.
|
||||||
sys.path.append(os.path.join(DEFAULT_GMOCK_ROOT_DIR, 'gtest/scripts'))
|
sys.path.append(os.path.join(DEFAULT_GMOCK_ROOT_DIR, '../googletest/scripts'))
|
||||||
import fuse_gtest_files
|
import fuse_gtest_files
|
||||||
gtest = fuse_gtest_files
|
gtest = fuse_gtest_files
|
||||||
|
|
||||||
@ -91,7 +91,7 @@ GMOCK_GTEST_ALL_CC_OUTPUT = 'gmock-gtest-all.cc'
|
|||||||
def GetGTestRootDir(gmock_root):
|
def GetGTestRootDir(gmock_root):
|
||||||
"""Returns the root directory of Google Test."""
|
"""Returns the root directory of Google Test."""
|
||||||
|
|
||||||
return os.path.join(gmock_root, 'gtest')
|
return os.path.join(gmock_root, '../googletest')
|
||||||
|
|
||||||
|
|
||||||
def ValidateGMockRootDir(gmock_root):
|
def ValidateGMockRootDir(gmock_root):
|
||||||
|
@ -376,7 +376,8 @@ class SubstractAction : public ActionInterface<int(int, int)> { // NOLINT
|
|||||||
TEST(WithArgsTest, NonInvokeAction) {
|
TEST(WithArgsTest, NonInvokeAction) {
|
||||||
Action<int(const string&, int, int)> a = // NOLINT
|
Action<int(const string&, int, int)> a = // NOLINT
|
||||||
WithArgs<2, 1>(MakeAction(new SubstractAction));
|
WithArgs<2, 1>(MakeAction(new SubstractAction));
|
||||||
EXPECT_EQ(8, a.Perform(make_tuple(string("hi"), 2, 10)));
|
string s("hello");
|
||||||
|
EXPECT_EQ(8, a.Perform(tuple<const string&, int, int>(s, 2, 10)));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tests using WithArgs to pass all original arguments in the original order.
|
// Tests using WithArgs to pass all original arguments in the original order.
|
||||||
@ -753,7 +754,7 @@ TEST(ActionPMacroTest, CanReferenceArgumentAndParameterTypes) {
|
|||||||
TEST(ActionPMacroTest, WorksInCompatibleMockFunction) {
|
TEST(ActionPMacroTest, WorksInCompatibleMockFunction) {
|
||||||
Action<std::string(const std::string& s)> a1 = Plus("tail");
|
Action<std::string(const std::string& s)> a1 = Plus("tail");
|
||||||
const std::string re = "re";
|
const std::string re = "re";
|
||||||
EXPECT_EQ("retail", a1.Perform(make_tuple(re)));
|
EXPECT_EQ("retail", a1.Perform(tuple<const std::string&>(re)));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tests that we can use ACTION*() to define actions overloaded on the
|
// Tests that we can use ACTION*() to define actions overloaded on the
|
||||||
@ -795,7 +796,7 @@ TEST(ActionPnMacroTest, WorksFor3Parameters) {
|
|||||||
|
|
||||||
Action<std::string(const std::string& s)> a2 = Plus("tail", "-", ">");
|
Action<std::string(const std::string& s)> a2 = Plus("tail", "-", ">");
|
||||||
const std::string re = "re";
|
const std::string re = "re";
|
||||||
EXPECT_EQ("retail->", a2.Perform(make_tuple(re)));
|
EXPECT_EQ("retail->", a2.Perform(tuple<const std::string&>(re)));
|
||||||
}
|
}
|
||||||
|
|
||||||
ACTION_P4(Plus, p0, p1, p2, p3) { return arg0 + p0 + p1 + p2 + p3; }
|
ACTION_P4(Plus, p0, p1, p2, p3) { return arg0 + p0 + p1 + p2 + p3; }
|
||||||
|
@ -36,6 +36,7 @@
|
|||||||
#include "gmock/internal/gmock-internal-utils.h"
|
#include "gmock/internal/gmock-internal-utils.h"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
@ -327,7 +327,9 @@ TEST(InvokeTest, FunctionThatTakes10Arguments) {
|
|||||||
TEST(InvokeTest, FunctionWithUnusedParameters) {
|
TEST(InvokeTest, FunctionWithUnusedParameters) {
|
||||||
Action<int(int, int, double, const string&)> a1 =
|
Action<int(int, int, double, const string&)> a1 =
|
||||||
Invoke(SumOfFirst2);
|
Invoke(SumOfFirst2);
|
||||||
EXPECT_EQ(12, a1.Perform(make_tuple(10, 2, 5.6, string("hi"))));
|
string s("hi");
|
||||||
|
EXPECT_EQ(12, a1.Perform(
|
||||||
|
tuple<int, int, double, const string&>(10, 2, 5.6, s)));
|
||||||
|
|
||||||
Action<int(int, int, bool, int*)> a2 =
|
Action<int(int, int, bool, int*)> a2 =
|
||||||
Invoke(SumOfFirst2);
|
Invoke(SumOfFirst2);
|
||||||
@ -379,7 +381,8 @@ TEST(InvokeMethodTest, Binary) {
|
|||||||
Foo foo;
|
Foo foo;
|
||||||
Action<string(const string&, char)> a = Invoke(&foo, &Foo::Binary);
|
Action<string(const string&, char)> a = Invoke(&foo, &Foo::Binary);
|
||||||
string s("Hell");
|
string s("Hell");
|
||||||
EXPECT_EQ("Hello", a.Perform(make_tuple(s, 'o')));
|
EXPECT_EQ("Hello", a.Perform(
|
||||||
|
tuple<const string&, char>(s, 'o')));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tests using Invoke() with a ternary method.
|
// Tests using Invoke() with a ternary method.
|
||||||
|
@ -37,7 +37,6 @@
|
|||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
#include "gtest/internal/custom/gtest.h"
|
|
||||||
|
|
||||||
#if !defined(GTEST_CUSTOM_INIT_GOOGLE_TEST_FUNCTION_)
|
#if !defined(GTEST_CUSTOM_INIT_GOOGLE_TEST_FUNCTION_)
|
||||||
|
|
||||||
|
6
3rdparty/googletest/googletest/Makefile.am
vendored
6
3rdparty/googletest/googletest/Makefile.am
vendored
@ -205,9 +205,13 @@ pkginclude_internal_HEADERS = \
|
|||||||
include/gtest/internal/gtest-param-util-generated.h \
|
include/gtest/internal/gtest-param-util-generated.h \
|
||||||
include/gtest/internal/gtest-param-util.h \
|
include/gtest/internal/gtest-param-util.h \
|
||||||
include/gtest/internal/gtest-port.h \
|
include/gtest/internal/gtest-port.h \
|
||||||
|
include/gtest/internal/gtest-port-arch.h \
|
||||||
include/gtest/internal/gtest-string.h \
|
include/gtest/internal/gtest-string.h \
|
||||||
include/gtest/internal/gtest-tuple.h \
|
include/gtest/internal/gtest-tuple.h \
|
||||||
include/gtest/internal/gtest-type-util.h
|
include/gtest/internal/gtest-type-util.h \
|
||||||
|
include/gtest/internal/custom/gtest.h \
|
||||||
|
include/gtest/internal/custom/gtest-port.h \
|
||||||
|
include/gtest/internal/custom/gtest-printers.h
|
||||||
|
|
||||||
lib_libgtest_main_la_SOURCES = src/gtest_main.cc
|
lib_libgtest_main_la_SOURCES = src/gtest_main.cc
|
||||||
lib_libgtest_main_la_LIBADD = lib/libgtest.la
|
lib_libgtest_main_la_LIBADD = lib/libgtest.la
|
||||||
|
@ -44,7 +44,7 @@ switch(expression) {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Note: you can only use `FAIL()` in functions that return `void`. See the [Assertion Placement section](#Assertion_Placement.md) for more information.
|
Note: you can only use `FAIL()` in functions that return `void`. See the [Assertion Placement section](#assertion-placement) for more information.
|
||||||
|
|
||||||
_Availability_: Linux, Windows, Mac.
|
_Availability_: Linux, Windows, Mac.
|
||||||
|
|
||||||
@ -125,7 +125,7 @@ c is 10<br>
|
|||||||
|
|
||||||
**Notes:**
|
**Notes:**
|
||||||
|
|
||||||
1. If you see a compiler error "no matching function to call" when using `ASSERT_PRED*` or `EXPECT_PRED*`, please see [this](http://code.google.com/p/googletest/wiki/FAQ#The_compiler_complains_%22no_matching_function_to_call%22) for how to resolve it.
|
1. If you see a compiler error "no matching function to call" when using `ASSERT_PRED*` or `EXPECT_PRED*`, please see [this FAQ](FAQ.md#the-compiler-complains-no-matching-function-to-call-when-i-use-assert_predn-how-do-i-fix-it) for how to resolve it.
|
||||||
1. Currently we only provide predicate assertions of arity <= 5. If you need a higher-arity assertion, let us know.
|
1. Currently we only provide predicate assertions of arity <= 5. If you need a higher-arity assertion, let us know.
|
||||||
|
|
||||||
_Availability_: Linux, Windows, Mac
|
_Availability_: Linux, Windows, Mac
|
||||||
@ -517,9 +517,9 @@ _death tests_. More generally, any test that checks that a program terminates
|
|||||||
Note that if a piece of code throws an exception, we don't consider it "death"
|
Note that if a piece of code throws an exception, we don't consider it "death"
|
||||||
for the purpose of death tests, as the caller of the code could catch the exception
|
for the purpose of death tests, as the caller of the code could catch the exception
|
||||||
and avoid the crash. If you want to verify exceptions thrown by your code,
|
and avoid the crash. If you want to verify exceptions thrown by your code,
|
||||||
see [Exception Assertions](#Exception_Assertions.md).
|
see [Exception Assertions](#exception-assertions).
|
||||||
|
|
||||||
If you want to test `EXPECT_*()/ASSERT_*()` failures in your test code, see [Catching Failures](#Catching_Failures.md).
|
If you want to test `EXPECT_*()/ASSERT_*()` failures in your test code, see [Catching Failures](#catching-failures).
|
||||||
|
|
||||||
## How to Write a Death Test ##
|
## How to Write a Death Test ##
|
||||||
|
|
||||||
@ -1199,9 +1199,9 @@ which are all in the `testing` namespace:
|
|||||||
| `Values(v1, v2, ..., vN)` | Yields values `{v1, v2, ..., vN}`. |
|
| `Values(v1, v2, ..., vN)` | Yields values `{v1, v2, ..., vN}`. |
|
||||||
| `ValuesIn(container)` and `ValuesIn(begin, end)` | Yields values from a C-style array, an STL-style container, or an iterator range `[begin, end)`. `container`, `begin`, and `end` can be expressions whose values are determined at run time. |
|
| `ValuesIn(container)` and `ValuesIn(begin, end)` | Yields values from a C-style array, an STL-style container, or an iterator range `[begin, end)`. `container`, `begin`, and `end` can be expressions whose values are determined at run time. |
|
||||||
| `Bool()` | Yields sequence `{false, true}`. |
|
| `Bool()` | Yields sequence `{false, true}`. |
|
||||||
| `Combine(g1, g2, ..., gN)` | Yields all combinations (the Cartesian product for the math savvy) of the values generated by the `N` generators. This is only available if your system provides the `<tr1/tuple>` header. If you are sure your system does, and Google Test disagrees, you can override it by defining `GTEST_HAS_TR1_TUPLE=1`. See comments in [include/gtest/internal/gtest-port.h](http://code.google.com/p/googletest/source/browse/trunk/include/gtest/internal/gtest-port.h) for more information. |
|
| `Combine(g1, g2, ..., gN)` | Yields all combinations (the Cartesian product for the math savvy) of the values generated by the `N` generators. This is only available if your system provides the `<tr1/tuple>` header. If you are sure your system does, and Google Test disagrees, you can override it by defining `GTEST_HAS_TR1_TUPLE=1`. See comments in [include/gtest/internal/gtest-port.h](https://github.com/google/googletest/blob/master/googletest/include/gtest/internal/gtest-port.h) for more information. |
|
||||||
|
|
||||||
For more details, see the comments at the definitions of these functions in the [source code](http://code.google.com/p/googletest/source/browse/trunk/include/gtest/gtest-param-test.h).
|
For more details, see the comments at the definitions of these functions in the [source code](https://github.com/google/googletest/blob/master/googletest/include/gtest/gtest-param-test.h).
|
||||||
|
|
||||||
The following statement will instantiate tests from the `FooTest` test case
|
The following statement will instantiate tests from the `FooTest` test case
|
||||||
each with parameter values `"meeny"`, `"miny"`, and `"moe"`.
|
each with parameter values `"meeny"`, `"miny"`, and `"moe"`.
|
||||||
@ -1226,7 +1226,7 @@ names:
|
|||||||
* `InstantiationName/FooTest.HasBlahBlah/1` for `"miny"`
|
* `InstantiationName/FooTest.HasBlahBlah/1` for `"miny"`
|
||||||
* `InstantiationName/FooTest.HasBlahBlah/2` for `"moe"`
|
* `InstantiationName/FooTest.HasBlahBlah/2` for `"moe"`
|
||||||
|
|
||||||
You can use these names in [--gtest\_filter](#Running_a_Subset_of_the_Tests.md).
|
You can use these names in [--gtest\_filter](#running-a-subset-of-the-tests).
|
||||||
|
|
||||||
This statement will instantiate all tests from `FooTest` again, each
|
This statement will instantiate all tests from `FooTest` again, each
|
||||||
with parameter values `"cat"` and `"dog"`:
|
with parameter values `"cat"` and `"dog"`:
|
||||||
@ -1249,8 +1249,8 @@ tests in the given test case, whether their definitions come before or
|
|||||||
_after_ the `INSTANTIATE_TEST_CASE_P` statement.
|
_after_ the `INSTANTIATE_TEST_CASE_P` statement.
|
||||||
|
|
||||||
You can see
|
You can see
|
||||||
[these](http://code.google.com/p/googletest/source/browse/trunk/samples/sample7_unittest.cc)
|
[these](https://github.com/google/googletest/blob/master/googletest/samples/sample7_unittest.cc)
|
||||||
[files](http://code.google.com/p/googletest/source/browse/trunk/samples/sample8_unittest.cc) for more examples.
|
[files](https://github.com/google/googletest/blob/master/googletest/samples/sample8_unittest.cc) for more examples.
|
||||||
|
|
||||||
_Availability_: Linux, Windows (requires MSVC 8.0 or above), Mac; since version 1.2.0.
|
_Availability_: Linux, Windows (requires MSVC 8.0 or above), Mac; since version 1.2.0.
|
||||||
|
|
||||||
@ -1646,8 +1646,8 @@ _Availability:_ Linux, Windows, Mac; since v1.4.0.
|
|||||||
## Defining Event Listeners ##
|
## Defining Event Listeners ##
|
||||||
|
|
||||||
To define a event listener, you subclass either
|
To define a event listener, you subclass either
|
||||||
[testing::TestEventListener](http://code.google.com/p/googletest/source/browse/trunk/include/gtest/gtest.h#855)
|
[testing::TestEventListener](https://github.com/google/googletest/blob/master/googletest/include/gtest/gtest.h#L991)
|
||||||
or [testing::EmptyTestEventListener](http://code.google.com/p/googletest/source/browse/trunk/include/gtest/gtest.h#905).
|
or [testing::EmptyTestEventListener](https://github.com/google/googletest/blob/master/googletest/include/gtest/gtest.h#L1044).
|
||||||
The former is an (abstract) interface, where <i>each pure virtual method<br>
|
The former is an (abstract) interface, where <i>each pure virtual method<br>
|
||||||
can be overridden to handle a test event</i> (For example, when a test
|
can be overridden to handle a test event</i> (For example, when a test
|
||||||
starts, the `OnTestStart()` method will be called.). The latter provides
|
starts, the `OnTestStart()` method will be called.). The latter provides
|
||||||
@ -1656,10 +1656,10 @@ subclass only needs to override the methods it cares about.
|
|||||||
|
|
||||||
When an event is fired, its context is passed to the handler function
|
When an event is fired, its context is passed to the handler function
|
||||||
as an argument. The following argument types are used:
|
as an argument. The following argument types are used:
|
||||||
* [UnitTest](http://code.google.com/p/googletest/source/browse/trunk/include/gtest/gtest.h#1007) reflects the state of the entire test program,
|
* [UnitTest](https://github.com/google/googletest/blob/master/googletest/include/gtest/gtest.h#L1151) reflects the state of the entire test program,
|
||||||
* [TestCase](http://code.google.com/p/googletest/source/browse/trunk/include/gtest/gtest.h#689) has information about a test case, which can contain one or more tests,
|
* [TestCase](https://github.com/google/googletest/blob/master/googletest/include/gtest/gtest.h#L778) has information about a test case, which can contain one or more tests,
|
||||||
* [TestInfo](http://code.google.com/p/googletest/source/browse/trunk/include/gtest/gtest.h#599) contains the state of a test, and
|
* [TestInfo](https://github.com/google/googletest/blob/master/googletest/include/gtest/gtest.h#L644) contains the state of a test, and
|
||||||
* [TestPartResult](http://code.google.com/p/googletest/source/browse/trunk/include/gtest/gtest-test-part.h#42) represents the result of a test assertion.
|
* [TestPartResult](https://github.com/google/googletest/blob/master/googletest/include/gtest/gtest-test-part.h#L47) represents the result of a test assertion.
|
||||||
|
|
||||||
An event handler function can examine the argument it receives to find
|
An event handler function can examine the argument it receives to find
|
||||||
out interesting information about the event and the test program's
|
out interesting information about the event and the test program's
|
||||||
@ -1695,7 +1695,7 @@ state. Here's an example:
|
|||||||
|
|
||||||
To use the event listener you have defined, add an instance of it to
|
To use the event listener you have defined, add an instance of it to
|
||||||
the Google Test event listener list (represented by class
|
the Google Test event listener list (represented by class
|
||||||
[TestEventListeners](http://code.google.com/p/googletest/source/browse/trunk/include/gtest/gtest.h#929)
|
[TestEventListeners](https://github.com/google/googletest/blob/master/googletest/include/gtest/gtest.h#L1064)
|
||||||
- note the "s" at the end of the name) in your
|
- note the "s" at the end of the name) in your
|
||||||
`main()` function, before calling `RUN_ALL_TESTS()`:
|
`main()` function, before calling `RUN_ALL_TESTS()`:
|
||||||
```
|
```
|
||||||
@ -1723,7 +1723,7 @@ event listener list and delete it. You can do so by adding one line:
|
|||||||
|
|
||||||
Now, sit back and enjoy a completely different output from your
|
Now, sit back and enjoy a completely different output from your
|
||||||
tests. For more details, you can read this
|
tests. For more details, you can read this
|
||||||
[sample](http://code.google.com/p/googletest/source/browse/trunk/samples/sample9_unittest.cc).
|
[sample](https://github.com/google/googletest/blob/master/googletest/samples/sample9_unittest.cc).
|
||||||
|
|
||||||
You may append more than one listener to the list. When an `On*Start()`
|
You may append more than one listener to the list. When an `On*Start()`
|
||||||
or `OnTestPartResult()` event is fired, the listeners will receive it in
|
or `OnTestPartResult()` event is fired, the listeners will receive it in
|
||||||
@ -1748,7 +1748,7 @@ failures. This ensures that failures generated by the latter are
|
|||||||
attributed to the right test by the former.
|
attributed to the right test by the former.
|
||||||
|
|
||||||
We have a sample of failure-raising listener
|
We have a sample of failure-raising listener
|
||||||
[here](http://code.google.com/p/googletest/source/browse/trunk/samples/sample10_unittest.cc).
|
[here](https://github.com/google/googletest/blob/master/googletest/samples/sample10_unittest.cc).
|
||||||
|
|
||||||
# Running Test Programs: Advanced Options #
|
# Running Test Programs: Advanced Options #
|
||||||
|
|
||||||
@ -1868,12 +1868,12 @@ _Availability:_ Linux, Windows, Mac.
|
|||||||
|
|
||||||
### Temporarily Enabling Disabled Tests ###
|
### Temporarily Enabling Disabled Tests ###
|
||||||
|
|
||||||
To include [disabled tests](#Temporarily_Disabling_Tests.md) in test
|
To include [disabled tests](#temporarily-disabling-tests) in test
|
||||||
execution, just invoke the test program with the
|
execution, just invoke the test program with the
|
||||||
`--gtest_also_run_disabled_tests` flag or set the
|
`--gtest_also_run_disabled_tests` flag or set the
|
||||||
`GTEST_ALSO_RUN_DISABLED_TESTS` environment variable to a value other
|
`GTEST_ALSO_RUN_DISABLED_TESTS` environment variable to a value other
|
||||||
than `0`. You can combine this with the
|
than `0`. You can combine this with the
|
||||||
[--gtest\_filter](#Running_a_Subset_of_the_Tests.md) flag to further select
|
[--gtest\_filter](#running-a-subset-of-the-tests) flag to further select
|
||||||
which disabled tests to run.
|
which disabled tests to run.
|
||||||
|
|
||||||
_Availability:_ Linux, Windows, Mac; since version 1.3.0.
|
_Availability:_ Linux, Windows, Mac; since version 1.3.0.
|
||||||
@ -2173,11 +2173,11 @@ and you should see an `OUTPUT_DIR` directory being created with files
|
|||||||
`gtest/gtest.h` and `gtest/gtest-all.cc` in it. These files contain
|
`gtest/gtest.h` and `gtest/gtest-all.cc` in it. These files contain
|
||||||
everything you need to use Google Test. Just copy them to anywhere
|
everything you need to use Google Test. Just copy them to anywhere
|
||||||
you want and you are ready to write tests. You can use the
|
you want and you are ready to write tests. You can use the
|
||||||
[scripts/test/Makefile](http://code.google.com/p/googletest/source/browse/trunk/scripts/test/Makefile)
|
[scripts/test/Makefile](https://github.com/google/googletest/blob/master/googletest/scripts/test/Makefile)
|
||||||
file as an example on how to compile your tests against them.
|
file as an example on how to compile your tests against them.
|
||||||
|
|
||||||
# Where to Go from Here #
|
# Where to Go from Here #
|
||||||
|
|
||||||
Congratulations! You've now learned more advanced Google Test tools and are
|
Congratulations! You've now learned more advanced Google Test tools and are
|
||||||
ready to tackle more complex testing tasks. If you want to dive even deeper, you
|
ready to tackle more complex testing tasks. If you want to dive even deeper, you
|
||||||
can read the [Frequently-Asked Questions](FAQ.md).
|
can read the [Frequently-Asked Questions](FAQ.md).
|
||||||
|
@ -108,6 +108,7 @@ streamed to an assertion, it will be translated to UTF-8 when printed.
|
|||||||
## Basic Assertions ##
|
## Basic Assertions ##
|
||||||
|
|
||||||
These assertions do basic true/false condition testing.
|
These assertions do basic true/false condition testing.
|
||||||
|
|
||||||
| **Fatal assertion** | **Nonfatal assertion** | **Verifies** |
|
| **Fatal assertion** | **Nonfatal assertion** | **Verifies** |
|
||||||
|:--------------------|:-----------------------|:-------------|
|
|:--------------------|:-----------------------|:-------------|
|
||||||
| `ASSERT_TRUE(`_condition_`)`; | `EXPECT_TRUE(`_condition_`)`; | _condition_ is true |
|
| `ASSERT_TRUE(`_condition_`)`; | `EXPECT_TRUE(`_condition_`)`; | _condition_ is true |
|
||||||
@ -498,4 +499,4 @@ is currently _unsafe_ to use Google Test assertions from two threads
|
|||||||
concurrently on other systems (e.g. Windows). In most tests this is
|
concurrently on other systems (e.g. Windows). In most tests this is
|
||||||
not an issue as usually the assertions are done in the main thread. If
|
not an issue as usually the assertions are done in the main thread. If
|
||||||
you want to help, you can volunteer to implement the necessary
|
you want to help, you can volunteer to implement the necessary
|
||||||
synchronization primitives in `gtest-port.h` for your platform.
|
synchronization primitives in `gtest-port.h` for your platform.
|
||||||
|
@ -121,7 +121,9 @@ namespace internal {
|
|||||||
|
|
||||||
// Valid only for fast death tests. Indicates the code is running in the
|
// Valid only for fast death tests. Indicates the code is running in the
|
||||||
// child process of a fast style death test.
|
// child process of a fast style death test.
|
||||||
|
# if !GTEST_OS_WINDOWS
|
||||||
static bool g_in_fast_death_test_child = false;
|
static bool g_in_fast_death_test_child = false;
|
||||||
|
# endif
|
||||||
|
|
||||||
// Returns a Boolean value indicating whether the caller is currently
|
// Returns a Boolean value indicating whether the caller is currently
|
||||||
// executing in the context of the death test child process. Tools such as
|
// executing in the context of the death test child process. Tools such as
|
||||||
|
1
3rdparty/googletest/travis.sh
vendored
1
3rdparty/googletest/travis.sh
vendored
@ -9,6 +9,7 @@ cmake -Dgtest_build_samples=ON \
|
|||||||
-Dgmock_build_samples=ON \
|
-Dgmock_build_samples=ON \
|
||||||
-Dgtest_build_tests=ON \
|
-Dgtest_build_tests=ON \
|
||||||
-Dgmock_build_tests=ON \
|
-Dgmock_build_tests=ON \
|
||||||
|
-DCMAKE_CXX_FLAGS=$CXX_FLAGS \
|
||||||
../../$GTEST_TARGET
|
../../$GTEST_TARGET
|
||||||
make
|
make
|
||||||
make test
|
make test
|
||||||
|
Loading…
Reference in New Issue
Block a user