summaryrefslogtreecommitdiff
path: root/test/libapt
diff options
context:
space:
mode:
authorMichael Vogt <mvo@debian.org>2013-10-05 10:49:26 +0200
committerMichael Vogt <mvo@debian.org>2013-10-05 10:49:26 +0200
commitb821e492d6dc4e1e8fd1f83590e12e3fbccad717 (patch)
treeac6d28f28fe13078aa578e1fb0fdd956a7e6ae84 /test/libapt
parent318289bb17b827611fea6570f71df525b60a0e97 (diff)
parent75cd2506ce7ea411f7a0e888310d622ad330828c (diff)
Merge remote-tracking branch 'mvo/bugfix/dpkg-progress-multiarch' into debian/sid
Diffstat (limited to 'test/libapt')
-rw-r--r--test/libapt/strutil_test.cc27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/libapt/strutil_test.cc b/test/libapt/strutil_test.cc
index bfe0d7222..110a20d27 100644
--- a/test/libapt/strutil_test.cc
+++ b/test/libapt/strutil_test.cc
@@ -42,5 +42,32 @@ int main(int argc,char *argv[])
output = DeEscapeString(input);
equals(output, expected);
+ // Split
+ input = "status: libnet1:amd64: unpacked";
+ vector<std::string> result = StringSplit(input, ": ");
+ equals(result[0], "status");
+ equals(result[1], "libnet1:amd64");
+ equals(result[2], "unpacked");
+ equals(result.size(), 3);
+
+ input = "status: libnet1:amd64: unpacked";
+ result = StringSplit(input, "xxx");
+ equals(result[0], input);
+ equals(result.size(), 1);
+
+ input = "status: libnet1:amd64: unpacked";
+ result = StringSplit(input, "");
+ equals(result.size(), 0);
+
+ input = "x:y:z";
+ result = StringSplit(input, ":", 2);
+ equals(result.size(), 2);
+ equals(result[0], "x");
+ equals(result[1], "y:z");
+
+ input = "abc";
+ result = StringSplit(input, "");
+ equals(result.size(), 0);
+
return 0;
}