diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-03-28 20:54:07 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-03-28 20:54:07 +0300 |
commit | 8a70081facef94bb1dbd80a80f35ffd50d67a365 (patch) | |
tree | ad9fa3b9c36677df6ce729cd4dcb6b2541e084e7 | |
parent | 195315b65cfb8e74bf09ff416f69e80c50a01f74 (diff) | |
download | plus-8a70081facef94bb1dbd80a80f35ffd50d67a365.tar.gz plus-8a70081facef94bb1dbd80a80f35ffd50d67a365.tar.bz2 plus-8a70081facef94bb1dbd80a80f35ffd50d67a365.tar.xz plus-8a70081facef94bb1dbd80a80f35ffd50d67a365.zip |
Add test for function escapeString.
-rw-r--r-- | src/utils/stringutils_unittest.cc | 14 |
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(); |