diff options
author | David Kalnischkies <kalnischkies@gmail.com> | 2011-09-13 17:52:22 +0200 |
---|---|---|
committer | David Kalnischkies <kalnischkies@gmail.com> | 2011-09-13 17:52:22 +0200 |
commit | 74b220028595342028e3309002e4ec359af328f9 (patch) | |
tree | 0132b7fd4b4f5fa5e2dbce1f2e0fbeeff2c8e101 /test/libapt/strutil_test.cc | |
parent | 650faab01603caac04494d54cf6b10a65c00ea13 (diff) | |
parent | b11fe392b2245354591296df88c3be2e6218af12 (diff) |
merge with debian/experimental
Diffstat (limited to 'test/libapt/strutil_test.cc')
-rw-r--r-- | test/libapt/strutil_test.cc | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/test/libapt/strutil_test.cc b/test/libapt/strutil_test.cc new file mode 100644 index 000000000..af6eb2cc6 --- /dev/null +++ b/test/libapt/strutil_test.cc @@ -0,0 +1,46 @@ +#include <apt-pkg/strutl.h> + +#include "assert.h" + +int main(int argc,char *argv[]) +{ + string input, output, expected; + + // no input + input = "foobar"; + expected = "foobar"; + output = DeEscapeString(input); + equals(output, expected); + + // hex and octal + input = "foo\\040bar\\x0abaz"; + expected = "foo bar\nbaz"; + output = DeEscapeString(input); + equals(output, expected); + + // at the end + input = "foo\\040"; + expected = "foo "; + output = DeEscapeString(input); + equals(output, expected); + + // double escape + input = "foo\\\\ x"; + expected = "foo\\ x"; + output = DeEscapeString(input); + equals(output, expected); + + // double escape at the end + input = "\\\\foo\\\\"; + expected = "\\foo\\"; + output = DeEscapeString(input); + equals(output, expected); + + // the string that we actually need it for + input = "/media/Ubuntu\\04011.04\\040amd64"; + expected = "/media/Ubuntu 11.04 amd64"; + output = DeEscapeString(input); + equals(output, expected); + + return 0; +} |