diff options
author | Michael Vogt <mvo@debian.org> | 2013-09-07 12:19:51 +0200 |
---|---|---|
committer | Michael Vogt <mvo@debian.org> | 2013-09-07 12:19:51 +0200 |
commit | 00f4d9ffa3468e899abf8fbda8db71fc3143b8e5 (patch) | |
tree | 7a32bb35ba43285f5d24f7c07ad8347b5ca499e5 /test/libapt/strutil_test.cc | |
parent | 968179cf7b9e1a633c283745da15755d8de4acbd (diff) |
implement StringSplit() as we need this to fix the dpkg status-fd output parsing
Diffstat (limited to 'test/libapt/strutil_test.cc')
-rw-r--r-- | test/libapt/strutil_test.cc | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/libapt/strutil_test.cc b/test/libapt/strutil_test.cc index bfe0d7222..bac9dd2f1 100644 --- a/test/libapt/strutil_test.cc +++ b/test/libapt/strutil_test.cc @@ -42,5 +42,22 @@ 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); + return 0; } |