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", {"z": ["", ""], "y": [""], "w": [""]}); |
| 16 testParse("x=42&y=42&x=37&y=37", {"x": ["42", "37"], "y": ["42", "37"]}); |
| 17 testParse("x&x&x&x&x", {"x": ["", "", "", "", ""]}); |
| 18 testParse("x=&&y", {"x": [""], "y": [""]}); |
| 19 } |
| 20 |
| 21 testAll(List values) { |
| 22 var uri = new Uri(scheme: "foo", path: "bar", |
| 23 queryParameters: {"baz": values}); |
| 24 var list = uri.queryParametersAll["baz"]; |
| 25 Expect.listEquals(values, list); |
| 26 } |
| 27 |
| 28 testParse(query, results) { |
| 29 var uri = new Uri(scheme: "foo", path: "bar", query: query); |
| 30 var params = uri.queryParametersAll; |
| 31 for (var k in results.keys) { |
| 32 Expect.listEquals(results[k], params[k]); |
| 33 } |
| 34 uri = new Uri(scheme: "foo", path: "bar", queryParameters: results); |
| 35 params = uri.queryParametersAll; |
| 36 for (var k in results.keys) { |
| 37 Expect.listEquals(results[k], params[k]); |
| 38 } |
| 39 } |
OLD | NEW |