From e7d6eb679483cda0feb6d31eaf16b62a55ab4260 Mon Sep 17 00:00:00 2001 From: Kevin Hwang Date: Thu, 20 Apr 2023 13:16:21 -0700 Subject: [PATCH] Update tests to use recommended MOCK_METHOD (#3395) --- test/core-test.cc | 6 +++--- test/mock-allocator.h | 4 ++-- test/ostream-test.cc | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/test/core-test.cc b/test/core-test.cc index 22a49def..ff9d4411 100644 --- a/test/core-test.cc +++ b/test/core-test.cc @@ -141,7 +141,7 @@ TEST(buffer_test, indestructible) { } template struct mock_buffer final : buffer { - MOCK_METHOD1(do_grow, size_t(size_t capacity)); + MOCK_METHOD(size_t, do_grow, (size_t)); void grow(size_t capacity) override { this->set(this->data(), do_grow(capacity)); @@ -327,8 +327,8 @@ template struct mock_visitor { ON_CALL(*this, visit(_)).WillByDefault(Return(test_result())); } - MOCK_METHOD1_T(visit, test_result(T value)); - MOCK_METHOD0_T(unexpected, void()); + MOCK_METHOD(test_result, visit, (T)); + MOCK_METHOD(void, unexpected, ()); auto operator()(T value) -> test_result { return visit(value); } diff --git a/test/mock-allocator.h b/test/mock-allocator.h index 6a67e08f..dc4942f1 100644 --- a/test/mock-allocator.h +++ b/test/mock-allocator.h @@ -20,8 +20,8 @@ template class mock_allocator { mock_allocator() {} mock_allocator(const mock_allocator&) {} using value_type = T; - MOCK_METHOD1_T(allocate, T*(size_t n)); - MOCK_METHOD2_T(deallocate, void(T* p, size_t n)); + MOCK_METHOD(T*, allocate, (size_t)); + MOCK_METHOD(void, deallocate, (T*, size_t)); }; template class allocator_ref { diff --git a/test/ostream-test.cc b/test/ostream-test.cc index 8db9cda4..b2d15466 100644 --- a/test/ostream-test.cc +++ b/test/ostream-test.cc @@ -140,7 +140,7 @@ TEST(ostream_test, write_to_ostream_max_size) { } buffer(max_size); struct mock_streambuf : std::streambuf { - MOCK_METHOD2(xsputn, std::streamsize(const void* s, std::streamsize n)); + MOCK_METHOD(std::streamsize, xsputn, (const void*, std::streamsize)); auto xsputn(const char* s, std::streamsize n) -> std::streamsize override { const void* v = s; return xsputn(v, n);