diff options
author | Michael Vogt <mvo@debian.org> | 2014-02-27 22:52:34 +0100 |
---|---|---|
committer | Michael Vogt <mvo@debian.org> | 2014-02-27 22:52:34 +0100 |
commit | fce69e7a0f38299c57ef96ae1c1dd9a5379bfd5a (patch) | |
tree | be7d18baa836e9df166ec63f6c9fe6f94bb84b40 /test/libapt/strutil_test.cc | |
parent | a5e790985752c6820e08e7a7e650e1607fa826e4 (diff) | |
parent | fc104da6a583736223b2f941e43a05ea26b63a7d (diff) |
Merge branch 'debian/sid' into debian/experimental
Conflicts:
apt-private/private-list.cc
configure.ac
debian/apt.install.in
debian/changelog
Diffstat (limited to 'test/libapt/strutil_test.cc')
-rw-r--r-- | test/libapt/strutil_test.cc | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/test/libapt/strutil_test.cc b/test/libapt/strutil_test.cc index bfe0d7222..8215654d0 100644 --- a/test/libapt/strutil_test.cc +++ b/test/libapt/strutil_test.cc @@ -42,5 +42,50 @@ 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); + + // endswith + bool b; + input = "abcd"; + b = APT::String::Endswith(input, "d"); + equals(b, true); + + b = APT::String::Endswith(input, "cd"); + equals(b, true); + + b = APT::String::Endswith(input, "abcd"); + equals(b, true); + + b = APT::String::Endswith(input, "x"); + equals(b, false); + + b = APT::String::Endswith(input, "abcndefg"); + equals(b, false); + return 0; } |