Skip to content
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
2 changes: 1 addition & 1 deletion test/common/http/http1/conn_pool_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1155,7 +1155,7 @@ class MockDestructSchedulableCallback : public Event::MockSchedulableCallback {
public:
MockDestructSchedulableCallback(Event::MockDispatcher* dispatcher)
: Event::MockSchedulableCallback(dispatcher) {}
MOCK_METHOD0(Die, void());
MOCK_METHOD(void, Die, ());

~MockDestructSchedulableCallback() override { Die(); }
};
Expand Down
2 changes: 1 addition & 1 deletion test/extensions/bootstrap/wasm/wasm_speed_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class TestRoot : public Envoy::Extensions::Common::Wasm::Context {
log_(static_cast<spdlog::level::level_enum>(level), message);
return proxy_wasm::WasmResult::Ok;
}
MOCK_METHOD2(log_, void(spdlog::level::level_enum level, absl::string_view message));
MOCK_METHOD(void, log_, (spdlog::level::level_enum level, absl::string_view message));
};

static void bmWasmSimpleCallSpeedTest(benchmark::State& state, std::string test,
Expand Down
2 changes: 1 addition & 1 deletion test/extensions/bootstrap/wasm/wasm_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class TestContext : public Extensions::Common::Wasm::Context {
log_(static_cast<spdlog::level::level_enum>(level), message);
return proxy_wasm::WasmResult::Ok;
}
MOCK_METHOD2(log_, void(spdlog::level::level_enum level, absl::string_view message));
MOCK_METHOD(void, log_, (spdlog::level::level_enum level, absl::string_view message));
};

class WasmTestBase {
Expand Down
2 changes: 1 addition & 1 deletion test/extensions/common/wasm/wasm_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class TestContext : public ::Envoy::Extensions::Common::Wasm::Context {
Extensions::Common::Wasm::Context::log(static_cast<spdlog::level::level_enum>(level), message);
return proxy_wasm::WasmResult::Ok;
}
MOCK_METHOD2(log_, void(spdlog::level::level_enum level, absl::string_view message));
MOCK_METHOD(void, log_, (spdlog::level::level_enum level, absl::string_view message));
};

class WasmCommonTest : public testing::TestWithParam<std::string> {
Expand Down
2 changes: 1 addition & 1 deletion test/extensions/stats_sinks/wasm/wasm_stat_sink_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class TestContext : public ::Envoy::Extensions::Common::Wasm::Context {
Extensions::Common::Wasm::Context::log(static_cast<spdlog::level::level_enum>(level), message);
return proxy_wasm::WasmResult::Ok;
}
MOCK_METHOD2(log_, void(spdlog::level::level_enum level, absl::string_view message));
MOCK_METHOD(void, log_, (spdlog::level::level_enum level, absl::string_view message));
};

class WasmCommonContextTest
Expand Down
2 changes: 1 addition & 1 deletion test/test_common/wasm_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ namespace Wasm {
log_(static_cast<spdlog::level::level_enum>(level), message); \
return proxy_wasm::WasmResult::Ok; \
} \
MOCK_METHOD2(log_, void(spdlog::level::level_enum level, absl::string_view message))
MOCK_METHOD(void, log_, (spdlog::level::level_enum level, absl::string_view message))

class DeferredRunner {
public:
Expand Down
4 changes: 4 additions & 0 deletions tools/code_format/check_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@
VERSION_HISTORY_SECTION_NAME = re.compile("^[A-Z][A-Za-z ]*$")
RELOADABLE_FLAG_REGEX = re.compile(".*(..)(envoy.reloadable_features.[^ ]*)\s.*")
INVALID_REFLINK = re.compile(".* ref:.*")
OLD_MOCK_METHOD_REGEX = re.compile("MOCK_METHOD\d")
# Check for punctuation in a terminal ref clause, e.g.
# :ref:`panic mode. <arch_overview_load_balancing_panic_threshold>`
REF_WITH_PUNCTUATION_REGEX = re.compile(".*\. <[^<]*>`\s*")
Expand Down Expand Up @@ -773,6 +774,9 @@ def checkSourceLine(self, line, file_path, reportError):
# Matches variants of TEST(), TEST_P(), TEST_F() etc. where the test name begins
# with a lowercase letter.
reportError("Test names should be CamelCase, starting with a capital letter")
if OLD_MOCK_METHOD_REGEX.search(line):
reportError("The MOCK_METHODn() macros should not be used, use MOCK_METHOD() instead")

if not self.allowlistedForSerializeAsString(file_path) and "SerializeAsString" in line:
# The MessageLite::SerializeAsString doesn't generate deterministic serialization,
# use MessageUtil::hash instead.
Expand Down
1 change: 1 addition & 0 deletions tools/code_format/check_format_test_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ def runChecks():
"Don't use mangled Protobuf names for enum constants")
errors += checkUnfixableError("test_naming.cc",
"Test names should be CamelCase, starting with a capital letter")
errors += checkUnfixableError("mock_method_n.cc", "use MOCK_METHOD() instead")
errors += checkUnfixableError(
"test/register_factory.cc",
"Don't use Registry::RegisterFactory or REGISTER_FACTORY in tests, use "
Expand Down
7 changes: 7 additions & 0 deletions tools/testdata/check_format/mock_method_n.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace Envoy {

struct Class {
MOCK_METHOD1(name, void());
};

} // namespace Envoy