summaryrefslogtreecommitdiff
path: root/src/utils
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/stringutils_unittest.cc14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/utils/stringutils_unittest.cc b/src/utils/stringutils_unittest.cc
index b921cf509..874fef359 100644
--- a/src/utils/stringutils_unittest.cc
+++ b/src/utils/stringutils_unittest.cc
@@ -606,6 +606,20 @@ TEST_CASE("stringuntils findAny")
REQUIRE(findAny("\"one\",,two, tree", ",", 5) == 5U);
}
+TEST_CASE("stringuntils escapeString")
+{
+ REQUIRE(escapeString("") == "\"\"");
+ REQUIRE(escapeString("1") == "\"1\"");
+ REQUIRE(escapeString(" ") == "\" \"");
+ REQUIRE(escapeString("\"") == "\"\\\"\"");
+ REQUIRE(escapeString("123") == "\"123\"");
+ REQUIRE(escapeString("12\"3") == "\"12\\\"3\"");
+ REQUIRE(escapeString("12\"\"3") == "\"12\\\"\\\"3\"");
+ REQUIRE(escapeString("\"123\"") == "\"\\\"123\\\"\"");
+ REQUIRE(escapeString("\\") == "\"\\\"");
+ REQUIRE(escapeString("12\\3") == "\"12\\3\"");
+}
+
TEST_CASE("stringuntils replaceItemLinks")
{
ItemDB::NamedItemInfos &infos = ItemDB::getNamedItemInfosTest();