Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update tests to use recommended MOCK_METHOD #3395

Merged
merged 1 commit into from
Apr 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions test/core-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ TEST(buffer_test, indestructible) {
}

template <typename T> struct mock_buffer final : buffer<T> {
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));
Expand Down Expand Up @@ -327,8 +327,8 @@ template <typename T> 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); }

Expand Down
4 changes: 2 additions & 2 deletions test/mock-allocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ template <typename T> 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 <typename Allocator> class allocator_ref {
Expand Down
2 changes: 1 addition & 1 deletion test/ostream-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down