tests/utils: Add tests for replaceAll

This commit is contained in:
Peter Keresztes Schmidt 2021-03-22 23:30:45 +01:00
parent 6150ceeb17
commit 13f91b5826
1 changed files with 14 additions and 0 deletions

View File

@ -49,3 +49,17 @@ TEST_CASE("trimSpaces") {
REQUIRE(trimSpaces("\t te st \t") == "te st"); REQUIRE(trimSpaces("\t te st \t") == "te st");
} }
TEST_CASE("replaceAll") {
REQUIRE(replaceAll("", "", "") == "");
REQUIRE(replaceAll("a", "", "b") == "a");
REQUIRE(replaceAll("a", "a", "b") == "b");
REQUIRE(replaceAll("a", "b", "c") == "a");
REQUIRE(replaceAll("aa", "a", "b") == "bb");
REQUIRE(replaceAll("aba", "a", "c") == "cbc");
REQUIRE(replaceAll("aTOKENa", "TOKEN", "VAL") == "aVALa");
REQUIRE(replaceAll("aTOKENaTOKEN", "TOKEN", "VAL") == "aVALaVAL");
}