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

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

Issue 2060263006: Deprecate FileUriResolver and RelativeFileUriResolver in source_io.dart, replace the usages with Re… (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 6 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) 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';
11 import 'package:analyzer/file_system/file_system.dart';
11 import 'package:analyzer/file_system/physical_file_system.dart'; 12 import 'package:analyzer/file_system/physical_file_system.dart';
12 import 'package:analyzer/src/dart/ast/ast.dart'; 13 import 'package:analyzer/src/dart/ast/ast.dart';
13 import 'package:analyzer/src/dart/ast/utilities.dart' hide ConstantEvaluator; 14 import 'package:analyzer/src/dart/ast/utilities.dart' hide ConstantEvaluator;
14 import 'package:analyzer/src/dart/element/builder.dart'; 15 import 'package:analyzer/src/dart/element/builder.dart';
15 import 'package:analyzer/src/dart/element/element.dart'; 16 import 'package:analyzer/src/dart/element/element.dart';
16 import 'package:analyzer/src/generated/engine.dart'; 17 import 'package:analyzer/src/generated/engine.dart';
17 import 'package:analyzer/src/generated/error.dart'; 18 import 'package:analyzer/src/generated/error.dart';
18 import 'package:analyzer/src/generated/java_core.dart'; 19 import 'package:analyzer/src/generated/java_core.dart';
19 import 'package:analyzer/src/generated/java_engine_io.dart'; 20 import 'package:analyzer/src/generated/java_engine_io.dart';
20 import 'package:analyzer/src/generated/java_io.dart'; 21 import 'package:analyzer/src/generated/java_io.dart';
(...skipping 4158 matching lines...) Expand 10 before | Expand all | Expand 10 after
4179 4180
4180 // '\r' -> '\n' as first, last and only character 4181 // '\r' -> '\n' as first, last and only character
4181 expect(FileBasedSource.fileReadMode('\r'), '\n'); 4182 expect(FileBasedSource.fileReadMode('\r'), '\n');
4182 expect(FileBasedSource.fileReadMode('a\r'), 'a\n'); 4183 expect(FileBasedSource.fileReadMode('a\r'), 'a\n');
4183 expect(FileBasedSource.fileReadMode('\ra'), '\na'); 4184 expect(FileBasedSource.fileReadMode('\ra'), '\na');
4184 4185
4185 FileBasedSource.fileReadMode = (String s) => s; 4186 FileBasedSource.fileReadMode = (String s) => s;
4186 } 4187 }
4187 4188
4188 void test_getEncoding() { 4189 void test_getEncoding() {
4189 SourceFactory factory = new SourceFactory([new FileUriResolver()]); 4190 SourceFactory factory = new SourceFactory(
4191 [new ResourceUriResolver(PhysicalResourceProvider.INSTANCE)]);
4190 String fullPath = "/does/not/exist.dart"; 4192 String fullPath = "/does/not/exist.dart";
4191 JavaFile file = FileUtilities2.createFile(fullPath); 4193 JavaFile file = FileUtilities2.createFile(fullPath);
4192 FileBasedSource source = new FileBasedSource(file); 4194 FileBasedSource source = new FileBasedSource(file);
4193 expect(factory.fromEncoding(source.encoding), source); 4195 expect(factory.fromEncoding(source.encoding), source);
4194 } 4196 }
4195 4197
4196 void test_getFullName() { 4198 void test_getFullName() {
4197 String fullPath = "/does/not/exist.dart"; 4199 String fullPath = "/does/not/exist.dart";
4198 JavaFile file = FileUtilities2.createFile(fullPath); 4200 JavaFile file = FileUtilities2.createFile(fullPath);
4199 FileBasedSource source = new FileBasedSource(file); 4201 FileBasedSource source = new FileBasedSource(file);
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
4300 new FileBasedSource(file, parseUriWithException("dart:core")); 4302 new FileBasedSource(file, parseUriWithException("dart:core"));
4301 expect(source, isNotNull); 4303 expect(source, isNotNull);
4302 expect(source.fullName, file.getAbsolutePath()); 4304 expect(source.fullName, file.getAbsolutePath());
4303 expect(source.isInSystemLibrary, isTrue); 4305 expect(source.isInSystemLibrary, isTrue);
4304 } 4306 }
4305 } 4307 }
4306 4308
4307 @reflectiveTest 4309 @reflectiveTest
4308 class FileUriResolverTest { 4310 class FileUriResolverTest {
4309 void test_creation() { 4311 void test_creation() {
4310 expect(new FileUriResolver(), isNotNull); 4312 expect(
4313 new ResourceUriResolver(PhysicalResourceProvider.INSTANCE), isNotNull);
Brian Wilkerson 2016/06/16 17:39:30 This is no longer testing FileUriResolver. I think
jwren 2016/06/16 18:09:56 Done.
4311 } 4314 }
4312 4315
4313 void test_resolve_file() { 4316 void test_resolve_file() {
4314 UriResolver resolver = new FileUriResolver(); 4317 UriResolver resolver =
4318 new ResourceUriResolver(PhysicalResourceProvider.INSTANCE);
4315 Source result = resolver 4319 Source result = resolver
4316 .resolveAbsolute(parseUriWithException("file:/does/not/exist.dart")); 4320 .resolveAbsolute(parseUriWithException("file:/does/not/exist.dart"));
4317 expect(result, isNotNull); 4321 expect(result, isNotNull);
4318 expect(result.fullName, 4322 expect(result.fullName,
4319 FileUtilities2.createFile("/does/not/exist.dart").getAbsolutePath()); 4323 FileUtilities2.createFile("/does/not/exist.dart").getAbsolutePath());
4320 } 4324 }
4321 4325
4322 void test_resolve_nonFile() { 4326 void test_resolve_nonFile() {
4323 UriResolver resolver = new FileUriResolver(); 4327 UriResolver resolver =
4328 new ResourceUriResolver(PhysicalResourceProvider.INSTANCE);
4324 Source result = 4329 Source result =
4325 resolver.resolveAbsolute(parseUriWithException("dart:core")); 4330 resolver.resolveAbsolute(parseUriWithException("dart:core"));
4326 expect(result, isNull); 4331 expect(result, isNull);
4327 } 4332 }
4328 4333
4329 void test_restore() { 4334 void test_restore() {
4330 UriResolver resolver = new FileUriResolver(); 4335 UriResolver resolver =
4336 new ResourceUriResolver(PhysicalResourceProvider.INSTANCE);
4331 Uri uri = parseUriWithException('file:///foo/bar.dart'); 4337 Uri uri = parseUriWithException('file:///foo/bar.dart');
4332 Source source = resolver.resolveAbsolute(uri); 4338 Source source = resolver.resolveAbsolute(uri);
4333 expect(source, isNotNull); 4339 expect(source, isNotNull);
4334 expect(resolver.restoreAbsolute(source), uri); 4340 expect(resolver.restoreAbsolute(source), uri);
4335 expect( 4341 expect(
4336 resolver.restoreAbsolute( 4342 resolver.restoreAbsolute(
4337 new NonExistingSource(source.fullName, null, null)), 4343 new NonExistingSource(source.fullName, null, null)),
4338 uri); 4344 uri);
4339 } 4345 }
4340 } 4346 }
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
4490 expect(UriKind.fromEncoding(0x70), same(UriKind.PACKAGE_URI)); 4496 expect(UriKind.fromEncoding(0x70), same(UriKind.PACKAGE_URI));
4491 expect(UriKind.fromEncoding(0x58), same(null)); 4497 expect(UriKind.fromEncoding(0x58), same(null));
4492 } 4498 }
4493 4499
4494 void test_getEncoding() { 4500 void test_getEncoding() {
4495 expect(UriKind.DART_URI.encoding, 0x64); 4501 expect(UriKind.DART_URI.encoding, 0x64);
4496 expect(UriKind.FILE_URI.encoding, 0x66); 4502 expect(UriKind.FILE_URI.encoding, 0x66);
4497 expect(UriKind.PACKAGE_URI.encoding, 0x70); 4503 expect(UriKind.PACKAGE_URI.encoding, 0x70);
4498 } 4504 }
4499 } 4505 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698