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

Side by Side Diff: pkg/analyzer/test/generated/all_the_rest_test.dart

Issue 1710393002: First try to find the exact library for the given file URI. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 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 | « pkg/analyzer/lib/src/generated/sdk_io.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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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.generated.all_the_rest_test; 5 library analyzer.test.generated.all_the_rest_test;
6 6
7 import 'package:analyzer/dart/ast/ast.dart'; 7 import 'package:analyzer/dart/ast/ast.dart';
8 import 'package:analyzer/dart/ast/token.dart'; 8 import 'package:analyzer/dart/ast/token.dart';
9 import 'package:analyzer/dart/element/element.dart'; 9 import 'package:analyzer/dart/element/element.dart';
10 import 'package:analyzer/dart/element/type.dart'; 10 import 'package:analyzer/dart/element/type.dart';
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 void test_fromFile_library() { 169 void test_fromFile_library() {
170 DirectoryBasedDartSdk sdk = _createDartSdk(); 170 DirectoryBasedDartSdk sdk = _createDartSdk();
171 Source source = sdk.fromFileUri(new JavaFile.relative( 171 Source source = sdk.fromFileUri(new JavaFile.relative(
172 new JavaFile.relative(sdk.libraryDirectory, "core"), "core.dart") 172 new JavaFile.relative(sdk.libraryDirectory, "core"), "core.dart")
173 .toURI()); 173 .toURI());
174 expect(source, isNotNull); 174 expect(source, isNotNull);
175 expect(source.isInSystemLibrary, isTrue); 175 expect(source.isInSystemLibrary, isTrue);
176 expect(source.uri.toString(), "dart:core"); 176 expect(source.uri.toString(), "dart:core");
177 } 177 }
178 178
179 void test_fromFile_library_firstExact() {
180 DirectoryBasedDartSdk sdk = _createDartSdk();
181 JavaFile dirHtml = new JavaFile.relative(sdk.libraryDirectory, "html");
182 JavaFile dirDartium = new JavaFile.relative(dirHtml, "dartium");
183 JavaFile file = new JavaFile.relative(dirDartium, "html_dartium.dart");
184 expect(file.isFile(), isTrue);
185 Source source = sdk.fromFileUri(file.toURI());
186 expect(source, isNotNull);
187 expect(source.isInSystemLibrary, isTrue);
188 expect(source.uri.toString(), "dart:html");
189 }
190
179 void test_fromFile_part() { 191 void test_fromFile_part() {
180 DirectoryBasedDartSdk sdk = _createDartSdk(); 192 DirectoryBasedDartSdk sdk = _createDartSdk();
181 Source source = sdk.fromFileUri(new JavaFile.relative( 193 Source source = sdk.fromFileUri(new JavaFile.relative(
182 new JavaFile.relative(sdk.libraryDirectory, "core"), "num.dart") 194 new JavaFile.relative(sdk.libraryDirectory, "core"), "num.dart")
183 .toURI()); 195 .toURI());
184 expect(source, isNotNull); 196 expect(source, isNotNull);
185 expect(source.isInSystemLibrary, isTrue); 197 expect(source.isInSystemLibrary, isTrue);
186 expect(source.uri.toString(), "dart:core/num.dart"); 198 expect(source.uri.toString(), "dart:core/num.dart");
187 } 199 }
188 200
(...skipping 3915 matching lines...) Expand 10 before | Expand all | Expand 10 after
4104 expect(UriKind.fromEncoding(0x70), same(UriKind.PACKAGE_URI)); 4116 expect(UriKind.fromEncoding(0x70), same(UriKind.PACKAGE_URI));
4105 expect(UriKind.fromEncoding(0x58), same(null)); 4117 expect(UriKind.fromEncoding(0x58), same(null));
4106 } 4118 }
4107 4119
4108 void test_getEncoding() { 4120 void test_getEncoding() {
4109 expect(UriKind.DART_URI.encoding, 0x64); 4121 expect(UriKind.DART_URI.encoding, 0x64);
4110 expect(UriKind.FILE_URI.encoding, 0x66); 4122 expect(UriKind.FILE_URI.encoding, 0x66);
4111 expect(UriKind.PACKAGE_URI.encoding, 0x70); 4123 expect(UriKind.PACKAGE_URI.encoding, 0x70);
4112 } 4124 }
4113 } 4125 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/generated/sdk_io.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698