summaryrefslogtreecommitdiff
path: root/src/utils/stringutils_unittest.cc
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-02-10 16:36:04 +0300
committerAndrei Karas <akaras@inbox.ru>2016-02-10 16:36:04 +0300
commit5a15b718a475f8c2809521ea3166de379bf85b36 (patch)
tree9b50a62cf5192469dc23448aace0d7ba7996ccf0 /src/utils/stringutils_unittest.cc
parente19faa6874b92a949703e37e07e912c693545496 (diff)
downloadmanaplus-5a15b718a475f8c2809521ea3166de379bf85b36.tar.gz
manaplus-5a15b718a475f8c2809521ea3166de379bf85b36.tar.bz2
manaplus-5a15b718a475f8c2809521ea3166de379bf85b36.tar.xz
manaplus-5a15b718a475f8c2809521ea3166de379bf85b36.zip
In parameters parsing function add support for multiply separators.
Diffstat (limited to 'src/utils/stringutils_unittest.cc')
-rw-r--r--src/utils/stringutils_unittest.cc13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/utils/stringutils_unittest.cc b/src/utils/stringutils_unittest.cc
index f6586558c..b921cf509 100644
--- a/src/utils/stringutils_unittest.cc
+++ b/src/utils/stringutils_unittest.cc
@@ -593,6 +593,19 @@ TEST_CASE("stringuntils isDigit")
REQUIRE_FALSE(isDigit("12-34"));
}
+TEST_CASE("stringuntils findAny")
+{
+ std::string str;
+
+ REQUIRE(findAny("test line", ",", 0) == std::string::npos);
+ REQUIRE(findAny("test line", " ", 0) == 4U);
+ REQUIRE(findAny("test, line", ", ", 0) == 4U);
+ REQUIRE(findAny("test ,line", ", ", 0) == 4U);
+ REQUIRE(findAny("test, line", " ,", 2) == 4U);
+ REQUIRE(findAny("test ,line", " ,", 3) == 4U);
+ REQUIRE(findAny("\"one\",,two, tree", ",", 5) == 5U);
+}
+
TEST_CASE("stringuntils replaceItemLinks")
{
ItemDB::NamedItemInfos &infos = ItemDB::getNamedItemInfosTest();