summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-04-23 01:59:17 +0300
committerAndrei Karas <akaras@inbox.ru>2013-04-23 01:59:17 +0300
commit636a9a5bf54b400e9f46c321e59107a644e06916 (patch)
tree1d23a3edcab3c44bedf3045258a937d6db6e5210
parent6969655f6d251f0c638c11c8561493e938695fa0 (diff)
downloadmanaplus-636a9a5bf54b400e9f46c321e59107a644e06916.tar.gz
manaplus-636a9a5bf54b400e9f46c321e59107a644e06916.tar.bz2
manaplus-636a9a5bf54b400e9f46c321e59107a644e06916.tar.xz
manaplus-636a9a5bf54b400e9f46c321e59107a644e06916.zip
add missing stringutils unit tests.
-rw-r--r--src/utils/stringutils_unittest.cc22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/utils/stringutils_unittest.cc b/src/utils/stringutils_unittest.cc
index c372e9dce..d3d274597 100644
--- a/src/utils/stringutils_unittest.cc
+++ b/src/utils/stringutils_unittest.cc
@@ -515,3 +515,25 @@ TEST(stringuntils, strStartWith1)
EXPECT_TRUE(strStartWith("test line", "test line"));
EXPECT_TRUE(!strStartWith("test line", "est"));
}
+
+TEST(stringuntils, encodeLinkText)
+{
+ std::string str;
+
+ str = encodeLinkText("test line");
+ EXPECT_EQ(str, "test line");
+ str = encodeLinkText("test|line");
+ EXPECT_EQ(str, "test\342\235\230line");
+ str = encodeLinkText("test||line");
+ EXPECT_EQ(str, "test\342\235\230\342\235\230line");
+}
+
+TEST(stringuntils, decodeLinkText)
+{
+ std::string str;
+
+ str = encodeLinkText("test|line");
+ EXPECT_EQ(str, "test\342\235\230line");
+ str = decodeLinkText(str);
+ EXPECT_EQ(str, "test|line");
+}