OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 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 | 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 import "dart:convert"; | 6 import "dart:convert"; |
7 import "dart:typed_data"; | 7 import "dart:typed_data"; |
8 | 8 |
9 main() { | 9 main() { |
10 testMediaType(); | 10 testMediaType(); |
11 | 11 |
12 testRoundTrip(""); | 12 testRoundTrip(""); |
13 testRoundTrip("a"); | 13 testRoundTrip("a"); |
14 testRoundTrip("ab"); | 14 testRoundTrip("ab"); |
15 testRoundTrip("abc"); | 15 testRoundTrip("abc"); |
16 testRoundTrip("abcd"); | 16 testRoundTrip("abcd"); |
17 testRoundTrip("Content with special%25 characters: # ? = % # ? = %"); | 17 testRoundTrip("Content with special%25 characters: # ? = % # ? = %"); |
18 testRoundTrip("blåbærgrød", UTF8); | 18 testRoundTrip("blåbærgrød", UTF8); |
19 testRoundTrip("blåbærgrød", LATIN1); | 19 testRoundTrip("blåbærgrød", LATIN1); |
20 | 20 |
21 testUriEquals("data:,abc?d#e"); | |
22 testUriEquals("DATA:,ABC?D#E"); | |
23 testUriEquals("data:,a%20bc?d#e"); | |
24 testUriEquals("DATA:,A%20BC?D#E"); | |
25 testUriEquals("data:,a%62c?d#e"); | |
26 testUriEquals("DATA:,A%42C?D#E"); | |
27 | |
28 testUtf8Encoding("\u1000\uffff"); | 21 testUtf8Encoding("\u1000\uffff"); |
29 testBytes(); | 22 testBytes(); |
30 testInvalidCharacters(); | 23 testInvalidCharacters(); |
31 testErrors(); | 24 testErrors(); |
32 } | 25 } |
33 | 26 |
34 void testMediaType() { | 27 void testMediaType() { |
35 for (var mimeType in ["", "text/plain", "text/javascript"]) { | 28 for (var mimeType in ["", "text/plain", "text/javascript"]) { |
36 for (var charset in ["", ";charset=US-ASCII", ";charset=UTF-8"]) { | 29 for (var charset in ["", ";charset=US-ASCII", ";charset=UTF-8"]) { |
37 for (var base64 in ["", ";base64"]) { | 30 for (var base64 in ["", ";base64"]) { |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 Expect.equals(expect.userInfo, actual.userInfo, "userInfo"); | 243 Expect.equals(expect.userInfo, actual.userInfo, "userInfo"); |
251 Expect.equals(expect.host, actual.host, "host"); | 244 Expect.equals(expect.host, actual.host, "host"); |
252 Expect.equals(expect.hasPort, actual.hasPort, "hasPort"); | 245 Expect.equals(expect.hasPort, actual.hasPort, "hasPort"); |
253 Expect.equals(expect.port, actual.port, "port"); | 246 Expect.equals(expect.port, actual.port, "port"); |
254 Expect.equals(expect.port, actual.port, "port"); | 247 Expect.equals(expect.port, actual.port, "port"); |
255 Expect.equals(expect.hasQuery, actual.hasQuery, "hasQuery"); | 248 Expect.equals(expect.hasQuery, actual.hasQuery, "hasQuery"); |
256 Expect.equals(expect.query, actual.query, "query"); | 249 Expect.equals(expect.query, actual.query, "query"); |
257 Expect.equals(expect.hasFragment, actual.hasFragment, "hasFragment"); | 250 Expect.equals(expect.hasFragment, actual.hasFragment, "hasFragment"); |
258 Expect.equals(expect.fragment, actual.fragment, "fragment"); | 251 Expect.equals(expect.fragment, actual.fragment, "fragment"); |
259 } | 252 } |
260 | |
261 void testUriEquals(String uriText) { | |
262 var data = UriData.parse(uriText); | |
263 var uri = Uri.parse(uriText); | |
264 Expect.equals(data.uri, uri); | |
265 Expect.equals(data.toString(), uri.data.toString()); | |
266 Expect.equals(data.toString(), uri.toString()); | |
267 } | |
OLD | NEW |