summaryrefslogtreecommitdiffstats
path: root/googlemock
diff options
context:
space:
mode:
Diffstat (limited to 'googlemock')
-rw-r--r--googlemock/cmake/gmock.pc.in5
-rw-r--r--googlemock/cmake/gmock_main.pc.in5
-rw-r--r--googlemock/docs/for_dummies.md2
-rw-r--r--googlemock/include/gmock/gmock-function-mocker.h24
-rw-r--r--googlemock/include/gmock/gmock-matchers.h4
-rw-r--r--googlemock/include/gmock/internal/gmock-internal-utils.h5
-rw-r--r--googlemock/src/gmock-spec-builders.cc6
-rw-r--r--googlemock/test/gmock-function-mocker_test.cc27
-rw-r--r--googlemock/test/gmock-internal-utils_test.cc1
9 files changed, 23 insertions, 56 deletions
diff --git a/googlemock/cmake/gmock.pc.in b/googlemock/cmake/gmock.pc.in
index 08e0454..2ef0fbc 100644
--- a/googlemock/cmake/gmock.pc.in
+++ b/googlemock/cmake/gmock.pc.in
@@ -1,6 +1,5 @@
-prefix=${pcfiledir}/../..
-libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@
-includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@
+libdir=@CMAKE_INSTALL_FULL_LIBDIR@
+includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@
Name: gmock
Description: GoogleMock (without main() function)
diff --git a/googlemock/cmake/gmock_main.pc.in b/googlemock/cmake/gmock_main.pc.in
index b22fe61..04658fe 100644
--- a/googlemock/cmake/gmock_main.pc.in
+++ b/googlemock/cmake/gmock_main.pc.in
@@ -1,6 +1,5 @@
-prefix=${pcfiledir}/../..
-libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@
-includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@
+libdir=@CMAKE_INSTALL_FULL_LIBDIR@
+includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@
Name: gmock_main
Description: GoogleMock (with main() function)
diff --git a/googlemock/docs/for_dummies.md b/googlemock/docs/for_dummies.md
index e11c18d..93cf06f 100644
--- a/googlemock/docs/for_dummies.md
+++ b/googlemock/docs/for_dummies.md
@@ -213,7 +213,7 @@ specific domain much better than `Foo` does.
Once you have a mock class, using it is easy. The typical work flow is:
1. Import the gMock names from the `testing` namespace such that you can use
- them unqualified (You only have to do it once per file. Remember that
+ them unqualified (You only have to do it once per file). Remember that
namespaces are a good idea.
2. Create some mock objects.
3. Specify your expectations on them (How many times will a method be called?
diff --git a/googlemock/include/gmock/gmock-function-mocker.h b/googlemock/include/gmock/gmock-function-mocker.h
index 8320f14..cc1535c 100644
--- a/googlemock/include/gmock/gmock-function-mocker.h
+++ b/googlemock/include/gmock/gmock-function-mocker.h
@@ -60,8 +60,7 @@
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_GET_NOEXCEPT_SPEC(_Spec), \
- GMOCK_INTERNAL_GET_CALLTYPE(_Spec), \
+ GMOCK_INTERNAL_HAS_NOEXCEPT(_Spec), GMOCK_INTERNAL_GET_CALLTYPE(_Spec), \
(GMOCK_INTERNAL_SIGNATURE(_Ret, _Args)))
#define GMOCK_INTERNAL_MOCK_METHOD_ARG_5(...) \
@@ -101,16 +100,15 @@
GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_ASSERT_VALID_SPEC_ELEMENT, ~, _Spec)
#define GMOCK_INTERNAL_MOCK_METHOD_IMPL(_N, _MethodName, _Constness, \
- _Override, _Final, _NoexceptSpec, \
+ _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, ) \
- _NoexceptSpec \
- GMOCK_PP_IF(_Override, override, ) \
- GMOCK_PP_IF(_Final, final, ) { \
+ 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) \
@@ -127,7 +125,7 @@
const ::testing::internal::WithoutMatchers&, \
GMOCK_PP_IF(_Constness, const, )::testing::internal::Function< \
GMOCK_PP_REMOVE_PARENS(_Signature)>*) \
- const _NoexceptSpec { \
+ const GMOCK_PP_IF(_Noexcept, noexcept, ) { \
return GMOCK_PP_CAT(::testing::internal::AdjustConstness_, \
GMOCK_PP_IF(_Constness, const, ))(this) \
->gmock_##_MethodName(GMOCK_PP_REPEAT( \
@@ -149,12 +147,9 @@
#define GMOCK_INTERNAL_HAS_FINAL(_Tuple) \
GMOCK_PP_HAS_COMMA(GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_DETECT_FINAL, ~, _Tuple))
-#define GMOCK_INTERNAL_GET_NOEXCEPT_SPEC(_Tuple) \
- GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_NOEXCEPT_SPEC_IF_NOEXCEPT, ~, _Tuple)
-
-#define GMOCK_INTERNAL_NOEXCEPT_SPEC_IF_NOEXCEPT(_i, _, _elem) \
- GMOCK_PP_IF( \
- GMOCK_PP_HAS_COMMA(GMOCK_INTERNAL_DETECT_NOEXCEPT(_i, _, _elem)), _elem, )
+#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)
@@ -185,6 +180,7 @@
#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)
diff --git a/googlemock/include/gmock/gmock-matchers.h b/googlemock/include/gmock/gmock-matchers.h
index 28e188b..4428ec1 100644
--- a/googlemock/include/gmock/gmock-matchers.h
+++ b/googlemock/include/gmock/gmock-matchers.h
@@ -1607,8 +1607,8 @@ class PointeeMatcher {
template <typename Pointer>
class Impl : public MatcherInterface<Pointer> {
public:
- typedef typename PointeeOf<typename std::remove_const<
- typename std::remove_reference<Pointer>::type>::type>::type Pointee;
+ typedef typename PointeeOf<GTEST_REMOVE_REFERENCE_AND_CONST_(Pointer)>::type
+ Pointee;
explicit Impl(const InnerMatcher& matcher)
: matcher_(MatcherCast<const Pointee&>(matcher)) {}
diff --git a/googlemock/include/gmock/internal/gmock-internal-utils.h b/googlemock/include/gmock/internal/gmock-internal-utils.h
index fdc049c..584afa9 100644
--- a/googlemock/include/gmock/internal/gmock-internal-utils.h
+++ b/googlemock/include/gmock/internal/gmock-internal-utils.h
@@ -334,8 +334,6 @@ class WithoutMatchers {
// Internal use only: access the singleton instance of WithoutMatchers.
GTEST_API_ WithoutMatchers GetWithoutMatchers();
-// Type traits.
-
// Disable MSVC warnings for infinite recursion, since in this case the
// the recursion is unreachable.
#ifdef _MSC_VER
@@ -492,8 +490,7 @@ struct Function<R(Args...)> {
using Result = R;
static constexpr size_t ArgumentCount = sizeof...(Args);
template <size_t I>
- using Arg = ElemFromList<I, typename MakeIndexSequence<sizeof...(Args)>::type,
- Args...>;
+ using Arg = ElemFromList<I, Args...>;
using ArgumentTuple = std::tuple<Args...>;
using ArgumentMatcherTuple = std::tuple<Matcher<Args>...>;
using MakeResultVoid = void(Args...);
diff --git a/googlemock/src/gmock-spec-builders.cc b/googlemock/src/gmock-spec-builders.cc
index f9d3434..81ea989 100644
--- a/googlemock/src/gmock-spec-builders.cc
+++ b/googlemock/src/gmock-spec-builders.cc
@@ -36,14 +36,17 @@
#include "gmock/gmock-spec-builders.h"
#include <stdlib.h>
+
#include <iostream> // NOLINT
#include <map>
#include <memory>
#include <set>
#include <string>
#include <vector>
+
#include "gmock/gmock.h"
#include "gtest/gtest.h"
+#include "gtest/internal/gtest-port.h"
#if GTEST_OS_CYGWIN || GTEST_OS_LINUX || GTEST_OS_MAC
# include <unistd.h> // NOLINT
@@ -70,7 +73,8 @@ GTEST_API_ void LogWithLocation(testing::internal::LogSeverity severity,
const char* file, int line,
const std::string& message) {
::std::ostringstream s;
- s << file << ":" << line << ": " << message << ::std::endl;
+ s << internal::FormatFileLocation(file, line) << " " << message
+ << ::std::endl;
Log(severity, s.str(), 0);
}
diff --git a/googlemock/test/gmock-function-mocker_test.cc b/googlemock/test/gmock-function-mocker_test.cc
index 4889d68..fbc5d5b 100644
--- a/googlemock/test/gmock-function-mocker_test.cc
+++ b/googlemock/test/gmock-function-mocker_test.cc
@@ -42,7 +42,6 @@
#include <map>
#include <string>
-#include <type_traits>
#include "gmock/gmock.h"
#include "gtest/gtest.h"
@@ -657,31 +656,5 @@ TEST(MockMethodMockFunctionTest, MockMethodSizeOverhead) {
EXPECT_EQ(sizeof(MockMethodSizes0), sizeof(MockMethodSizes4));
}
-void hasTwoParams(int, int);
-void MaybeThrows();
-void DoesntThrow() noexcept;
-struct MockMethodNoexceptSpecifier {
- MOCK_METHOD(void, func1, (), (noexcept));
- MOCK_METHOD(void, func2, (), (noexcept(true)));
- MOCK_METHOD(void, func3, (), (noexcept(false)));
- MOCK_METHOD(void, func4, (), (noexcept(noexcept(MaybeThrows()))));
- MOCK_METHOD(void, func5, (), (noexcept(noexcept(DoesntThrow()))));
- MOCK_METHOD(void, func6, (), (noexcept(noexcept(DoesntThrow())), const));
- MOCK_METHOD(void, func7, (), (const, noexcept(noexcept(DoesntThrow()))));
- // Put commas in the noexcept expression
- MOCK_METHOD(void, func8, (), (noexcept(noexcept(hasTwoParams(1,2))), const));
-};
-
-TEST(MockMethodMockFunctionTest, NoexceptSpecifierPreserved) {
- EXPECT_TRUE(noexcept(std::declval<MockMethodNoexceptSpecifier>().func1()));
- EXPECT_TRUE(noexcept(std::declval<MockMethodNoexceptSpecifier>().func2()));
- EXPECT_FALSE(noexcept(std::declval<MockMethodNoexceptSpecifier>().func3()));
- EXPECT_FALSE(noexcept(std::declval<MockMethodNoexceptSpecifier>().func4()));
- EXPECT_TRUE(noexcept(std::declval<MockMethodNoexceptSpecifier>().func5()));
- EXPECT_TRUE(noexcept(std::declval<MockMethodNoexceptSpecifier>().func6()));
- EXPECT_TRUE(noexcept(std::declval<MockMethodNoexceptSpecifier>().func7()));
- EXPECT_EQ(noexcept(std::declval<MockMethodNoexceptSpecifier>().func8()), noexcept(hasTwoParams(1,2)));
-}
-
} // namespace gmock_function_mocker_test
} // namespace testing
diff --git a/googlemock/test/gmock-internal-utils_test.cc b/googlemock/test/gmock-internal-utils_test.cc
index d000e69..19ba6fe 100644
--- a/googlemock/test/gmock-internal-utils_test.cc
+++ b/googlemock/test/gmock-internal-utils_test.cc
@@ -40,7 +40,6 @@
#include <memory>
#include <sstream>
#include <string>
-#include <type_traits>
#include <vector>
#include "gmock/gmock.h"