OLD | NEW |
| (Empty) |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | |
2 // for details. All rights reserved. Use of this source code is governed by a | |
3 // BSD-style license that can be found in the LICENSE file. | |
4 | |
5 import "package:expect/expect.dart"; | |
6 import 'dart:convert'; | |
7 | |
8 main() { | |
9 testAll(["a", "b", "c"]); | |
10 testAll([""]); | |
11 testAll(["a"]); | |
12 testAll(["", ""]); | |
13 testAll(["baz"]); | |
14 | |
15 testParse("z&y&w&z", { | |
16 "z": ["", ""], | |
17 "y": [""], | |
18 "w": [""] | |
19 }); | |
20 testParse("x=42&y=42&x=37&y=37", { | |
21 "x": ["42", "37"], | |
22 "y": ["42", "37"] | |
23 }); | |
24 testParse("x&x&x&x&x", { | |
25 "x": ["", "", "", "", ""] | |
26 }); | |
27 testParse("x=&&y", { | |
28 "x": [""], | |
29 "y": [""] | |
30 }); | |
31 } | |
32 | |
33 testAll(List values) { | |
34 var uri = | |
35 new Uri(scheme: "foo", path: "bar", queryParameters: {"baz": values}); | |
36 var list = uri.queryParametersAll["baz"]; | |
37 Expect.listEquals(values, list); | |
38 } | |
39 | |
40 testParse(query, results) { | |
41 var uri = new Uri(scheme: "foo", path: "bar", query: query); | |
42 var params = uri.queryParametersAll; | |
43 for (var k in results.keys) { | |
44 Expect.listEquals(results[k], params[k]); | |
45 } | |
46 uri = new Uri(scheme: "foo", path: "bar", queryParameters: results); | |
47 params = uri.queryParametersAll; | |
48 for (var k in results.keys) { | |
49 Expect.listEquals(results[k], params[k]); | |
50 } | |
51 } | |
OLD | NEW |