Imported Upstream version 2.5.11
[libapache-mod-security.git] / apache2 / t / tfn / jsDecode.t
1 ### Empty
2 {
3         type => "tfn",
4         name => "jsDecode",
5         input => "",
6         output => "",
7         ret => 0,
8 },
9
10 ### Nothing
11 {
12         type => "tfn",
13         name => "jsDecode",
14         input => "TestCase",
15         output => "TestCase",
16         ret => 0,
17 },
18 {
19         type => "tfn",
20         name => "jsDecode",
21         input => "Test\0Case",
22         output => "Test\0Case",
23         ret => 0,
24 },
25
26 ### Valid Sequences
27 {
28         type => "tfn",
29         name => "jsDecode",
30         input => "\\a\\b\\f\\n\\r\\t\\v\\?\\'\\\"\\0\\12\\123\\x00\\xff\\u0021\\uff01",
31         output => "\a\b\f\x0a\x0d\t\x0b?'\"\x00\x0a\x53\x00\xff\x21\x21",
32         ret => 1,
33 },
34 {
35         type => "tfn",
36         name => "jsDecode",
37         input => "\\a\\b\\f\\n\\r\\t\\v\0\\?\\'\\\"\\0\\12\\123\\x00\\xff\\u0021\\uff01",
38         output => "\a\b\f\x0a\x0d\t\x0b\0?'\"\x00\x0a\x53\x00\xff\x21\x21",
39         ret => 1,
40 },
41
42 ### Invalid Sequences
43 # \8 and \9 are not octal
44 # \666 is \66 + '6' (JS does not allow the overflow as C does)
45 # \u00ag, \u00ga, \u0zaa, \uz0aa are not hex
46 # \xag and \xga are not hex,
47 # \0123 is \012 + '3'
48 {
49         type => "tfn",
50         name => "jsDecode",
51         input => "\\8\\9\\666\\u00ag\\u00ga\\u0zaa\\uz0aa\\xag\\xga\\0123\\u00a",
52         output => "89\x366u00agu00gau0zaauz0aaxagxga\x0a3u00a",
53         ret => 1,
54 },
55
56 # \x, \x0 lack enough hex digits
57 {
58         type => "tfn",
59         name => "jsDecode",
60         input => "\\x",
61         output => "x",
62         ret => 1,
63 },
64 {
65         type => "tfn",
66         name => "jsDecode",
67         input => "\\x\\x0",
68         output => "xx0",
69         ret => 1,
70 },
71 {
72         type => "tfn",
73         name => "jsDecode",
74         input => "\\x\\x0\0",
75         output => "xx0\0",
76         ret => 1,
77 },
78 # \u, \u0 \u01, \u012 lack enough hex digits
79 {
80         type => "tfn",
81         name => "jsDecode",
82         input => "\\u",
83         output => "u",
84         ret => 1,
85 },
86 {
87         type => "tfn",
88         name => "jsDecode",
89         input => "\\u\\u0",
90         output => "uu0",
91         ret => 1,
92 },
93 {
94         type => "tfn",
95         name => "jsDecode",
96         input => "\\u\\u0\\u01",
97         output => "uu0u01",
98         ret => 1,
99 },
100 {
101         type => "tfn",
102         name => "jsDecode",
103         input => "\\u\\u0\\u01\\u012",
104         output => "uu0u01u012",
105         ret => 1,
106 },
107 {
108         type => "tfn",
109         name => "jsDecode",
110         input => "\\u\\u0\\u01\\u012\0",
111         output => "uu0u01u012\0",
112         ret => 1,
113 },
114 # A forward slash with nothing after
115 {
116         type => "tfn",
117         name => "jsDecode",
118         input => "\\",
119         output => "\\",
120         ret => 0,
121 },
122 # A forward slash with NUL after
123 {
124         type => "tfn",
125         name => "jsDecode",
126         input => "\\\0",
127         output => "\0",
128         ret => 1,
129 },