summaryrefslogtreecommitdiff
path: root/src/utils/stringutils_unittest.cc
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-03-28 20:54:07 +0300
committerAndrei Karas <akaras@inbox.ru>2016-03-28 20:54:07 +0300
commit8a70081facef94bb1dbd80a80f35ffd50d67a365 (patch)
treead9fa3b9c36677df6ce729cd4dcb6b2541e084e7 /src/utils/stringutils_unittest.cc
parent195315b65cfb8e74bf09ff416f69e80c50a01f74 (diff)
downloadplus-8a70081facef94bb1dbd80a80f35ffd50d67a365.tar.gz
plus-8a70081facef94bb1dbd80a80f35ffd50d67a365.tar.bz2
plus-8a70081facef94bb1dbd80a80f35ffd50d67a365.tar.xz
plus-8a70081facef94bb1dbd80a80f35ffd50d67a365.zip
Add test for function escapeString.
Diffstat (limited to 'src/utils/stringutils_unittest.cc')
-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();