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

Side by Side Diff: tests/corelib/uri_normalize_test.dart

Issue 16019002: Merge the dart:uri library into dart:core and update the Uri class (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Final cleanup 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tests/corelib/uri_ipv6_test.dart ('k') | tests/corelib/uri_path_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
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 import "package:expect/expect.dart";
6
7 testNormalizePath() {
8 test(String expected, String path) {
9 var uri = new Uri(path: path);
10 Expect.equals(expected, uri.path);
11 Expect.equals(expected, uri.toString());
12 }
13
14 var unreserved = "-._~0123456789"
15 "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
16 "abcdefghijklmnopqrstuvwxyz";
17
18 test("A", "%41");
19 test("AB", "%41%42");
20 test("%40AB", "%40%41%42");
21 test("a", "%61");
22 test("ab", "%61%62");
23 test("%60ab", "%60%61%62");
24 test(unreserved, unreserved);
25
26 var x = new StringBuffer();
27 for (int i = 32; i < 128; i++) {
28 if (unreserved.indexOf(new String.fromCharCode(i)) != -1) {
29 x.writeCharCode(i);
30 } else {
31 x.write("%");
32 x.write(i.toRadixString(16));
33 }
34 }
35 print(x.toString().toUpperCase());
36 Expect.equals(x.toString().toUpperCase(),
37 new Uri(path: x.toString()).toString().toUpperCase());
38 }
39
40 main() {
41 testNormalizePath();
42 }
OLDNEW
« no previous file with comments | « tests/corelib/uri_ipv6_test.dart ('k') | tests/corelib/uri_path_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698