diff options
author | Treeston <treeston.mmoc@gmail.com> | 2020-09-12 19:42:10 +0200 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2022-02-05 23:42:15 +0100 |
commit | 378691aaa286822ee20e0428d278f2bca6e7438e (patch) | |
tree | 82ee5ee5466dc5a593ab7aef9875c89e675dc63e /tests | |
parent | 7d0586812a8e7d17f901d9e01af424c4a4ff6bc7 (diff) |
[3.3.5] Core/ChatCommands: Show error messages from argument parsers (PR #25443)
(cherry picked from commit 75f9e7396e35360f3016cc0cb21e72e20f5d96d5)
Diffstat (limited to 'tests')
-rw-r--r-- | tests/game/ChatCommand.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/tests/game/ChatCommand.cpp b/tests/game/ChatCommand.cpp index 2f73b579f84..af5cfd783ad 100644 --- a/tests/game/ChatCommand.cpp +++ b/tests/game/ChatCommand.cpp @@ -17,15 +17,24 @@ #include "tc_catch2.h" +#include "Chat.h" #include "ChatCommand.h" using namespace Trinity::ChatCommands; using namespace std::string_view_literals; +struct DummyChatHandler : ChatHandler +{ + DummyChatHandler() : ChatHandler(nullptr) {} + void SendSysMessage(std::string_view, bool) override {} + char const* GetTrinityString(uint32) const override { return ""; } +}; + template <typename F> static void TestChatCommand(char const* c, F f, Optional<bool> expected = true) { - bool r = ChatCommand("", 0, false, +f, "")(nullptr, c); + DummyChatHandler handler; + bool r = ChatCommand("", 0, false, +f, "")(&handler, c); if (expected) REQUIRE(r == *expected); } |