diff options
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; } |