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

Side by Side Diff: pkg/analyzer/test/src/util/fast_uri_test.dart

Issue 2004793002: Fix for FastUri.hashCode and hasAuthorizy (to fix ==). (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: tweak Created 4 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
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 analyzer.test.src.util.fast_uri_test; 5 library analyzer.test.src.util.fast_uri_test;
6 6
7 import 'package:analyzer/src/util/fast_uri.dart'; 7 import 'package:analyzer/src/util/fast_uri.dart';
8 import 'package:unittest/unittest.dart'; 8 import 'package:unittest/unittest.dart';
9 9
10 import '../../reflective_tests.dart'; 10 import '../../reflective_tests.dart';
(...skipping 17 matching lines...) Expand all
28 } 28 }
29 29
30 void test_parse_absolute_folder_withSlashAtTheEnd() { 30 void test_parse_absolute_folder_withSlashAtTheEnd() {
31 _compareTextWithCoreUri('file:///Users/scheglov/util/'); 31 _compareTextWithCoreUri('file:///Users/scheglov/util/');
32 } 32 }
33 33
34 void test_parse_absolute_package() { 34 void test_parse_absolute_package() {
35 _compareTextWithCoreUri('package:analyzer/src/util/fast_uri.dart'); 35 _compareTextWithCoreUri('package:analyzer/src/util/fast_uri.dart');
36 } 36 }
37 37
38 void test_parse_notFast() { 38 void test_parse_notFast_hasAuthority() {
39 Uri uri = FastUri.parse('http://www.google.com/pages/about.html');
40 expect(uri, isNot(isFastUri));
41 }
42
43 void test_parse_notFast_hasPort() {
39 Uri uri = FastUri.parse('http://www.google.com:8080/pages/about.html'); 44 Uri uri = FastUri.parse('http://www.google.com:8080/pages/about.html');
40 expect(uri, isNot(isFastUri)); 45 expect(uri, isNot(isFastUri));
41 } 46 }
42 47
43 void test_parse_relative_down() { 48 void test_parse_relative_down() {
44 _compareTextWithCoreUri('util/fast_uri.dart'); 49 _compareTextWithCoreUri('util/fast_uri.dart');
45 } 50 }
46 51
47 void test_parse_relative_up() { 52 void test_parse_relative_up() {
48 _compareTextWithCoreUri('../util/fast_uri.dart'); 53 _compareTextWithCoreUri('../util/fast_uri.dart');
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 expect(fastUri, isFastUri); 135 expect(fastUri, isFastUri);
131 } 136 }
132 _compareUris(fastUri, coreUri); 137 _compareUris(fastUri, coreUri);
133 } 138 }
134 139
135 void _compareUris(Uri fastUri, Uri coreUri) { 140 void _compareUris(Uri fastUri, Uri coreUri) {
136 expect(fastUri.authority, coreUri.authority); 141 expect(fastUri.authority, coreUri.authority);
137 expect(fastUri.data, coreUri.data); 142 expect(fastUri.data, coreUri.data);
138 expect(fastUri.fragment, coreUri.fragment); 143 expect(fastUri.fragment, coreUri.fragment);
139 expect(fastUri.hasAbsolutePath, coreUri.hasAbsolutePath); 144 expect(fastUri.hasAbsolutePath, coreUri.hasAbsolutePath);
140 expect(fastUri.hasAuthority, coreUri.hasEmptyPath); 145 expect(fastUri.hasAuthority, coreUri.hasAuthority);
146 expect(fastUri.hasEmptyPath, coreUri.hasEmptyPath);
141 expect(fastUri.hasFragment, coreUri.hasFragment); 147 expect(fastUri.hasFragment, coreUri.hasFragment);
142 expect(fastUri.hasPort, coreUri.hasPort); 148 expect(fastUri.hasPort, coreUri.hasPort);
143 expect(fastUri.hasQuery, coreUri.hasQuery); 149 expect(fastUri.hasQuery, coreUri.hasQuery);
144 expect(fastUri.hasScheme, coreUri.hasScheme); 150 expect(fastUri.hasScheme, coreUri.hasScheme);
145 expect(fastUri.host, coreUri.host); 151 expect(fastUri.host, coreUri.host);
146 expect(fastUri.isAbsolute, coreUri.isAbsolute); 152 expect(fastUri.isAbsolute, coreUri.isAbsolute);
147 if (coreUri.scheme == 'http' || coreUri.scheme == 'https') { 153 if (coreUri.scheme == 'http' || coreUri.scheme == 'https') {
148 expect(fastUri.origin, coreUri.origin); 154 expect(fastUri.origin, coreUri.origin);
149 } 155 }
150 expect(fastUri.path, coreUri.path); 156 expect(fastUri.path, coreUri.path);
151 expect(fastUri.pathSegments, coreUri.pathSegments); 157 expect(fastUri.pathSegments, coreUri.pathSegments);
152 expect(fastUri.port, coreUri.port); 158 expect(fastUri.port, coreUri.port);
153 expect(fastUri.query, coreUri.query); 159 expect(fastUri.query, coreUri.query);
154 expect(fastUri.queryParameters, coreUri.queryParameters); 160 expect(fastUri.queryParameters, coreUri.queryParameters);
155 expect(fastUri.queryParametersAll, coreUri.queryParametersAll); 161 expect(fastUri.queryParametersAll, coreUri.queryParametersAll);
156 expect(fastUri.scheme, coreUri.scheme); 162 expect(fastUri.scheme, coreUri.scheme);
157 expect(fastUri.userInfo, coreUri.userInfo); 163 expect(fastUri.userInfo, coreUri.userInfo);
164 // Object
165 expect(fastUri.hashCode, coreUri.hashCode);
166 expect(fastUri == coreUri, isTrue);
167 expect(coreUri == fastUri, isTrue);
158 } 168 }
159 } 169 }
OLDNEW
« pkg/analyzer/lib/src/util/fast_uri.dart ('K') | « pkg/analyzer/lib/src/util/fast_uri.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698