summaryrefslogtreecommitdiff
path: root/src/utils/stringutils_unittest.cc
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-01-17 03:13:39 +0300
committerAndrei Karas <akaras@inbox.ru>2016-01-17 14:19:17 +0300
commit41141188d70dd7d6e0b8667bda9d0f6569c0b97b (patch)
tree4ed6186d9805fe3240fd3f574faa4455ca9e3fa9 /src/utils/stringutils_unittest.cc
parentfcf4c08536267a7be624b057c28586f510c0af2c (diff)
downloadmanaverse-41141188d70dd7d6e0b8667bda9d0f6569c0b97b.tar.gz
manaverse-41141188d70dd7d6e0b8667bda9d0f6569c0b97b.tar.bz2
manaverse-41141188d70dd7d6e0b8667bda9d0f6569c0b97b.tar.xz
manaverse-41141188d70dd7d6e0b8667bda9d0f6569c0b97b.zip
Add support for adding cards into item links in chat.
Diffstat (limited to 'src/utils/stringutils_unittest.cc')
-rw-r--r--src/utils/stringutils_unittest.cc32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/utils/stringutils_unittest.cc b/src/utils/stringutils_unittest.cc
index e2db8eed1..d2dfcdf62 100644
--- a/src/utils/stringutils_unittest.cc
+++ b/src/utils/stringutils_unittest.cc
@@ -625,6 +625,14 @@ TEST_CASE("stringuntils replaceItemLinks")
str = "[qqq]";
replaceItemLinks(str);
REQUIRE(str == "[qqq]");
+
+ str = "[,]";
+ replaceItemLinks(str);
+ REQUIRE(str == "[,]");
+
+ str = "[, ]";
+ replaceItemLinks(str);
+ REQUIRE(str == "[, ]");
}
SECTION("simple")
@@ -653,6 +661,14 @@ TEST_CASE("stringuntils replaceItemLinks")
str = "[test name 1] [no link]";
replaceItemLinks(str);
REQUIRE(str == "[@@123456|test name 1@@] [no link]");
+
+ str = "[test name 1,test name 2]";
+ replaceItemLinks(str);
+ REQUIRE(str == "[@@123456,123|test name 1@@]");
+
+ str = "[test name 1, test name 2 ]";
+ replaceItemLinks(str);
+ REQUIRE(str == "[@@123456,123|test name 1@@]");
}
SECTION("broken")
@@ -770,5 +786,21 @@ TEST_CASE("stringuntils replaceItemLinks")
str = "[[test name 1[]test name 1]";
replaceItemLinks(str);
REQUIRE(str == "[[test name 1[]test name 1]");
+
+ str = "[[test name 1],test name2,test name 1]";
+ replaceItemLinks(str);
+ REQUIRE(str == "[[@@123456|test name 1@@],test name2,test name 1]");
+
+ str = "[[ test name 1], test name2,test name 1 ]";
+ replaceItemLinks(str);
+ REQUIRE(str == "[[@@123456|test name 1@@], test name2,test name 1 ]");
+
+ str = "[[test name 1,test name2[]test name 1]";
+ replaceItemLinks(str);
+ REQUIRE(str == "[[test name 1,test name2[]test name 1]");
+
+ str = "[[test name 1 ,test name2[] test name 1]";
+ replaceItemLinks(str);
+ REQUIRE(str == "[[test name 1 ,test name2[] test name 1]");
}
}