1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-08-19 12:39:11 +00:00

Add: Basic autocompletion on tab for console commands (#12163)

This commit is contained in:
Ivan Fefer
2024-03-13 21:43:08 +01:00
committed by GitHub
parent 24efdf6ac5
commit 23d733be95
9 changed files with 250 additions and 148 deletions

View File

@@ -384,3 +384,27 @@ TEST_CASE("ConvertHexToBytes")
CHECK(bytes3[6] == 0xde);
CHECK(bytes3[7] == 0xf0);
}
static const std::vector<std::pair<std::string, std::string>> _str_trim_testcases = {
{"a", "a"},
{" a", "a"},
{"a ", "a"},
{" a ", "a"},
{" a b c ", "a b c"},
{" ", ""}
};
TEST_CASE("StrTrimInPlace")
{
for (auto [input, expected] : _str_trim_testcases) {
StrTrimInPlace(input);
CHECK(input == expected);
}
}
TEST_CASE("StrTrimView") {
for (const auto& [input, expected] : _str_trim_testcases) {
CHECK(StrTrimView(input) == expected);
}
}