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

Unified Diff: tests/corelib/uri_query_test.dart

Issue 16108003: Avoid parsing path and query string more than once (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Minor fixes Created 7 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/corelib/uri_path_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/corelib/uri_query_test.dart
diff --git a/tests/corelib/uri_query_test.dart b/tests/corelib/uri_query_test.dart
index acbe9d8b2b49cbd2b38ea716ef2abfbdca9d2fda..c38ced3c7b4e00ee0f77f357daf88c952f699556 100644
--- a/tests/corelib/uri_query_test.dart
+++ b/tests/corelib/uri_query_test.dart
@@ -71,8 +71,6 @@ void testQueryParameters() {
}
encoded = encoded.toString();
unencoded = unencoded.toString();
- print(encoded);
- print(unencoded);
test("a=$encoded", {"a": unencoded});
test("a=$encoded&b=$encoded", {"a": unencoded, "b": unencoded});
@@ -113,9 +111,35 @@ testInvalidQueryParameters() {
test("&=xxx&=xxx&", {});
}
+testQueryParametersImmutableMap() {
+ test(map) {
+ bool isUnsupported(e) => e is UnsupportedError;
+
+ Expect.isTrue(map.containsValue("b"));
+ Expect.isTrue(map.containsKey("a"));
+ Expect.equals("b", map["a"]);
+ Expect.throws(() => map["a"] = "c", isUnsupported);
+ Expect.throws(() => map.putIfAbsent("b", () => "e"), isUnsupported);
+ Expect.throws(() => map.remove("a"), isUnsupported);
+ Expect.throws(() => map.clear(), isUnsupported);
+ var count = 0;
+ map.forEach((key, value) => count++);
+ Expect.equals(2, count);
+ Expect.equals(2, map.keys.length);
+ Expect.equals(2, map.values.length);
+ Expect.equals(2, map.length);
+ Expect.isFalse(map.isEmpty);
+ Expect.isTrue(map.isNotEmpty);
+ }
+
+ test(Uri.parse("?a=b&c=d").queryParameters);
+ test(new Uri(queryParameters: {"a": "b", "c": "d"}).queryParameters);
+}
+
main() {
testInvalidArguments();
testEncodeQueryComponent();
testQueryParameters();
testInvalidQueryParameters();
+ testQueryParametersImmutableMap();
}
« no previous file with comments | « tests/corelib/uri_path_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698