Skip to content

Commit 076f4a8

Browse files
committed
⬆️ Update gtest to v1.10.x version
1 parent 73af3d9 commit 076f4a8

File tree

5 files changed

+47
-14
lines changed

5 files changed

+47
-14
lines changed

example/GAssert.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@
55
// (See accompanying file LICENSE_1_0.txt or copy at
66
// http://www.boost.org/LICENSE_1_0.txt)
77
//
8+
#include "GUnit/GTest.h"
89
#include "GUnit/GAssert.h"
910

10-
int main() {
11+
GTEST("Assert") {
1112
const auto b = true;
1213
const auto i = 42;
1314

include/GUnit/GMock.h

Lines changed: 38 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -176,11 +176,39 @@ class vtable {
176176

177177
using CallReactionType = internal::CallReaction (*)(const void *);
178178
template <CallReactionType Ptr>
179-
struct GetAccess {
179+
struct GetAccessCallReactionType {
180180
friend CallReactionType GetCallReaction() { return Ptr; }
181181
};
182182
CallReactionType GetCallReaction();
183-
template struct GetAccess<&Mock::GetReactionOnUninterestingCalls>;
183+
template struct GetAccessCallReactionType<
184+
&Mock::GetReactionOnUninterestingCalls>;
185+
186+
using UnregisterCallReactionType = internal::CallReaction (*)(const void *);
187+
template <UnregisterCallReactionType Ptr>
188+
struct GetAccessUnregisterCallReactionType {
189+
friend UnregisterCallReactionType UnregisterCallReaction() { return Ptr; }
190+
};
191+
UnregisterCallReactionType UnregisterCallReaction();
192+
template struct GetAccessUnregisterCallReactionType<
193+
&Mock::GetReactionOnUninterestingCalls>;
194+
195+
using AllowUninterestingCallsType = void (*)(const void *);
196+
template <AllowUninterestingCallsType Ptr>
197+
struct GetAccessAllowUninterestingCallsType {
198+
friend AllowUninterestingCallsType AllowUninterestingCalls() { return Ptr; }
199+
};
200+
AllowUninterestingCallsType AllowUninterestingCalls();
201+
template struct GetAccessAllowUninterestingCallsType<
202+
&Mock::AllowUninterestingCalls>;
203+
204+
using FailUninterestingCallsType = void (*)(const void *);
205+
template <FailUninterestingCallsType Ptr>
206+
struct GetAccessFailUninterestingCallsType {
207+
friend FailUninterestingCallsType FailUninterestingCalls() { return Ptr; }
208+
};
209+
FailUninterestingCallsType FailUninterestingCalls();
210+
template struct GetAccessFailUninterestingCallsType<
211+
&Mock::FailUninterestingCalls>;
184212

185213
} // namespace detail
186214

@@ -331,16 +359,18 @@ class NiceMock<GMock<T>> final : public GMock<T> {
331359
public:
332360
template <class... Ts>
333361
NiceMock(Ts &&... ts) : GMock<T>{std::forward<Ts>(ts)...} {
334-
Mock::AllowUninterestingCalls(internal::ImplicitCast_<GMock<T> *>(this));
362+
detail::AllowUninterestingCalls()(
363+
internal::ImplicitCast_<GMock<T> *>(this));
335364
}
336365

337366
NiceMock(NiceMock &&) = default;
338367
NiceMock(const NiceMock &) = delete;
339368
NiceMock() {
340-
Mock::AllowUninterestingCalls(internal::ImplicitCast_<GMock<T> *>(this));
369+
detail::AllowUninterestingCalls()(
370+
internal::ImplicitCast_<GMock<T> *>(this));
341371
}
342372
~NiceMock() {
343-
Mock::UnregisterCallReaction(internal::ImplicitCast_<GMock<T> *>(this));
373+
detail::UnregisterCallReaction()(internal::ImplicitCast_<GMock<T> *>(this));
344374
}
345375
};
346376

@@ -349,15 +379,15 @@ class StrictMock<GMock<T>> final : public GMock<T> {
349379
public:
350380
template <class... Ts>
351381
StrictMock(Ts &&... ts) : GMock<T>{std::forward<Ts>(ts)...} {
352-
Mock::FailUninterestingCalls(internal::ImplicitCast_<GMock<T> *>(this));
382+
detail::FailUninterestingCalls()(internal::ImplicitCast_<GMock<T> *>(this));
353383
}
354384
StrictMock(StrictMock &&) = default;
355385
StrictMock(const StrictMock &) = delete;
356386
StrictMock() {
357-
Mock::FailUninterestingCalls(internal::ImplicitCast_<GMock<T> *>(this));
387+
detail::FailUninterestingCalls()(internal::ImplicitCast_<GMock<T> *>(this));
358388
}
359389
~StrictMock() {
360-
Mock::UnregisterCallReaction(internal::ImplicitCast_<GMock<T> *>(this));
390+
detail::UnregisterCallReaction()(internal::ImplicitCast_<GMock<T> *>(this));
361391
}
362392
};
363393

include/GUnit/GSteps.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ class Steps : public ::testing::EmptyTestEventListener {
388388
return Step<-1, true>{*this, {"Then", File::c_str(), line}, pattern};
389389
}
390390

391-
// clang-format off
391+
// clang-format off
392392
#if defined(__clang__)
393393
#pragma clang diagnostic ignored "-Wdollar-in-identifier-extension"
394394
#endif

include/GUnit/GTest.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,11 @@ class GTestAutoRegister {
154154
T::TEST_NAME::c_str())
155155
.c_str(),
156156
{T::TEST_FILE, T::TEST_LINE})
157-
->AddTestPattern(GetTypeName(detail::type<typename T::TEST_TYPE>{}),
158-
GetTypeName(detail::type<typename T::TEST_TYPE>{}),
159-
new internal::TestMetaFactory<T>());
157+
->AddTestPattern(
158+
GetTypeName(detail::type<typename T::TEST_TYPE>{}),
159+
GetTypeName(detail::type<typename T::TEST_TYPE>{}),
160+
new internal::TestMetaFactory<T>(),
161+
internal::CodeLocation{T::TEST_NAME::c_str(), T::TEST_LINE});
160162

161163
UnitTest::GetInstance()
162164
->parameterized_test_registry()

libs/googletest

Submodule googletest updated 207 files

0 commit comments

Comments
 (0)