Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: tests/corelib_2/uri_query_test.dart

Issue 2983123002: Migrate test block 30 + corelib portion of block 31 to Dart 2.0. (Closed)
Patch Set: Addressed Bob's comments Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tests/corelib_2/uri_path_test.dart ('k') | tests/corelib_2/uri_scheme_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 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. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 import "package:expect/expect.dart"; 5 import "package:expect/expect.dart";
6 6
7 void testInvalidArguments() {} 7 void testInvalidArguments() {}
8 8
9 void testEncodeQueryComponent() { 9 void testEncodeQueryComponent() {
10 // This exact data is from posting a form in Chrome 26 with the one 10 // This exact data is from posting a form in Chrome 26 with the one
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 encoded.write(i.toRadixString(16).toUpperCase()); 93 encoded.write(i.toRadixString(16).toUpperCase());
94 } 94 }
95 if (i == 32) { 95 if (i == 32) {
96 allEncoded.write("+"); 96 allEncoded.write("+");
97 } else { 97 } else {
98 allEncoded.write("%"); 98 allEncoded.write("%");
99 allEncoded.write(i.toRadixString(16).toUpperCase()); 99 allEncoded.write(i.toRadixString(16).toUpperCase());
100 } 100 }
101 unencoded.writeCharCode(i); 101 unencoded.writeCharCode(i);
102 } 102 }
103 encoded = encoded.toString(); 103 var encodedStr = encoded.toString();
104 unencoded = unencoded.toString(); 104 var unencodedStr = unencoded.toString();
105 test("a=$encoded", {"a": unencoded}); 105 test("a=$encodedStr", {"a": unencodedStr});
106 test("a=$encoded&b=$encoded", {"a": unencoded, "b": unencoded}); 106 test("a=$encodedStr&b=$encodedStr", {"a": unencodedStr, "b": unencodedStr});
107 107
108 var map = new Map(); 108 var map = new Map();
109 map[unencoded] = unencoded; 109 map[unencodedStr] = unencodedStr;
110 test("$encoded=$encoded", map); 110 test("$encodedStr=$encodedStr", map);
111 test("$encoded=$allEncoded", map, "$encoded=$encoded"); 111 test("$encodedStr=$allEncoded", map, "$encodedStr=$encodedStr");
112 test("$allEncoded=$encoded", map, "$encoded=$encoded"); 112 test("$allEncoded=$encodedStr", map, "$encodedStr=$encodedStr");
113 test("$allEncoded=$allEncoded", map, "$encoded=$encoded"); 113 test("$allEncoded=$allEncoded", map, "$encodedStr=$encodedStr");
114 map[unencoded] = null; 114 map[unencodedStr] = null;
115 test("$encoded", map); 115 test("$encodedStr", map);
116 map[unencoded] = ""; 116 map[unencodedStr] = "";
117 test("$encoded", map); 117 test("$encodedStr", map);
118 } 118 }
119 119
120 testInvalidQueryParameters() { 120 testInvalidQueryParameters() {
121 test(String query, Map<String, String> parameters) { 121 test(String query, Map<String, String> parameters) {
122 check(uri) { 122 check(uri) {
123 Expect.equals(query, uri.query); 123 Expect.equals(query, uri.query);
124 if (query.isEmpty) { 124 if (query.isEmpty) {
125 Expect.equals(query, uri.toString()); 125 Expect.equals(query, uri.toString());
126 } else { 126 } else {
127 Expect.equals("?$query", uri.toString()); 127 Expect.equals("?$query", uri.toString());
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 test(new Uri(queryParameters: {"a": "b", "c": "d"}).queryParameters); 173 test(new Uri(queryParameters: {"a": "b", "c": "d"}).queryParameters);
174 } 174 }
175 175
176 main() { 176 main() {
177 testInvalidArguments(); 177 testInvalidArguments();
178 testEncodeQueryComponent(); 178 testEncodeQueryComponent();
179 testQueryParameters(); 179 testQueryParameters();
180 testInvalidQueryParameters(); 180 testInvalidQueryParameters();
181 testQueryParametersImmutableMap(); 181 testQueryParametersImmutableMap();
182 } 182 }
OLDNEW
« no previous file with comments | « tests/corelib_2/uri_path_test.dart ('k') | tests/corelib_2/uri_scheme_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698