From 636a9a5bf54b400e9f46c321e59107a644e06916 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 23 Apr 2013 01:59:17 +0300 Subject: add missing stringutils unit tests. --- src/utils/stringutils_unittest.cc | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src') 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"); +} -- cgit v1.2.3-70-g09d2