]> git.saurik.com Git - apt.git/blame - test/libapt/strutil_test.cc
trigger the usage of the fallback code for kfreebsd also in the
[apt.git] / test / libapt / strutil_test.cc
CommitLineData
a513ace2
MV
1#include <apt-pkg/strutl.h>
2
3#include "assert.h"
4
5int main(int argc,char *argv[])
6{
8f3ba4e8 7 std::string input, output, expected;
a513ace2
MV
8
9 // no input
10 input = "foobar";
11 expected = "foobar";
12 output = DeEscapeString(input);
13 equals(output, expected);
14
15 // hex and octal
16 input = "foo\\040bar\\x0abaz";
17 expected = "foo bar\nbaz";
18 output = DeEscapeString(input);
19 equals(output, expected);
20
21 // at the end
22 input = "foo\\040";
23 expected = "foo ";
24 output = DeEscapeString(input);
25 equals(output, expected);
26
27 // double escape
28 input = "foo\\\\ x";
29 expected = "foo\\ x";
30 output = DeEscapeString(input);
31 equals(output, expected);
32
33 // double escape at the end
34 input = "\\\\foo\\\\";
35 expected = "\\foo\\";
36 output = DeEscapeString(input);
37 equals(output, expected);
38
b9dc4706
MV
39 // the string that we actually need it for
40 input = "/media/Ubuntu\\04011.04\\040amd64";
41 expected = "/media/Ubuntu 11.04 amd64";
42 output = DeEscapeString(input);
43 equals(output, expected);
44
a513ace2
MV
45 return 0;
46}