Fix broken tests due to deprecation warning

PiperOrigin-RevId: 951523081
Change-Id: I145c6066a202629e5d0c89453d726495dd535290
This commit is contained in:
Mike Kruskal
2026-07-21 09:06:28 -07:00
committed by Copybara-Service
parent fa005b296f
commit 30a3151b0c
5 changed files with 29 additions and 17 deletions
+7 -3
View File
@@ -1222,23 +1222,26 @@ class Foo {
// Tests InvokeWithoutArgs(function).
TEST(InvokeWithoutArgsTest, Function) {
GTEST_DISABLE_DEPRECATED_PUSH_()
// As an action that takes one argument.
Action<int(int)> a = Nullary; // NOLINT
Action<int(int)> a = InvokeWithoutArgs(Nullary); // NOLINT
EXPECT_EQ(1, a.Perform(std::make_tuple(2)));
// As an action that takes two arguments.
Action<int(int, double)> a2 = Nullary; // NOLINT
Action<int(int, double)> a2 = InvokeWithoutArgs(Nullary); // NOLINT
EXPECT_EQ(1, a2.Perform(std::make_tuple(2, 3.5)));
// As an action that returns void.
Action<void(int)> a3 = VoidNullary; // NOLINT
Action<void(int)> a3 = InvokeWithoutArgs(VoidNullary); // NOLINT
g_done = false;
a3.Perform(std::make_tuple(1));
EXPECT_TRUE(g_done);
GTEST_DISABLE_DEPRECATED_POP_()
}
// Tests InvokeWithoutArgs(functor).
TEST(InvokeWithoutArgsTest, Functor) {
GTEST_DISABLE_DEPRECATED_PUSH_()
// As an action that takes no argument.
Action<int()> a = InvokeWithoutArgs(NullaryFunctor()); // NOLINT
EXPECT_EQ(2, a.Perform(std::make_tuple()));
@@ -1253,6 +1256,7 @@ TEST(InvokeWithoutArgsTest, Functor) {
g_done = false;
a3.Perform(std::make_tuple());
EXPECT_TRUE(g_done);
GTEST_DISABLE_DEPRECATED_POP_()
}
// Tests InvokeWithoutArgs(obj_ptr, method).
+2
View File
@@ -338,10 +338,12 @@ TEST(LinkTest, TestInvokeWithoutArgs) {
Mock mock;
InvokeHelper test_invoke_helper;
GTEST_DISABLE_DEPRECATED_PUSH_()
EXPECT_CALL(mock, VoidFromString(_))
.WillOnce(InvokeWithoutArgs(&InvokeHelper::StaticVoidFromVoid))
.WillOnce(
InvokeWithoutArgs(&test_invoke_helper, &InvokeHelper::VoidFromVoid));
GTEST_DISABLE_DEPRECATED_POP_()
mock.VoidFromString(nullptr);
mock.VoidFromString(nullptr);
}