tests/utils: Add tests for join

This commit is contained in:
Peter Keresztes Schmidt 2021-04-03 21:11:38 +02:00
parent e54c10fdb4
commit bbc4afcf1b
1 changed files with 10 additions and 0 deletions

View File

@ -134,3 +134,13 @@ TEST_CASE("split (string delimiter)") {
items = split("a b c", " ", 2); items = split("a b c", " ", 2);
REQUIRE(items == std::vector<std::string>{"a", "b c"}); REQUIRE(items == std::vector<std::string>{"a", "b c"});
} }
TEST_CASE("join") {
REQUIRE(join({}, "") == "");
REQUIRE(join({}, " ") == "");
REQUIRE(join({""}, "") == "");
REQUIRE(join({"a"}, "") == "a");
REQUIRE(join({"a"}, ",") == "a");
REQUIRE(join({"a", "b"}, ",") == "a,b");
REQUIRE(join({"a", "b"}, "") == "ab");
}