"src/git@developer.sourcefind.cn:jerrrrry/infinicore.git" did not exist on "2c168b6263c6ffd7df16ccce8c38072ba2b5a81b"
Commit 25905b9f authored by Gennadiy Civil's avatar Gennadiy Civil
Browse files

Merge branch 'master' of https://github.com/google/googletest

parents 4665eee1 3bedb5a9
...@@ -12,6 +12,7 @@ bazel-testlogs ...@@ -12,6 +12,7 @@ bazel-testlogs
*.pyc *.pyc
# Visual Studio files # Visual Studio files
.vs
*.sdf *.sdf
*.opensdf *.opensdf
*.VC.opendb *.VC.opendb
...@@ -41,6 +42,8 @@ googletest/fused-src/ ...@@ -41,6 +42,8 @@ googletest/fused-src/
# macOS files # macOS files
.DS_Store .DS_Store
googletest/.DS_Store
googletest/xcode/.DS_Store
# Ignore cmake generated directories and files. # Ignore cmake generated directories and files.
CMakeFiles CMakeFiles
......
...@@ -10,6 +10,13 @@ language: cpp ...@@ -10,6 +10,13 @@ language: cpp
# It is more tedious, but grants us far more flexibility. # It is more tedious, but grants us far more flexibility.
matrix: matrix:
include: include:
- os: linux
dist: trusty
sudo: required
group: deprecated-2017Q3
before_install: chmod -R +x ./ci/*platformio.sh
install: ./ci/install-platformio.sh
script: ./ci/build-platformio.sh
- os: linux - os: linux
compiler: gcc compiler: gcc
sudo : true sudo : true
......
...@@ -38,12 +38,7 @@ licenses(["notice"]) ...@@ -38,12 +38,7 @@ licenses(["notice"])
config_setting( config_setting(
name = "windows", name = "windows",
values = {"cpu": "x64_windows"}, constraint_values = ["@bazel_tools//platforms:windows"],
)
config_setting(
name = "windows_msvc",
values = {"cpu": "x64_windows_msvc"},
) )
config_setting( config_setting(
...@@ -51,6 +46,13 @@ config_setting( ...@@ -51,6 +46,13 @@ config_setting(
values = {"define": "absl=1"}, values = {"define": "absl=1"},
) )
# Library that defines the FRIEND_TEST macro.
cc_library(
name = "gtest_prod",
hdrs = ["googletest/include/gtest/gtest_prod.h"],
includes = ["googletest/include"],
)
# Google Test including Google Mock # Google Test including Google Mock
cc_library( cc_library(
name = "gtest", name = "gtest",
...@@ -73,21 +75,14 @@ cc_library( ...@@ -73,21 +75,14 @@ cc_library(
"googletest/include/gtest/*.h", "googletest/include/gtest/*.h",
"googlemock/include/gmock/*.h", "googlemock/include/gmock/*.h",
]), ]),
copts = select( copts = select({
{
":windows": [], ":windows": [],
":windows_msvc": [],
"//conditions:default": ["-pthread"], "//conditions:default": ["-pthread"],
}, }),
), defines = select({
defines = select( ":has_absl": ["GTEST_HAS_ABSL=1"],
{
":has_absl": [
"GTEST_HAS_ABSL=1",
],
"//conditions:default": [], "//conditions:default": [],
}, }),
),
includes = [ includes = [
"googlemock", "googlemock",
"googlemock/include", "googlemock/include",
...@@ -96,13 +91,9 @@ cc_library( ...@@ -96,13 +91,9 @@ cc_library(
], ],
linkopts = select({ linkopts = select({
":windows": [], ":windows": [],
":windows_msvc": [], "//conditions:default": ["-pthread"],
"//conditions:default": [
"-pthread",
],
}), }),
deps = select( deps = select({
{
":has_absl": [ ":has_absl": [
"@com_google_absl//absl/debugging:failure_signal_handler", "@com_google_absl//absl/debugging:failure_signal_handler",
"@com_google_absl//absl/debugging:stacktrace", "@com_google_absl//absl/debugging:stacktrace",
...@@ -112,15 +103,12 @@ cc_library( ...@@ -112,15 +103,12 @@ cc_library(
"@com_google_absl//absl/types:variant", "@com_google_absl//absl/types:variant",
], ],
"//conditions:default": [], "//conditions:default": [],
}, }),
),
) )
cc_library( cc_library(
name = "gtest_main", name = "gtest_main",
srcs = [ srcs = ["googlemock/src/gmock_main.cc"],
"googlemock/src/gmock_main.cc",
],
deps = [":gtest"], deps = [":gtest"],
) )
...@@ -174,7 +162,5 @@ cc_test( ...@@ -174,7 +162,5 @@ cc_test(
name = "sample10_unittest", name = "sample10_unittest",
size = "small", size = "small",
srcs = ["googletest/samples/sample10_unittest.cc"], srcs = ["googletest/samples/sample10_unittest.cc"],
deps = [ deps = [":gtest"],
":gtest",
],
) )
cmake_minimum_required(VERSION 2.8.8) cmake_minimum_required(VERSION 2.8.8)
add_definitions(-std=c++11)
if (CMAKE_VERSION VERSION_LESS "3.1")
add_definitions(-std=c++11)
else()
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
endif()
if (POLICY CMP0048) if (POLICY CMP0048)
cmake_policy(SET CMP0048 NEW) cmake_policy(SET CMP0048 NEW)
......
# Google Test # # Google Test #
[![Build Status](https://travis-ci.org/google/googletest.svg?branch=master)](https://travis-ci.org/google/googletest) [![Build Status](https://api.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/GoogleTestAppVeyor/googletest/branch/master) [![Build status](https://ci.appveyor.com/api/projects/status/4o38plt0xbo1ubc8/branch/master?svg=true)](https://ci.appveyor.com/project/GoogleTestAppVeyor/googletest/branch/master)
**Future Plans**: **Future Plans**:
...@@ -16,10 +16,8 @@ This repository is a merger of the formerly separate GoogleTest and ...@@ -16,10 +16,8 @@ This repository is a merger of the formerly separate GoogleTest and
GoogleMock projects. These were so closely related that it makes sense to GoogleMock projects. These were so closely related that it makes sense to
maintain and release them together. maintain and release them together.
Please see the project page above for more information as well as the Please subscribe to the mailing list at googletestframework@googlegroups.com for questions, discussions, and development.
mailing list for questions, discussions, and development. There is There is also an IRC channel on [OFTC](https://webchat.oftc.net/) (irc.oftc.net) #gtest available.
also an IRC channel on [OFTC](https://webchat.oftc.net/) (irc.oftc.net) #gtest available. Please
join us!
Getting started information for **Google Test** is available in the Getting started information for **Google Test** is available in the
[Google Test Primer](googletest/docs/primer.md) documentation. [Google Test Primer](googletest/docs/primer.md) documentation.
......
workspace(name = "com_google_googletest") workspace(name = "com_google_googletest")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
# Abseil # Abseil
http_archive( http_archive(
name = "com_google_absl", name = "com_google_absl",
......
# run PlatformIO builds
platformio run
...@@ -34,7 +34,8 @@ ...@@ -34,7 +34,8 @@
# #
# TODO() - we can check if this is being sourced using $BASH_VERSION and $BASH_SOURCE[0] != ${0}. # TODO() - we can check if this is being sourced using $BASH_VERSION and $BASH_SOURCE[0] != ${0}.
#
if [ "${TRAVIS_OS_NAME}" = "linux" ]; then if [ "${TRAVIS_OS_NAME}" = "osx" ]; then
if [ "$CXX" = "clang++" ]; then export CXX="clang++-3.9" CC="clang-3.9"; fi if [ "$CXX" = "clang++" ]; then export CXX="clang++-3.9" CC="clang-3.9"; fi
fi fi
# install PlatformIO
sudo pip install -U platformio
# update PlatformIO
platformio update
...@@ -75,18 +75,6 @@ set(gmock_build_include_dirs ...@@ -75,18 +75,6 @@ set(gmock_build_include_dirs
"${gtest_SOURCE_DIR}") "${gtest_SOURCE_DIR}")
include_directories(${gmock_build_include_dirs}) include_directories(${gmock_build_include_dirs})
# Summary of tuple support for Microsoft Visual Studio:
# Compiler version(MS) version(cmake) Support
# ---------- ----------- -------------- -----------------------------
# <= VS 2010 <= 10 <= 1600 Use Google Tests's own tuple.
# VS 2012 11 1700 std::tr1::tuple + _VARIADIC_MAX=10
# VS 2013 12 1800 std::tr1::tuple
# VS 2015 14 1900 std::tuple
# VS 2017 15 >= 1910 std::tuple
if (MSVC AND MSVC_VERSION EQUAL 1700)
add_definitions(/D _VARIADIC_MAX=10)
endif()
######################################################################## ########################################################################
# #
# Defines the gmock & gmock_main libraries. User tests should link # Defines the gmock & gmock_main libraries. User tests should link
...@@ -165,6 +153,7 @@ $env:Path = \"$project_bin;$env:Path\" ...@@ -165,6 +153,7 @@ $env:Path = \"$project_bin;$env:Path\"
cxx_test(gmock-actions_test gmock_main) cxx_test(gmock-actions_test gmock_main)
cxx_test(gmock-cardinalities_test gmock_main) cxx_test(gmock-cardinalities_test gmock_main)
cxx_test(gmock_ex_test gmock_main) cxx_test(gmock_ex_test gmock_main)
cxx_test(gmock-function-mocker_test gmock_main)
cxx_test(gmock-generated-actions_test gmock_main) cxx_test(gmock-generated-actions_test gmock_main)
cxx_test(gmock-generated-function-mockers_test gmock_main) cxx_test(gmock-generated-function-mockers_test gmock_main)
cxx_test(gmock-generated-internal-utils_test gmock_main) cxx_test(gmock-generated-internal-utils_test gmock_main)
...@@ -199,25 +188,12 @@ $env:Path = \"$project_bin;$env:Path\" ...@@ -199,25 +188,12 @@ $env:Path = \"$project_bin;$env:Path\"
cxx_library(gmock_main_no_rtti "${cxx_no_rtti}" cxx_library(gmock_main_no_rtti "${cxx_no_rtti}"
"${gtest_dir}/src/gtest-all.cc" src/gmock-all.cc src/gmock_main.cc) "${gtest_dir}/src/gtest-all.cc" src/gmock-all.cc src/gmock_main.cc)
if (MSVC_VERSION LESS 1600) # 1600 is Visual Studio 2010.
# Visual Studio 2010, 2012, and 2013 define symbols in std::tr1 that
# conflict with our own definitions. Therefore using our own tuple does not
# work on those compilers.
cxx_library(gmock_main_use_own_tuple "${cxx_use_own_tuple}"
"${gtest_dir}/src/gtest-all.cc" src/gmock-all.cc src/gmock_main.cc)
cxx_test_with_flags(gmock_use_own_tuple_test "${cxx_use_own_tuple}"
gmock_main_use_own_tuple test/gmock-spec-builders_test.cc)
endif()
else() else()
cxx_library(gmock_main_no_exception "${cxx_no_exception}" src/gmock_main.cc) cxx_library(gmock_main_no_exception "${cxx_no_exception}" src/gmock_main.cc)
target_link_libraries(gmock_main_no_exception PUBLIC gmock) target_link_libraries(gmock_main_no_exception PUBLIC gmock)
cxx_library(gmock_main_no_rtti "${cxx_no_rtti}" src/gmock_main.cc) cxx_library(gmock_main_no_rtti "${cxx_no_rtti}" src/gmock_main.cc)
target_link_libraries(gmock_main_no_rtti PUBLIC gmock) target_link_libraries(gmock_main_no_rtti PUBLIC gmock)
cxx_library(gmock_main_use_own_tuple "${cxx_use_own_tuple}" src/gmock_main.cc)
target_link_libraries(gmock_main_use_own_tuple PUBLIC gmock)
endif() endif()
cxx_test_with_flags(gmock-more-actions_no_exception_test "${cxx_no_exception}" cxx_test_with_flags(gmock-more-actions_no_exception_test "${cxx_no_exception}"
gmock_main_no_exception test/gmock-more-actions_test.cc) gmock_main_no_exception test/gmock-more-actions_test.cc)
......
...@@ -28,13 +28,14 @@ lib_libgmock_la_SOURCES = src/gmock-all.cc ...@@ -28,13 +28,14 @@ lib_libgmock_la_SOURCES = src/gmock-all.cc
pkginclude_HEADERS = \ pkginclude_HEADERS = \
include/gmock/gmock-actions.h \ include/gmock/gmock-actions.h \
include/gmock/gmock-cardinalities.h \ include/gmock/gmock-cardinalities.h \
include/gmock/gmock-function-mocker.h \
include/gmock/gmock-generated-actions.h \ include/gmock/gmock-generated-actions.h \
include/gmock/gmock-generated-function-mockers.h \ include/gmock/gmock-generated-function-mockers.h \
include/gmock/gmock-generated-matchers.h \ include/gmock/gmock-generated-matchers.h \
include/gmock/gmock-generated-nice-strict.h \
include/gmock/gmock-matchers.h \ include/gmock/gmock-matchers.h \
include/gmock/gmock-more-actions.h \ include/gmock/gmock-more-actions.h \
include/gmock/gmock-more-matchers.h \ include/gmock/gmock-more-matchers.h \
include/gmock/gmock-nice-strict.h \
include/gmock/gmock-spec-builders.h \ include/gmock/gmock-spec-builders.h \
include/gmock/gmock.h include/gmock/gmock.h
...@@ -43,6 +44,7 @@ pkginclude_internal_HEADERS = \ ...@@ -43,6 +44,7 @@ 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/gmock-pp.h \
include/gmock/internal/custom/gmock-generated-actions.h \ include/gmock/internal/custom/gmock-generated-actions.h \
include/gmock/internal/custom/gmock-matchers.h \ include/gmock/internal/custom/gmock-matchers.h \
include/gmock/internal/custom/gmock-port.h include/gmock/internal/custom/gmock-port.h
...@@ -107,6 +109,7 @@ EXTRA_DIST += \ ...@@ -107,6 +109,7 @@ EXTRA_DIST += \
test/gmock-cardinalities_test.cc \ test/gmock-cardinalities_test.cc \
test/gmock_ex_test.cc \ test/gmock_ex_test.cc \
test/gmock-generated-actions_test.cc \ test/gmock-generated-actions_test.cc \
test/gmock-function-mocker_test.cc \
test/gmock-generated-function-mockers_test.cc \ test/gmock-generated-function-mockers_test.cc \
test/gmock-generated-internal-utils_test.cc \ test/gmock-generated-internal-utils_test.cc \
test/gmock-generated-matchers_test.cc \ test/gmock-generated-matchers_test.cc \
...@@ -138,7 +141,6 @@ EXTRA_DIST += \ ...@@ -138,7 +141,6 @@ EXTRA_DIST += \
include/gmock/gmock-generated-actions.h.pump \ include/gmock/gmock-generated-actions.h.pump \
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/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 include/gmock/internal/custom/gmock-generated-actions.h.pump
......
...@@ -35,7 +35,7 @@ We hope you find it useful! ...@@ -35,7 +35,7 @@ We hope you find it useful!
* Does automatic verification of expectations (no record-and-replay needed). * Does automatic verification of expectations (no record-and-replay needed).
* Allows arbitrary (partial) ordering constraints on * Allows arbitrary (partial) ordering constraints on
function calls to be expressed,. function calls to be expressed,.
* Lets an user extend it by defining new matchers and actions. * Lets a user extend it by defining new matchers and actions.
* Does not use exceptions. * Does not use exceptions.
* Is easy to learn and use. * Is easy to learn and use.
......
libdir=@CMAKE_INSTALL_FULL_LIBDIR@ prefix=${pcfiledir}/../..
includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@ libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@
includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@
Name: gmock Name: gmock
Description: GoogleMock (without main() function) Description: GoogleMock (without main() function)
......
libdir=@CMAKE_INSTALL_FULL_LIBDIR@ prefix=${pcfiledir}/../..
includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@ libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@
includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@
Name: gmock_main Name: gmock_main
Description: GoogleMock (with main() function) Description: GoogleMock (with main() function)
......
...@@ -181,6 +181,7 @@ divided into several categories: ...@@ -181,6 +181,7 @@ divided into several categories:
|`Ne(value)` |`argument != value`| |`Ne(value)` |`argument != value`|
|`IsNull()` |`argument` is a `NULL` pointer (raw or smart).| |`IsNull()` |`argument` is a `NULL` pointer (raw or smart).|
|`NotNull()` |`argument` is a non-null pointer (raw or smart).| |`NotNull()` |`argument` is a non-null pointer (raw or smart).|
|`Optional(m)` |`argument` is `optional<>` that contains a value matching `m`.|
|`VariantWith<T>(m)` |`argument` is `variant<>` that holds the alternative of type T with a value matching `m`.| |`VariantWith<T>(m)` |`argument` is `variant<>` that holds the alternative of type T with a value matching `m`.|
|`Ref(variable)` |`argument` is a reference to `variable`.| |`Ref(variable)` |`argument` is a reference to `variable`.|
|`TypedEq<type>(value)`|`argument` has type `type` and is equal to `value`. You may need to use this instead of `Eq(value)` when the mock function is overloaded.| |`TypedEq<type>(value)`|`argument` has type `type` and is equal to `value`. You may need to use this instead of `Eq(value)` when the mock function is overloaded.|
......
...@@ -42,15 +42,19 @@ ...@@ -42,15 +42,19 @@
#endif #endif
#include <algorithm> #include <algorithm>
#include <functional>
#include <memory>
#include <string> #include <string>
#include <type_traits>
#include <utility>
#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"
#if GTEST_LANG_CXX11 // Defined by gtest-port.h via gmock-port.h. #ifdef _MSC_VER
#include <functional> # pragma warning(push)
#include <type_traits> # pragma warning(disable:4100)
#endif // GTEST_LANG_CXX11 #endif
namespace testing { namespace testing {
...@@ -65,9 +69,6 @@ namespace testing { ...@@ -65,9 +69,6 @@ namespace testing {
namespace internal { namespace internal {
template <typename F1, typename F2>
class ActionAdaptor;
// BuiltInDefaultValueGetter<T, true>::Get() returns a // BuiltInDefaultValueGetter<T, true>::Get() returns a
// default-constructed T value. BuiltInDefaultValueGetter<T, // default-constructed T value. BuiltInDefaultValueGetter<T,
// false>::Get() crashes with an error. // false>::Get() crashes with an error.
...@@ -98,7 +99,6 @@ struct BuiltInDefaultValueGetter<T, false> { ...@@ -98,7 +99,6 @@ struct BuiltInDefaultValueGetter<T, false> {
template <typename T> template <typename T>
class BuiltInDefaultValue { class BuiltInDefaultValue {
public: public:
#if GTEST_LANG_CXX11
// This function returns true iff type T has a built-in default value. // This function returns true iff type T has a built-in default value.
static bool Exists() { static bool Exists() {
return ::std::is_default_constructible<T>::value; return ::std::is_default_constructible<T>::value;
...@@ -108,18 +108,6 @@ class BuiltInDefaultValue { ...@@ -108,18 +108,6 @@ class BuiltInDefaultValue {
return BuiltInDefaultValueGetter< return BuiltInDefaultValueGetter<
T, ::std::is_default_constructible<T>::value>::Get(); T, ::std::is_default_constructible<T>::value>::Get();
} }
#else // GTEST_LANG_CXX11
// This function returns true iff type T has a built-in default value.
static bool Exists() {
return false;
}
static T Get() {
return BuiltInDefaultValueGetter<T, false>::Get();
}
#endif // GTEST_LANG_CXX11
}; };
// This partial specialization says that we use the same built-in // This partial specialization says that we use the same built-in
...@@ -250,7 +238,7 @@ class DefaultValue { ...@@ -250,7 +238,7 @@ class DefaultValue {
class FixedValueProducer : public ValueProducer { class FixedValueProducer : public ValueProducer {
public: public:
explicit FixedValueProducer(T value) : value_(value) {} explicit FixedValueProducer(T value) : value_(value) {}
virtual T Produce() { return value_; } T Produce() override { return value_; }
private: private:
const T value_; const T value_;
...@@ -261,7 +249,7 @@ class DefaultValue { ...@@ -261,7 +249,7 @@ class DefaultValue {
public: public:
explicit FactoryValueProducer(FactoryFunction factory) explicit FactoryValueProducer(FactoryFunction factory)
: factory_(factory) {} : factory_(factory) {}
virtual T Produce() { return factory_(); } T Produce() override { return factory_(); }
private: private:
const FactoryFunction factory_; const FactoryFunction factory_;
...@@ -345,14 +333,25 @@ class ActionInterface { ...@@ -345,14 +333,25 @@ class ActionInterface {
// An Action<F> is a copyable and IMMUTABLE (except by assignment) // An Action<F> is a copyable and IMMUTABLE (except by assignment)
// object that represents an action to be taken when a mock function // object that represents an action to be taken when a mock function
// of type F is called. The implementation of Action<T> is just a // of type F is called. The implementation of Action<T> is just a
// linked_ptr to const ActionInterface<T>, so copying is fairly cheap. // std::shared_ptr to const ActionInterface<T>. Don't inherit from Action!
// Don't inherit from Action!
//
// You can view an object implementing ActionInterface<F> as a // You can view an object implementing ActionInterface<F> as a
// concrete action (including its current state), and an Action<F> // concrete action (including its current state), and an Action<F>
// object as a handle to it. // object as a handle to it.
template <typename F> template <typename F>
class Action { class Action {
// Adapter class to allow constructing Action from a legacy ActionInterface.
// New code should create Actions from functors instead.
struct ActionAdapter {
// Adapter must be copyable to satisfy std::function requirements.
::std::shared_ptr<ActionInterface<F>> impl_;
template <typename... Args>
typename internal::Function<F>::Result operator()(Args&&... args) {
return impl_->Perform(
::std::forward_as_tuple(::std::forward<Args>(args)...));
}
};
public: public:
typedef typename internal::Function<F>::Result Result; typedef typename internal::Function<F>::Result Result;
typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple; typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
...@@ -361,7 +360,6 @@ class Action { ...@@ -361,7 +360,6 @@ class Action {
// STL containers. // STL containers.
Action() {} Action() {}
#if GTEST_LANG_CXX11
// Construct an Action from a specified callable. // Construct an Action from a specified callable.
// This cannot take std::function directly, because then Action would not be // This cannot take std::function directly, because then Action would not be
// directly constructible from lambda (it would require two conversions). // directly constructible from lambda (it would require two conversions).
...@@ -369,26 +367,19 @@ class Action { ...@@ -369,26 +367,19 @@ class Action {
typename = typename ::std::enable_if< typename = typename ::std::enable_if<
::std::is_constructible<::std::function<F>, G>::value>::type> ::std::is_constructible<::std::function<F>, G>::value>::type>
Action(G&& fun) : fun_(::std::forward<G>(fun)) {} // NOLINT Action(G&& fun) : fun_(::std::forward<G>(fun)) {} // NOLINT
#endif
// Constructs an Action from its implementation. // Constructs an Action from its implementation.
explicit Action(ActionInterface<F>* impl) : impl_(impl) {} explicit Action(ActionInterface<F>* impl)
: fun_(ActionAdapter{::std::shared_ptr<ActionInterface<F>>(impl)}) {}
// This constructor allows us to turn an Action<Func> object into an // This constructor allows us to turn an Action<Func> object into an
// Action<F>, as long as F's arguments can be implicitly converted // Action<F>, as long as F's arguments can be implicitly converted
// to Func's and Func's return type can be implicitly converted to // to Func's and Func's return type can be implicitly converted to F's.
// F's.
template <typename Func> template <typename Func>
explicit Action(const Action<Func>& action); explicit Action(const Action<Func>& action) : fun_(action.fun_) {}
// Returns true iff this is the DoDefault() action. // Returns true iff this is the DoDefault() action.
bool IsDoDefault() const { bool IsDoDefault() const { return fun_ == nullptr; }
#if GTEST_LANG_CXX11
return impl_ == nullptr && fun_ == nullptr;
#else
return impl_ == NULL;
#endif
}
// Performs the action. Note that this method is const even though // Performs the action. Note that this method is const even though
// the corresponding method in ActionInterface is not. The reason // the corresponding method in ActionInterface is not. The reason
...@@ -400,31 +391,15 @@ class Action { ...@@ -400,31 +391,15 @@ class Action {
if (IsDoDefault()) { if (IsDoDefault()) {
internal::IllegalDoDefault(__FILE__, __LINE__); internal::IllegalDoDefault(__FILE__, __LINE__);
} }
#if GTEST_LANG_CXX11
if (fun_ != nullptr) {
return internal::Apply(fun_, ::std::move(args)); return internal::Apply(fun_, ::std::move(args));
} }
#endif
return impl_->Perform(args);
}
private: private:
template <typename F1, typename F2>
friend class internal::ActionAdaptor;
template <typename G> template <typename G>
friend class Action; friend class Action;
// In C++11, Action can be implemented either as a generic functor (through // fun_ is an empty function iff this is the DoDefault() action.
// std::function), or legacy ActionInterface. In C++98, only ActionInterface
// is available. The invariants are as follows:
// * in C++98, impl_ is null iff this is the default action
// * in C++11, at most one of fun_ & impl_ may be nonnull; both are null iff
// this is the default action
#if GTEST_LANG_CXX11
::std::function<F> fun_; ::std::function<F> fun_;
#endif
internal::linked_ptr<ActionInterface<F> > impl_;
}; };
// The PolymorphicAction class template makes it easy to implement a // The PolymorphicAction class template makes it easy to implement a
...@@ -439,7 +414,7 @@ class Action { ...@@ -439,7 +414,7 @@ class Action {
// template <typename Result, typename ArgumentTuple> // template <typename Result, typename ArgumentTuple>
// Result Perform(const ArgumentTuple& args) const { // Result Perform(const ArgumentTuple& args) const {
// // Processes the arguments and returns a result, using // // Processes the arguments and returns a result, using
// // tr1::get<N>(args) to get the N-th (0-based) argument in the tuple. // // std::get<N>(args) to get the N-th (0-based) argument in the tuple.
// } // }
// ... // ...
// }; // };
...@@ -467,7 +442,7 @@ class PolymorphicAction { ...@@ -467,7 +442,7 @@ class PolymorphicAction {
explicit MonomorphicImpl(const Impl& impl) : impl_(impl) {} explicit MonomorphicImpl(const Impl& impl) : impl_(impl) {}
virtual Result Perform(const ArgumentTuple& args) { Result Perform(const ArgumentTuple& args) override {
return impl_.template Perform<Result>(args); return impl_.template Perform<Result>(args);
} }
...@@ -503,31 +478,11 @@ inline PolymorphicAction<Impl> MakePolymorphicAction(const Impl& impl) { ...@@ -503,31 +478,11 @@ inline PolymorphicAction<Impl> MakePolymorphicAction(const Impl& impl) {
namespace internal { namespace internal {
// Allows an Action<F2> object to pose as an Action<F1>, as long as F2
// and F1 are compatible.
template <typename F1, typename F2>
class ActionAdaptor : public ActionInterface<F1> {
public:
typedef typename internal::Function<F1>::Result Result;
typedef typename internal::Function<F1>::ArgumentTuple ArgumentTuple;
explicit ActionAdaptor(const Action<F2>& from) : impl_(from.impl_) {}
virtual Result Perform(const ArgumentTuple& args) {
return impl_->Perform(args);
}
private:
const internal::linked_ptr<ActionInterface<F2> > impl_;
GTEST_DISALLOW_ASSIGN_(ActionAdaptor);
};
// Helper struct to specialize ReturnAction to execute a move instead of a copy // Helper struct to specialize ReturnAction to execute a move instead of a copy
// on return. Useful for move-only types, but could be used on any type. // on return. Useful for move-only types, but could be used on any type.
template <typename T> template <typename T>
struct ByMoveWrapper { struct ByMoveWrapper {
explicit ByMoveWrapper(T value) : payload(internal::move(value)) {} explicit ByMoveWrapper(T value) : payload(std::move(value)) {}
T payload; T payload;
}; };
...@@ -564,12 +519,12 @@ class ReturnAction { ...@@ -564,12 +519,12 @@ class ReturnAction {
// Constructs a ReturnAction object from the value to be returned. // Constructs a ReturnAction object from the value to be returned.
// 'value' is passed by value instead of by const reference in order // 'value' is passed by value instead of by const reference in order
// to allow Return("string literal") to compile. // to allow Return("string literal") to compile.
explicit ReturnAction(R value) : value_(new R(internal::move(value))) {} explicit ReturnAction(R value) : value_(new R(std::move(value))) {}
// This template type conversion operator allows Return(x) to be // This template type conversion operator allows Return(x) to be
// used in ANY function that returns x's type. // used in ANY function that returns x's type.
template <typename F> template <typename F>
operator Action<F>() const { operator Action<F>() const { // NOLINT
// Assert statement belongs here because this is the best place to verify // Assert statement belongs here because this is the best place to verify
// conditions on F. It produces the clearest error messages // conditions on F. It produces the clearest error messages
// in most compilers. // in most compilers.
...@@ -582,6 +537,8 @@ class ReturnAction { ...@@ -582,6 +537,8 @@ class ReturnAction {
GTEST_COMPILE_ASSERT_( GTEST_COMPILE_ASSERT_(
!is_reference<Result>::value, !is_reference<Result>::value,
use_ReturnRef_instead_of_Return_to_return_a_reference); use_ReturnRef_instead_of_Return_to_return_a_reference);
static_assert(!std::is_void<Result>::value,
"Can't use Return() on an action expected to return `void`.");
return Action<F>(new Impl<R, F>(value_)); return Action<F>(new Impl<R, F>(value_));
} }
...@@ -600,11 +557,11 @@ class ReturnAction { ...@@ -600,11 +557,11 @@ class ReturnAction {
// Result to call. ImplicitCast_ forces the compiler to convert R to // Result to call. ImplicitCast_ forces the compiler to convert R to
// Result without considering explicit constructors, thus resolving the // Result without considering explicit constructors, thus resolving the
// ambiguity. value_ is then initialized using its copy constructor. // ambiguity. value_ is then initialized using its copy constructor.
explicit Impl(const linked_ptr<R>& value) explicit Impl(const std::shared_ptr<R>& value)
: value_before_cast_(*value), : value_before_cast_(*value),
value_(ImplicitCast_<Result>(value_before_cast_)) {} value_(ImplicitCast_<Result>(value_before_cast_)) {}
virtual Result Perform(const ArgumentTuple&) { return value_; } Result Perform(const ArgumentTuple&) override { return value_; }
private: private:
GTEST_COMPILE_ASSERT_(!is_reference<Result>::value, GTEST_COMPILE_ASSERT_(!is_reference<Result>::value,
...@@ -625,24 +582,24 @@ class ReturnAction { ...@@ -625,24 +582,24 @@ class ReturnAction {
typedef typename Function<F>::Result Result; typedef typename Function<F>::Result Result;
typedef typename Function<F>::ArgumentTuple ArgumentTuple; typedef typename Function<F>::ArgumentTuple ArgumentTuple;
explicit Impl(const linked_ptr<R>& wrapper) explicit Impl(const std::shared_ptr<R>& wrapper)
: performed_(false), wrapper_(wrapper) {} : performed_(false), wrapper_(wrapper) {}
virtual Result Perform(const ArgumentTuple&) { Result Perform(const ArgumentTuple&) override {
GTEST_CHECK_(!performed_) GTEST_CHECK_(!performed_)
<< "A ByMove() action should only be performed once."; << "A ByMove() action should only be performed once.";
performed_ = true; performed_ = true;
return internal::move(wrapper_->payload); return std::move(wrapper_->payload);
} }
private: private:
bool performed_; bool performed_;
const linked_ptr<R> wrapper_; const std::shared_ptr<R> wrapper_;
GTEST_DISALLOW_ASSIGN_(Impl); GTEST_DISALLOW_ASSIGN_(Impl);
}; };
const linked_ptr<R> value_; const std::shared_ptr<R> value_;
GTEST_DISALLOW_ASSIGN_(ReturnAction); GTEST_DISALLOW_ASSIGN_(ReturnAction);
}; };
...@@ -655,13 +612,7 @@ class ReturnNullAction { ...@@ -655,13 +612,7 @@ class ReturnNullAction {
// pointer type on compile time. // pointer type on compile time.
template <typename Result, typename ArgumentTuple> template <typename Result, typename ArgumentTuple>
static Result Perform(const ArgumentTuple&) { static Result Perform(const ArgumentTuple&) {
#if GTEST_LANG_CXX11
return nullptr; return nullptr;
#else
GTEST_COMPILE_ASSERT_(internal::is_pointer<Result>::value,
ReturnNull_can_be_used_to_return_a_pointer_only);
return NULL;
#endif // GTEST_LANG_CXX11
} }
}; };
...@@ -707,9 +658,7 @@ class ReturnRefAction { ...@@ -707,9 +658,7 @@ class ReturnRefAction {
explicit Impl(T& ref) : ref_(ref) {} // NOLINT explicit Impl(T& ref) : ref_(ref) {} // NOLINT
virtual Result Perform(const ArgumentTuple&) { Result Perform(const ArgumentTuple&) override { return ref_; }
return ref_;
}
private: private:
T& ref_; T& ref_;
...@@ -756,9 +705,7 @@ class ReturnRefOfCopyAction { ...@@ -756,9 +705,7 @@ class ReturnRefOfCopyAction {
explicit Impl(const T& value) : value_(value) {} // NOLINT explicit Impl(const T& value) : value_(value) {} // NOLINT
virtual Result Perform(const ArgumentTuple&) { Result Perform(const ArgumentTuple&) override { return value_; }
return value_;
}
private: private:
T value_; T value_;
...@@ -838,7 +785,7 @@ class SetArgumentPointeeAction { ...@@ -838,7 +785,7 @@ class SetArgumentPointeeAction {
template <typename Result, typename ArgumentTuple> template <typename Result, typename ArgumentTuple>
void Perform(const ArgumentTuple& args) const { void Perform(const ArgumentTuple& args) const {
CompileAssertTypesEqual<void, Result>(); CompileAssertTypesEqual<void, Result>();
*::testing::get<N>(args) = value_; *::std::get<N>(args) = value_;
} }
private: private:
...@@ -861,11 +808,11 @@ class SetArgumentPointeeAction<N, Proto, true> { ...@@ -861,11 +808,11 @@ class SetArgumentPointeeAction<N, Proto, true> {
template <typename Result, typename ArgumentTuple> template <typename Result, typename ArgumentTuple>
void Perform(const ArgumentTuple& args) const { void Perform(const ArgumentTuple& args) const {
CompileAssertTypesEqual<void, Result>(); CompileAssertTypesEqual<void, Result>();
::testing::get<N>(args)->CopyFrom(*proto_); ::std::get<N>(args)->CopyFrom(*proto_);
} }
private: private:
const internal::linked_ptr<Proto> proto_; const std::shared_ptr<Proto> proto_;
GTEST_DISALLOW_ASSIGN_(SetArgumentPointeeAction); GTEST_DISALLOW_ASSIGN_(SetArgumentPointeeAction);
}; };
...@@ -930,7 +877,7 @@ class InvokeCallbackWithoutArgsAction { ...@@ -930,7 +877,7 @@ class InvokeCallbackWithoutArgsAction {
Result Perform(const ArgumentTuple&) const { return callback_->Run(); } Result Perform(const ArgumentTuple&) const { return callback_->Run(); }
private: private:
const internal::linked_ptr<CallbackType> callback_; const std::shared_ptr<CallbackType> callback_;
GTEST_DISALLOW_ASSIGN_(InvokeCallbackWithoutArgsAction); GTEST_DISALLOW_ASSIGN_(InvokeCallbackWithoutArgsAction);
}; };
...@@ -968,7 +915,7 @@ class IgnoreResultAction { ...@@ -968,7 +915,7 @@ class IgnoreResultAction {
explicit Impl(const A& action) : action_(action) {} explicit Impl(const A& action) : action_(action) {}
virtual void Perform(const ArgumentTuple& args) { void Perform(const ArgumentTuple& args) override {
// Performs the action and ignores its result. // Performs the action and ignores its result.
action_.Perform(args); action_.Perform(args);
} }
...@@ -1016,49 +963,51 @@ void PrintTo(const ReferenceWrapper<T>& ref, ::std::ostream* os) { ...@@ -1016,49 +963,51 @@ void PrintTo(const ReferenceWrapper<T>& ref, ::std::ostream* os) {
UniversalPrinter<T&>::Print(value, os); UniversalPrinter<T&>::Print(value, os);
} }
// Does two actions sequentially. Used for implementing the DoAll(a1, template <typename InnerAction, size_t... I>
// a2, ...) action. struct WithArgsAction {
template <typename Action1, typename Action2> InnerAction action;
class DoBothAction {
public:
DoBothAction(Action1 action1, Action2 action2)
: action1_(action1), action2_(action2) {}
// This template type conversion operator allows DoAll(a1, ..., a_n) // The inner action could be anything convertible to Action<X>.
// to be used in ANY function of compatible type. // We use the conversion operator to detect the signature of the inner Action.
template <typename F> template <typename R, typename... Args>
operator Action<F>() const { operator Action<R(Args...)>() const { // NOLINT
return Action<F>(new Impl<F>(action1_, action2_)); Action<R(typename std::tuple_element<I, std::tuple<Args...>>::type...)>
} converted(action);
private: return [converted](Args... args) -> R {
// Implements the DoAll(...) action for a particular function type F. return converted.Perform(std::forward_as_tuple(
template <typename F> std::get<I>(std::forward_as_tuple(std::forward<Args>(args)...))...));
class Impl : public ActionInterface<F> { };
public:
typedef typename Function<F>::Result Result;
typedef typename Function<F>::ArgumentTuple ArgumentTuple;
typedef typename Function<F>::MakeResultVoid VoidResult;
Impl(const Action<VoidResult>& action1, const Action<F>& action2)
: action1_(action1), action2_(action2) {}
virtual Result Perform(const ArgumentTuple& args) {
action1_.Perform(args);
return action2_.Perform(args);
} }
};
template <typename... Actions>
struct DoAllAction {
private: private:
const Action<VoidResult> action1_; template <typename... Args, size_t... I>
const Action<F> action2_; std::vector<Action<void(Args...)>> Convert(IndexSequence<I...>) const {
return {std::get<I>(actions)...};
}
GTEST_DISALLOW_ASSIGN_(Impl); public:
std::tuple<Actions...> actions;
template <typename R, typename... Args>
operator Action<R(Args...)>() const { // NOLINT
struct Op {
std::vector<Action<void(Args...)>> converted;
Action<R(Args...)> last;
R operator()(Args... args) const {
auto tuple_args = std::forward_as_tuple(std::forward<Args>(args)...);
for (auto& a : converted) {
a.Perform(tuple_args);
}
return last.Perform(tuple_args);
}
}; };
return Op{Convert<Args...>(MakeIndexSequence<sizeof...(Actions) - 1>()),
Action1 action1_; std::get<sizeof...(Actions) - 1>(actions)};
Action2 action2_; }
GTEST_DISALLOW_ASSIGN_(DoBothAction);
}; };
} // namespace internal } // namespace internal
...@@ -1095,20 +1044,43 @@ class DoBothAction { ...@@ -1095,20 +1044,43 @@ class DoBothAction {
// EXPECT_CALL(mock, Bar(5, _, _)).WillOnce(Invoke(DistanceToOrigin)); // EXPECT_CALL(mock, Bar(5, _, _)).WillOnce(Invoke(DistanceToOrigin));
typedef internal::IgnoredValue Unused; typedef internal::IgnoredValue Unused;
// This constructor allows us to turn an Action<From> object into an // Creates an action that does actions a1, a2, ..., sequentially in
// Action<To>, as long as To's arguments can be implicitly converted // each invocation.
// to From's and From's return type cann be implicitly converted to template <typename... Action>
// To's. internal::DoAllAction<typename std::decay<Action>::type...> DoAll(
template <typename To> Action&&... action) {
template <typename From> return {std::forward_as_tuple(std::forward<Action>(action)...)};
Action<To>::Action(const Action<From>& from) }
:
#if GTEST_LANG_CXX11 // WithArg<k>(an_action) creates an action that passes the k-th
fun_(from.fun_), // (0-based) argument of the mock function to an_action and performs
#endif // it. It adapts an action accepting one argument to one that accepts
impl_(from.impl_ == nullptr // multiple arguments. For convenience, we also provide
? nullptr // WithArgs<k>(an_action) (defined below) as a synonym.
: new internal::ActionAdaptor<To, From>(from)) { template <size_t k, typename InnerAction>
internal::WithArgsAction<typename std::decay<InnerAction>::type, k>
WithArg(InnerAction&& action) {
return {std::forward<InnerAction>(action)};
}
// WithArgs<N1, N2, ..., Nk>(an_action) creates an action that passes
// the selected arguments of the mock function to an_action and
// performs it. It serves as an adaptor between actions with
// different argument lists.
template <size_t k, size_t... ks, typename InnerAction>
internal::WithArgsAction<typename std::decay<InnerAction>::type, k, ks...>
WithArgs(InnerAction&& action) {
return {std::forward<InnerAction>(action)};
}
// WithoutArgs(inner_action) can be used in a mock function with a
// non-empty argument list to perform inner_action, which takes no
// argument. In other words, it adapts an action accepting no
// argument to one that accepts (and ignores) arguments.
template <typename InnerAction>
internal::WithArgsAction<typename std::decay<InnerAction>::type>
WithoutArgs(InnerAction&& action) {
return {std::forward<InnerAction>(action)};
} }
// Creates an action that returns 'value'. 'value' is passed by value // Creates an action that returns 'value'. 'value' is passed by value
...@@ -1116,7 +1088,7 @@ Action<To>::Action(const Action<From>& from) ...@@ -1116,7 +1088,7 @@ Action<To>::Action(const Action<From>& from)
// will trigger a compiler error about using array as initializer. // will trigger a compiler error about using array as initializer.
template <typename R> template <typename R>
internal::ReturnAction<R> Return(R value) { internal::ReturnAction<R> Return(R value) {
return internal::ReturnAction<R>(internal::move(value)); return internal::ReturnAction<R>(std::move(value));
} }
// Creates an action that returns NULL. // Creates an action that returns NULL.
...@@ -1149,7 +1121,7 @@ inline internal::ReturnRefOfCopyAction<R> ReturnRefOfCopy(const R& x) { ...@@ -1149,7 +1121,7 @@ inline internal::ReturnRefOfCopyAction<R> ReturnRefOfCopy(const R& x) {
// invariant. // invariant.
template <typename R> template <typename R>
internal::ByMoveWrapper<R> ByMove(R x) { internal::ByMoveWrapper<R> ByMove(R x) {
return internal::ByMoveWrapper<R>(internal::move(x)); return internal::ByMoveWrapper<R>(std::move(x));
} }
// Creates an action that does the default action for the give mock function. // Creates an action that does the default action for the give mock function.
...@@ -1259,4 +1231,9 @@ inline internal::ReferenceWrapper<T> ByRef(T& l_value) { // NOLINT ...@@ -1259,4 +1231,9 @@ inline internal::ReferenceWrapper<T> ByRef(T& l_value) { // NOLINT
} // namespace testing } // namespace testing
#ifdef _MSC_VER
# pragma warning(pop)
#endif
#endif // GMOCK_INCLUDE_GMOCK_GMOCK_ACTIONS_H_ #endif // GMOCK_INCLUDE_GMOCK_GMOCK_ACTIONS_H_
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
#define GMOCK_INCLUDE_GMOCK_GMOCK_CARDINALITIES_H_ #define GMOCK_INCLUDE_GMOCK_GMOCK_CARDINALITIES_H_
#include <limits.h> #include <limits.h>
#include <memory>
#include <ostream> // NOLINT #include <ostream> // NOLINT
#include "gmock/internal/gmock-port.h" #include "gmock/internal/gmock-port.h"
#include "gtest/gtest.h" #include "gtest/gtest.h"
...@@ -81,9 +82,8 @@ class CardinalityInterface { ...@@ -81,9 +82,8 @@ class CardinalityInterface {
// A Cardinality is a copyable and IMMUTABLE (except by assignment) // A Cardinality is a copyable and IMMUTABLE (except by assignment)
// object that specifies how many times a mock function is expected to // object that specifies how many times a mock function is expected to
// be called. The implementation of Cardinality is just a linked_ptr // be called. The implementation of Cardinality is just a std::shared_ptr
// to const CardinalityInterface, so copying is fairly cheap. // to const CardinalityInterface. Don't inherit from Cardinality!
// Don't inherit from Cardinality!
class GTEST_API_ Cardinality { class GTEST_API_ Cardinality {
public: public:
// Constructs a null cardinality. Needed for storing Cardinality // Constructs a null cardinality. Needed for storing Cardinality
...@@ -123,7 +123,7 @@ class GTEST_API_ Cardinality { ...@@ -123,7 +123,7 @@ class GTEST_API_ Cardinality {
::std::ostream* os); ::std::ostream* os);
private: private:
internal::linked_ptr<const CardinalityInterface> impl_; std::shared_ptr<const CardinalityInterface> impl_;
}; };
// Creates a cardinality that allows at least n calls. // Creates a cardinality that allows at least n calls.
......
#ifndef THIRD_PARTY_GOOGLETEST_GOOGLEMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_FUNCTION_MOCKER_H_ // NOLINT
#define THIRD_PARTY_GOOGLETEST_GOOGLEMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_FUNCTION_MOCKER_H_ // NOLINT
#include "gmock/gmock-generated-function-mockers.h" // NOLINT
#include "gmock/internal/gmock-pp.h"
#define MOCK_METHOD(...) \
GMOCK_PP_VARIADIC_CALL(GMOCK_INTERNAL_MOCK_METHOD_ARG_, __VA_ARGS__)
#define GMOCK_INTERNAL_MOCK_METHOD_ARG_1(...) \
GMOCK_INTERNAL_WRONG_ARITY(__VA_ARGS__)
#define GMOCK_INTERNAL_MOCK_METHOD_ARG_2(...) \
GMOCK_INTERNAL_WRONG_ARITY(__VA_ARGS__)
#define GMOCK_INTERNAL_MOCK_METHOD_ARG_3(_Ret, _MethodName, _Args) \
GMOCK_INTERNAL_MOCK_METHOD_ARG_4(_Ret, _MethodName, _Args, ())
#define GMOCK_INTERNAL_MOCK_METHOD_ARG_4(_Ret, _MethodName, _Args, _Spec) \
GMOCK_INTERNAL_ASSERT_PARENTHESIS(_Args); \
GMOCK_INTERNAL_ASSERT_PARENTHESIS(_Spec); \
GMOCK_INTERNAL_ASSERT_VALID_SIGNATURE( \
GMOCK_PP_NARG0 _Args, GMOCK_INTERNAL_SIGNATURE(_Ret, _Args)); \
GMOCK_INTERNAL_ASSERT_VALID_SPEC(_Spec); \
GMOCK_INTERNAL_MOCK_METHOD_IMPL( \
GMOCK_PP_NARG0 _Args, _MethodName, GMOCK_INTERNAL_HAS_CONST(_Spec), \
GMOCK_INTERNAL_HAS_OVERRIDE(_Spec), GMOCK_INTERNAL_HAS_FINAL(_Spec), \
GMOCK_INTERNAL_HAS_NOEXCEPT(_Spec), GMOCK_INTERNAL_GET_CALLTYPE(_Spec), \
(GMOCK_INTERNAL_SIGNATURE(_Ret, _Args)))
#define GMOCK_INTERNAL_MOCK_METHOD_ARG_5(...) \
GMOCK_INTERNAL_WRONG_ARITY(__VA_ARGS__)
#define GMOCK_INTERNAL_MOCK_METHOD_ARG_6(...) \
GMOCK_INTERNAL_WRONG_ARITY(__VA_ARGS__)
#define GMOCK_INTERNAL_MOCK_METHOD_ARG_7(...) \
GMOCK_INTERNAL_WRONG_ARITY(__VA_ARGS__)
#define GMOCK_INTERNAL_WRONG_ARITY(...) \
static_assert( \
false, \
"MOCK_METHOD must be called with 3 or 4 arguments. _Ret, " \
"_MethodName, _Args and optionally _Spec. _Args and _Spec must be " \
"enclosed in parentheses. If _Ret is a type with unprotected commas, " \
"it must also be enclosed in parentheses.")
#define GMOCK_INTERNAL_ASSERT_PARENTHESIS(_Tuple) \
static_assert( \
GMOCK_PP_IS_ENCLOSED_PARENS(_Tuple), \
GMOCK_PP_STRINGIZE(_Tuple) " should be enclosed in parentheses.")
#define GMOCK_INTERNAL_ASSERT_VALID_SIGNATURE(_N, ...) \
static_assert( \
std::is_function<__VA_ARGS__>::value, \
"Signature must be a function type, maybe return type contains " \
"unprotected comma."); \
static_assert( \
::testing::tuple_size<typename ::testing::internal::Function< \
__VA_ARGS__>::ArgumentTuple>::value == _N, \
"This method does not take " GMOCK_PP_STRINGIZE( \
_N) " arguments. Parenthesize all types with unproctected commas.")
#define GMOCK_INTERNAL_ASSERT_VALID_SPEC(_Spec) \
GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_ASSERT_VALID_SPEC_ELEMENT, ~, _Spec)
#define GMOCK_INTERNAL_MOCK_METHOD_IMPL(_N, _MethodName, _Constness, \
_Override, _Final, _Noexcept, \
_CallType, _Signature) \
typename ::testing::internal::Function<GMOCK_PP_REMOVE_PARENS( \
_Signature)>::Result \
GMOCK_INTERNAL_EXPAND(_CallType) \
_MethodName(GMOCK_PP_REPEAT(GMOCK_INTERNAL_PARAMETER, _Signature, _N)) \
GMOCK_PP_IF(_Constness, const, ) GMOCK_PP_IF(_Noexcept, noexcept, ) \
GMOCK_PP_IF(_Override, override, ) \
GMOCK_PP_IF(_Final, final, ) { \
GMOCK_MOCKER_(_N, _Constness, _MethodName) \
.SetOwnerAndName(this, #_MethodName); \
return GMOCK_MOCKER_(_N, _Constness, _MethodName) \
.Invoke(GMOCK_PP_REPEAT(GMOCK_INTERNAL_FORWARD_ARG, _Signature, _N)); \
} \
::testing::MockSpec<GMOCK_PP_REMOVE_PARENS(_Signature)> gmock_##_MethodName( \
GMOCK_PP_REPEAT(GMOCK_INTERNAL_MATCHER_PARAMETER, _Signature, _N)) \
GMOCK_PP_IF(_Constness, const, ) { \
GMOCK_MOCKER_(_N, _Constness, _MethodName).RegisterOwner(this); \
return GMOCK_MOCKER_(_N, _Constness, _MethodName) \
.With(GMOCK_PP_REPEAT(GMOCK_INTERNAL_MATCHER_ARGUMENT, , _N)); \
} \
::testing::MockSpec<GMOCK_PP_REMOVE_PARENS(_Signature)> gmock_##_MethodName( \
const ::testing::internal::WithoutMatchers&, \
GMOCK_PP_IF(_Constness, const, )::testing::internal::Function< \
GMOCK_PP_REMOVE_PARENS(_Signature)>*) \
const GMOCK_PP_IF(_Noexcept, noexcept, ) { \
return GMOCK_PP_CAT(::testing::internal::AdjustConstness_, \
GMOCK_PP_IF(_Constness, const, ))(this) \
->gmock_##_MethodName(GMOCK_PP_REPEAT( \
GMOCK_INTERNAL_A_MATCHER_ARGUMENT, _Signature, _N)); \
} \
mutable ::testing::FunctionMocker<GMOCK_PP_REMOVE_PARENS(_Signature)> \
GMOCK_MOCKER_(_N, _Constness, _MethodName)
#define GMOCK_INTERNAL_EXPAND(...) __VA_ARGS__
// Five Valid modifiers.
#define GMOCK_INTERNAL_HAS_CONST(_Tuple) \
GMOCK_PP_HAS_COMMA(GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_DETECT_CONST, ~, _Tuple))
#define GMOCK_INTERNAL_HAS_OVERRIDE(_Tuple) \
GMOCK_PP_HAS_COMMA( \
GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_DETECT_OVERRIDE, ~, _Tuple))
#define GMOCK_INTERNAL_HAS_FINAL(_Tuple) \
GMOCK_PP_HAS_COMMA(GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_DETECT_FINAL, ~, _Tuple))
#define GMOCK_INTERNAL_HAS_NOEXCEPT(_Tuple) \
GMOCK_PP_HAS_COMMA( \
GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_DETECT_NOEXCEPT, ~, _Tuple))
#define GMOCK_INTERNAL_GET_CALLTYPE(_Tuple) \
GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_GET_CALLTYPE_IMPL, ~, _Tuple)
#define GMOCK_INTERNAL_ASSERT_VALID_SPEC_ELEMENT(_i, _, _elem) \
static_assert( \
(GMOCK_PP_HAS_COMMA(GMOCK_INTERNAL_DETECT_CONST(_i, _, _elem)) + \
GMOCK_PP_HAS_COMMA(GMOCK_INTERNAL_DETECT_OVERRIDE(_i, _, _elem)) + \
GMOCK_PP_HAS_COMMA(GMOCK_INTERNAL_DETECT_FINAL(_i, _, _elem)) + \
GMOCK_PP_HAS_COMMA(GMOCK_INTERNAL_DETECT_NOEXCEPT(_i, _, _elem)) + \
GMOCK_INTERNAL_IS_CALLTYPE(_elem)) == 1, \
GMOCK_PP_STRINGIZE( \
_elem) " cannot be recognized as a valid specification modifier.");
// Modifiers implementation.
#define GMOCK_INTERNAL_DETECT_CONST(_i, _, _elem) \
GMOCK_PP_CAT(GMOCK_INTERNAL_DETECT_CONST_I_, _elem)
#define GMOCK_INTERNAL_DETECT_CONST_I_const ,
#define GMOCK_INTERNAL_DETECT_OVERRIDE(_i, _, _elem) \
GMOCK_PP_CAT(GMOCK_INTERNAL_DETECT_OVERRIDE_I_, _elem)
#define GMOCK_INTERNAL_DETECT_OVERRIDE_I_override ,
#define GMOCK_INTERNAL_DETECT_FINAL(_i, _, _elem) \
GMOCK_PP_CAT(GMOCK_INTERNAL_DETECT_FINAL_I_, _elem)
#define GMOCK_INTERNAL_DETECT_FINAL_I_final ,
// TODO(iserna): Maybe noexcept should accept an argument here as well.
#define GMOCK_INTERNAL_DETECT_NOEXCEPT(_i, _, _elem) \
GMOCK_PP_CAT(GMOCK_INTERNAL_DETECT_NOEXCEPT_I_, _elem)
#define GMOCK_INTERNAL_DETECT_NOEXCEPT_I_noexcept ,
#define GMOCK_INTERNAL_GET_CALLTYPE_IMPL(_i, _, _elem) \
GMOCK_PP_IF(GMOCK_INTERNAL_IS_CALLTYPE(_elem), \
GMOCK_INTERNAL_GET_VALUE_CALLTYPE, GMOCK_PP_EMPTY) \
(_elem)
// TODO(iserna): GMOCK_INTERNAL_IS_CALLTYPE and
// GMOCK_INTERNAL_GET_VALUE_CALLTYPE needed more expansions to work on windows
// maybe they can be simplified somehow.
#define GMOCK_INTERNAL_IS_CALLTYPE(_arg) \
GMOCK_INTERNAL_IS_CALLTYPE_I( \
GMOCK_PP_CAT(GMOCK_INTERNAL_IS_CALLTYPE_HELPER_, _arg))
#define GMOCK_INTERNAL_IS_CALLTYPE_I(_arg) GMOCK_PP_IS_ENCLOSED_PARENS(_arg)
#define GMOCK_INTERNAL_GET_VALUE_CALLTYPE(_arg) \
GMOCK_INTERNAL_GET_VALUE_CALLTYPE_I( \
GMOCK_PP_CAT(GMOCK_INTERNAL_IS_CALLTYPE_HELPER_, _arg))
#define GMOCK_INTERNAL_GET_VALUE_CALLTYPE_I(_arg) \
GMOCK_PP_CAT(GMOCK_PP_IDENTITY, _arg)
#define GMOCK_INTERNAL_IS_CALLTYPE_HELPER_Calltype
#define GMOCK_INTERNAL_SIGNATURE(_Ret, _Args) \
GMOCK_PP_IF(GMOCK_PP_IS_BEGIN_PARENS(_Ret), GMOCK_PP_REMOVE_PARENS, \
GMOCK_PP_IDENTITY) \
(_Ret)(GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_GET_TYPE, _, _Args))
#define GMOCK_INTERNAL_GET_TYPE(_i, _, _elem) \
GMOCK_PP_COMMA_IF(_i) \
GMOCK_PP_IF(GMOCK_PP_IS_BEGIN_PARENS(_elem), GMOCK_PP_REMOVE_PARENS, \
GMOCK_PP_IDENTITY) \
(_elem)
#define GMOCK_INTERNAL_PARAMETER(_i, _Signature, _) \
GMOCK_PP_COMMA_IF(_i) \
GMOCK_INTERNAL_ARG_O(typename, GMOCK_PP_INC(_i), \
GMOCK_PP_REMOVE_PARENS(_Signature)) \
gmock_a##_i
#define GMOCK_INTERNAL_FORWARD_ARG(_i, _Signature, _) \
GMOCK_PP_COMMA_IF(_i) \
::std::forward<GMOCK_INTERNAL_ARG_O(typename, GMOCK_PP_INC(_i), \
GMOCK_PP_REMOVE_PARENS(_Signature))>( \
gmock_a##_i)
#define GMOCK_INTERNAL_MATCHER_PARAMETER(_i, _Signature, _) \
GMOCK_PP_COMMA_IF(_i) \
GMOCK_INTERNAL_MATCHER_O(typename, GMOCK_PP_INC(_i), \
GMOCK_PP_REMOVE_PARENS(_Signature)) \
gmock_a##_i
#define GMOCK_INTERNAL_MATCHER_ARGUMENT(_i, _1, _2) \
GMOCK_PP_COMMA_IF(_i) \
gmock_a##_i
#define GMOCK_INTERNAL_A_MATCHER_ARGUMENT(_i, _Signature, _) \
GMOCK_PP_COMMA_IF(_i) \
::testing::A<GMOCK_INTERNAL_ARG_O(typename, GMOCK_PP_INC(_i), \
GMOCK_PP_REMOVE_PARENS(_Signature))>()
#define GMOCK_INTERNAL_ARG_O(_tn, _i, ...) GMOCK_ARG_(_tn, _i, __VA_ARGS__)
#define GMOCK_INTERNAL_MATCHER_O(_tn, _i, ...) \
GMOCK_MATCHER_(_tn, _i, __VA_ARGS__)
#endif // THIRD_PARTY_GOOGLETEST_GOOGLEMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_FUNCTION_MOCKER_H_
...@@ -43,6 +43,9 @@ $$}} This meta comment fixes auto-indentation in editors. ...@@ -43,6 +43,9 @@ $$}} This meta comment fixes auto-indentation in editors.
#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_ACTIONS_H_ #ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_ACTIONS_H_
#define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_ACTIONS_H_ #define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_ACTIONS_H_
#include <memory>
#include <utility>
#include "gmock/gmock-actions.h" #include "gmock/gmock-actions.h"
#include "gmock/internal/gmock-port.h" #include "gmock/internal/gmock-port.h"
...@@ -63,19 +66,19 @@ $range j 1..i ...@@ -63,19 +66,19 @@ $range j 1..i
$var types = [[$for j [[, typename A$j]]]] $var types = [[$for j [[, typename A$j]]]]
$var as = [[$for j, [[A$j]]]] $var as = [[$for j, [[A$j]]]]
$var args = [[$if i==0 [[]] $else [[ args]]]] $var args = [[$if i==0 [[]] $else [[ args]]]]
$var gets = [[$for j, [[get<$(j - 1)>(args)]]]] $var gets = [[$for j, [[std::get<$(j - 1)>(args)]]]]
template <typename R$types> template <typename R$types>
class InvokeHelper<R, ::testing::tuple<$as> > { class InvokeHelper<R, ::std::tuple<$as> > {
public: public:
template <typename Function> template <typename Function>
static R Invoke(Function function, const ::testing::tuple<$as>&$args) { static R Invoke(Function function, const ::std::tuple<$as>&$args) {
return function($gets); return function($gets);
} }
template <class Class, typename MethodPtr> template <class Class, typename MethodPtr>
static R InvokeMethod(Class* obj_ptr, static R InvokeMethod(Class* obj_ptr,
MethodPtr method_ptr, MethodPtr method_ptr,
const ::testing::tuple<$as>&$args) { const ::std::tuple<$as>&$args) {
return (obj_ptr->*method_ptr)($gets); return (obj_ptr->*method_ptr)($gets);
} }
...@@ -83,7 +86,7 @@ class InvokeHelper<R, ::testing::tuple<$as> > { ...@@ -83,7 +86,7 @@ class InvokeHelper<R, ::testing::tuple<$as> > {
$if i <= max_callback_arity [[ $if i <= max_callback_arity [[
template <typename CallbackType> template <typename CallbackType>
static R InvokeCallback(CallbackType* callback, static R InvokeCallback(CallbackType* callback,
const ::testing::tuple<$as>&$args) { const ::std::tuple<$as>&$args) {
return callback->Run($gets); return callback->Run($gets);
} }
]] $else [[ ]] $else [[
...@@ -116,98 +119,7 @@ class InvokeCallbackAction { ...@@ -116,98 +119,7 @@ class InvokeCallbackAction {
callback_.get(), args); callback_.get(), args);
} }
private: private:
const linked_ptr<CallbackType> callback_; const std::shared_ptr<CallbackType> callback_;
};
// An INTERNAL macro for extracting the type of a tuple field. It's
// subject to change without notice - DO NOT USE IN USER CODE!
#define GMOCK_FIELD_(Tuple, N) \
typename ::testing::tuple_element<N, Tuple>::type
$range i 1..n
// SelectArgs<Result, ArgumentTuple, k1, k2, ..., k_n>::type is the
// type of an n-ary function whose i-th (1-based) argument type is the
// k{i}-th (0-based) field of ArgumentTuple, which must be a tuple
// type, and whose return type is Result. For example,
// SelectArgs<int, ::testing::tuple<bool, char, double, long>, 0, 3>::type
// is int(bool, long).
//
// SelectArgs<Result, ArgumentTuple, k1, k2, ..., k_n>::Select(args)
// returns the selected fields (k1, k2, ..., k_n) of args as a tuple.
// For example,
// SelectArgs<int, tuple<bool, char, double>, 2, 0>::Select(
// ::testing::make_tuple(true, 'a', 2.5))
// returns tuple (2.5, true).
//
// The numbers in list k1, k2, ..., k_n must be >= 0, where n can be
// in the range [0, $n]. Duplicates are allowed and they don't have
// to be in an ascending or descending order.
template <typename Result, typename ArgumentTuple, $for i, [[int k$i]]>
class SelectArgs {
public:
typedef Result type($for i, [[GMOCK_FIELD_(ArgumentTuple, k$i)]]);
typedef typename Function<type>::ArgumentTuple SelectedArgs;
static SelectedArgs Select(const ArgumentTuple& args) {
return SelectedArgs($for i, [[get<k$i>(args)]]);
}
};
$for i [[
$range j 1..n
$range j1 1..i-1
template <typename Result, typename ArgumentTuple$for j1[[, int k$j1]]>
class SelectArgs<Result, ArgumentTuple,
$for j, [[$if j <= i-1 [[k$j]] $else [[-1]]]]> {
public:
typedef Result type($for j1, [[GMOCK_FIELD_(ArgumentTuple, k$j1)]]);
typedef typename Function<type>::ArgumentTuple SelectedArgs;
static SelectedArgs Select(const ArgumentTuple& [[]]
$if i == 1 [[/* args */]] $else [[args]]) {
return SelectedArgs($for j1, [[get<k$j1>(args)]]);
}
};
]]
#undef GMOCK_FIELD_
$var ks = [[$for i, [[k$i]]]]
// Implements the WithArgs action.
template <typename InnerAction, $for i, [[int k$i = -1]]>
class WithArgsAction {
public:
explicit WithArgsAction(const InnerAction& action) : action_(action) {}
template <typename F>
operator Action<F>() const { return MakeAction(new Impl<F>(action_)); }
private:
template <typename F>
class Impl : public ActionInterface<F> {
public:
typedef typename Function<F>::Result Result;
typedef typename Function<F>::ArgumentTuple ArgumentTuple;
explicit Impl(const InnerAction& action) : action_(action) {}
virtual Result Perform(const ArgumentTuple& args) {
return action_.Perform(SelectArgs<Result, ArgumentTuple, $ks>::Select(args));
}
private:
typedef typename SelectArgs<Result, ArgumentTuple,
$ks>::type InnerFunctionType;
Action<InnerFunctionType> action_;
};
const InnerAction action_;
GTEST_DISALLOW_ASSIGN_(WithArgsAction);
}; };
// A macro from the ACTION* family (defined later in this file) // A macro from the ACTION* family (defined later in this file)
...@@ -240,12 +152,12 @@ $range j 0..i-1 ...@@ -240,12 +152,12 @@ $range j 0..i-1
]]]] ]]]]
$range j 0..i-1 $range j 0..i-1
$var As = [[$for j, [[A$j]]]] $var As = [[$for j, [[A$j]]]]
$var as = [[$for j, [[get<$j>(args)]]]] $var as = [[$for j, [[std::get<$j>(args)]]]]
$range k 1..n-i $range k 1..n-i
$var eas = [[$for k, [[ExcessiveArg()]]]] $var eas = [[$for k, [[ExcessiveArg()]]]]
$var arg_list = [[$if (i==0) | (i==n) [[$as$eas]] $else [[$as, $eas]]]] $var arg_list = [[$if (i==0) | (i==n) [[$as$eas]] $else [[$as, $eas]]]]
$template $template
static Result Perform(Impl* impl, const ::testing::tuple<$As>& args) { static Result Perform(Impl* impl, const ::std::tuple<$As>& args) {
return impl->template gmock_PerformImpl<$As>(args, $arg_list); return impl->template gmock_PerformImpl<$As>(args, $arg_list);
} }
...@@ -253,53 +165,6 @@ $template ...@@ -253,53 +165,6 @@ $template
}; };
} // namespace internal } // namespace internal
// Various overloads for Invoke().
// WithArgs<N1, N2, ..., Nk>(an_action) creates an action that passes
// the selected arguments of the mock function to an_action and
// performs it. It serves as an adaptor between actions with
// different argument lists. C++ doesn't support default arguments for
// function templates, so we have to overload it.
$range i 1..n
$for i [[
$range j 1..i
template <$for j [[int k$j, ]]typename InnerAction>
inline internal::WithArgsAction<InnerAction$for j [[, k$j]]>
WithArgs(const InnerAction& action) {
return internal::WithArgsAction<InnerAction$for j [[, k$j]]>(action);
}
]]
// Creates an action that does actions a1, a2, ..., sequentially in
// each invocation.
$range i 2..n
$for i [[
$range j 2..i
$var types = [[$for j, [[typename Action$j]]]]
$var Aas = [[$for j [[, Action$j a$j]]]]
template <typename Action1, $types>
$range k 1..i-1
inline $for k [[internal::DoBothAction<Action$k, ]]Action$i$for k [[>]]
DoAll(Action1 a1$Aas) {
$if i==2 [[
return internal::DoBothAction<Action1, Action2>(a1, a2);
]] $else [[
$range j2 2..i
return DoAll(a1, DoAll($for j2, [[a$j2]]));
]]
}
]]
} // namespace testing } // namespace testing
// The ACTION* family of macros can be used in a namespace scope to // The ACTION* family of macros can be used in a namespace scope to
...@@ -395,8 +260,8 @@ $range j2 2..i ...@@ -395,8 +260,8 @@ $range j2 2..i
// //
// MORE INFORMATION: // MORE INFORMATION:
// //
// To learn more about using these macros, please search for 'ACTION' // To learn more about using these macros, please search for 'ACTION' on
// on https://github.com/google/googletest/blob/master/googlemock/docs/CookBook.md // https://github.com/google/googletest/blob/master/googlemock/docs/CookBook.md
$range i 0..n $range i 0..n
$range k 0..n-1 $range k 0..n-1
...@@ -432,7 +297,7 @@ $for k [[, \ ...@@ -432,7 +297,7 @@ $for k [[, \
// ACTION_TEMPLATE(DuplicateArg, // ACTION_TEMPLATE(DuplicateArg,
// HAS_2_TEMPLATE_PARAMS(int, k, typename, T), // HAS_2_TEMPLATE_PARAMS(int, k, typename, T),
// AND_1_VALUE_PARAMS(output)) { // AND_1_VALUE_PARAMS(output)) {
// *output = T(::testing::get<k>(args)); // *output = T(::std::get<k>(args));
// } // }
// ... // ...
// int n; // int n;
...@@ -525,7 +390,7 @@ _VALUE_PARAMS($for j, [[p$j]]) $for j [[, typename p$j##_type]] ...@@ -525,7 +390,7 @@ _VALUE_PARAMS($for j, [[p$j]]) $for j [[, typename p$j##_type]]
$for i [[ $for i [[
$range j 0..i-1 $range j 0..i-1
#define GMOCK_INTERNAL_INIT_AND_$i[[]]_VALUE_PARAMS($for j, [[p$j]])\ #define GMOCK_INTERNAL_INIT_AND_$i[[]]_VALUE_PARAMS($for j, [[p$j]])\
($for j, [[p$j##_type gmock_p$j]])$if i>0 [[ : ]]$for j, [[p$j(::testing::internal::move(gmock_p$j))]] ($for j, [[p$j##_type gmock_p$j]])$if i>0 [[ : ]]$for j, [[p$j(::std::move(gmock_p$j))]]
]] ]]
...@@ -658,7 +523,7 @@ $var class_name = [[name##Action[[$if i==0 [[]] $elif i==1 [[P]] ...@@ -658,7 +523,7 @@ $var class_name = [[name##Action[[$if i==0 [[]] $elif i==1 [[P]]
$range j 0..i-1 $range j 0..i-1
$var ctor_param_list = [[$for j, [[p$j##_type gmock_p$j]]]] $var ctor_param_list = [[$for j, [[p$j##_type gmock_p$j]]]]
$var param_types_and_names = [[$for j, [[p$j##_type p$j]]]] $var param_types_and_names = [[$for j, [[p$j##_type p$j]]]]
$var inits = [[$if i==0 [[]] $else [[ : $for j, [[p$j(::testing::internal::forward<p$j##_type>(gmock_p$j))]]]]]] $var inits = [[$if i==0 [[]] $else [[ : $for j, [[p$j(::std::forward<p$j##_type>(gmock_p$j))]]]]]]
$var param_field_decls = [[$for j $var param_field_decls = [[$for j
[[ [[
...@@ -796,7 +661,7 @@ ACTION_TEMPLATE(InvokeArgument, ...@@ -796,7 +661,7 @@ ACTION_TEMPLATE(InvokeArgument,
using internal::invoke_argument::InvokeArgumentAdl; using internal::invoke_argument::InvokeArgumentAdl;
return InvokeArgumentAdl<return_type>( return InvokeArgumentAdl<return_type>(
internal::invoke_argument::AdlTag(), internal::invoke_argument::AdlTag(),
::testing::get<k>(args)$for j [[, p$j]]); ::std::get<k>(args)$for j [[, p$j]]);
} }
]] ]]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment