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

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

Issue 1396973004: Fix bug in Uri.removeFragment. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 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 | « sdk/lib/core/uri.dart ('k') | no next file » | 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 library uriTest; 5 library uriTest;
6 6
7 import "package:expect/expect.dart"; 7 import "package:expect/expect.dart";
8 import 'dart:convert'; 8 import 'dart:convert';
9 9
10 testUri(String uri, bool isAbsolute) { 10 testUri(String uriText, bool isAbsolute) {
11 Expect.equals(isAbsolute, Uri.parse(uri).isAbsolute); 11 var uri = Uri.parse(uriText);
12 Expect.stringEquals(uri, Uri.parse(uri).toString()); 12
13 Expect.equals(isAbsolute, uri.isAbsolute);
14 Expect.stringEquals(uriText, uri.toString());
13 15
14 // Test equals and hashCode members. 16 // Test equals and hashCode members.
15 Expect.equals(Uri.parse(uri), Uri.parse(uri)); 17 var uri2 = Uri.parse(uriText);
16 Expect.equals(Uri.parse(uri).hashCode, Uri.parse(uri).hashCode); 18 Expect.equals(uri, uri2);
19 Expect.equals(uri.hashCode, uri2.hashCode);
20
21 // Test that removeFragment doesn't change anything else.
22 if (uri.hasFragment) {
23 Expect.equals(Uri.parse(uriText.substring(0, uriText.indexOf('#'))),
24 uri.removeFragment());
25 } else {
26 Expect.equals(uri,
27 Uri.parse(uriText + "#fragment").removeFragment());
28 }
17 } 29 }
18 30
19 testEncodeDecode(String orig, String encoded) { 31 testEncodeDecode(String orig, String encoded) {
20 var e = Uri.encodeFull(orig); 32 var e = Uri.encodeFull(orig);
21 Expect.stringEquals(encoded, e); 33 Expect.stringEquals(encoded, e);
22 var d = Uri.decodeFull(encoded); 34 var d = Uri.decodeFull(encoded);
23 Expect.stringEquals(orig, d); 35 Expect.stringEquals(orig, d);
24 } 36 }
25 37
26 testEncodeDecodeComponent(String orig, String encoded) { 38 testEncodeDecodeComponent(String orig, String encoded) {
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after
608 String dump(Uri uri) { 620 String dump(Uri uri) {
609 return "URI: $uri\n" 621 return "URI: $uri\n"
610 " Scheme: ${uri.scheme} #${uri.scheme.length}\n" 622 " Scheme: ${uri.scheme} #${uri.scheme.length}\n"
611 " User-info: ${uri.userInfo} #${uri.userInfo.length}\n" 623 " User-info: ${uri.userInfo} #${uri.userInfo.length}\n"
612 " Host: ${uri.host} #${uri.host.length}\n" 624 " Host: ${uri.host} #${uri.host.length}\n"
613 " Port: ${uri.port}\n" 625 " Port: ${uri.port}\n"
614 " Path: ${uri.path} #${uri.path.length}\n" 626 " Path: ${uri.path} #${uri.path.length}\n"
615 " Query: ${uri.query} #${uri.query.length}\n" 627 " Query: ${uri.query} #${uri.query.length}\n"
616 " Fragment: ${uri.fragment} #${uri.fragment.length}\n"; 628 " Fragment: ${uri.fragment} #${uri.fragment.length}\n";
617 } 629 }
OLDNEW
« no previous file with comments | « sdk/lib/core/uri.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698