summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2014-09-07 21:27:57 +0200
committerDavid Kalnischkies <david@kalnischkies.de>2014-09-07 21:27:57 +0200
commitb578738870e83db4e61d6f6591bc73884108b7d4 (patch)
treecfb8576ef3da0c85f3ba67d6173781476b46e02f /test
parent27cb4f6c919921b04f3dddff069620ced250a94f (diff)
strip everything spacey in APT::String::Strip
Git-Dch: Ignore
Diffstat (limited to 'test')
-rw-r--r--test/libapt/strutil_test.cc15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/libapt/strutil_test.cc b/test/libapt/strutil_test.cc
index e9b778c6b..194c9c074 100644
--- a/test/libapt/strutil_test.cc
+++ b/test/libapt/strutil_test.cc
@@ -19,6 +19,21 @@ TEST(StrUtilTest,DeEscapeString)
EXPECT_EQ("foo\\ x", DeEscapeString("foo\\\\ x"));
EXPECT_EQ("\\foo\\", DeEscapeString("\\\\foo\\\\"));
}
+TEST(StrUtilTest,StringStrip)
+{
+ EXPECT_EQ("", APT::String::Strip(""));
+ EXPECT_EQ("foobar", APT::String::Strip("foobar"));
+ EXPECT_EQ("foo bar", APT::String::Strip("foo bar"));
+
+ EXPECT_EQ("", APT::String::Strip(" "));
+ EXPECT_EQ("", APT::String::Strip(" \r\n \t "));
+
+ EXPECT_EQ("foo bar", APT::String::Strip("foo bar "));
+ EXPECT_EQ("foo bar", APT::String::Strip("foo bar \r\n \t "));
+ EXPECT_EQ("foo bar", APT::String::Strip("\r\n \t foo bar"));
+ EXPECT_EQ("bar foo", APT::String::Strip("\r\n \t bar foo \r\n \t "));
+ EXPECT_EQ("bar \t\r\n foo", APT::String::Strip("\r\n \t bar \t\r\n foo \r\n \t "));
+}
TEST(StrUtilTest,StringSplitBasic)
{
std::vector<std::string> result = StringSplit("", "");