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

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

Issue 914373004: Use package: URIs for files in lib (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Added test and fixed URI usage Created 5 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 | Annotate | Revision Log
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 // This code was auto-generated, is not intended to be edited, and is subject to 5 // This code was auto-generated, is not intended to be edited, and is subject to
6 // significant change. Please see the README file for more information. 6 // significant change. Please see the README file for more information.
7 7
8 library engine.all_the_rest_test; 8 library engine.all_the_rest_test;
9 9
10 import 'dart:collection'; 10 import 'dart:collection';
(...skipping 20 matching lines...) Expand all
31 import 'package:analyzer/src/generated/testing/html_factory.dart'; 31 import 'package:analyzer/src/generated/testing/html_factory.dart';
32 import 'package:analyzer/src/generated/testing/test_type_provider.dart'; 32 import 'package:analyzer/src/generated/testing/test_type_provider.dart';
33 import 'package:analyzer/src/generated/utilities_collection.dart'; 33 import 'package:analyzer/src/generated/utilities_collection.dart';
34 import 'package:analyzer/src/generated/utilities_dart.dart'; 34 import 'package:analyzer/src/generated/utilities_dart.dart';
35 import 'package:unittest/unittest.dart'; 35 import 'package:unittest/unittest.dart';
36 36
37 import '../reflective_tests.dart'; 37 import '../reflective_tests.dart';
38 import 'parser_test.dart'; 38 import 'parser_test.dart';
39 import 'resolver_test.dart'; 39 import 'resolver_test.dart';
40 import 'test_support.dart'; 40 import 'test_support.dart';
41 import 'package:analyzer/source/package_map_resolver.dart';
42 import 'package:analyzer/file_system/memory_file_system.dart';
43 import 'package:analyzer/file_system/file_system.dart';
44 import 'package:path/src/context.dart';
41 45
42 46
43 main() { 47 main() {
44 groupSep = ' | '; 48 groupSep = ' | ';
45 runReflectiveTests(ConstantEvaluatorTest); 49 runReflectiveTests(ConstantEvaluatorTest);
46 runReflectiveTests(ConstantFinderTest); 50 runReflectiveTests(ConstantFinderTest);
47 runReflectiveTests(ConstantValueComputerTest); 51 runReflectiveTests(ConstantValueComputerTest);
48 runReflectiveTests(ConstantVisitorTest); 52 runReflectiveTests(ConstantVisitorTest);
49 runReflectiveTests(ContentCacheTest); 53 runReflectiveTests(ContentCacheTest);
50 runReflectiveTests(DartObjectImplTest); 54 runReflectiveTests(DartObjectImplTest);
(...skipping 8416 matching lines...) Expand 10 before | Expand all | Expand 10 after
8467 void test_resolveUri_nonAbsolute_relative() { 8471 void test_resolveUri_nonAbsolute_relative() {
8468 SourceFactory factory = 8472 SourceFactory factory =
8469 new SourceFactory([new UriResolver_nonAbsolute_relative()]); 8473 new SourceFactory([new UriResolver_nonAbsolute_relative()]);
8470 Source containingSource = 8474 Source containingSource =
8471 new FileBasedSource.con1(FileUtilities2.createFile("/does/not/have.dart" )); 8475 new FileBasedSource.con1(FileUtilities2.createFile("/does/not/have.dart" ));
8472 Source result = factory.resolveUri(containingSource, "exist.dart"); 8476 Source result = factory.resolveUri(containingSource, "exist.dart");
8473 expect( 8477 expect(
8474 result.fullName, 8478 result.fullName,
8475 FileUtilities2.createFile("/does/not/exist.dart").getAbsolutePath()); 8479 FileUtilities2.createFile("/does/not/exist.dart").getAbsolutePath());
8476 } 8480 }
8481
8482 void test_resolveUri_nonAbsolute_relative_package() {
8483 MemoryResourceProvider provider = new MemoryResourceProvider();
8484 Context context = provider.pathContext;
8485 String packagePath = context.joinAll([context.separator, 'path', 'to', 'pack age']);
8486 String libPath = context.joinAll([packagePath, 'lib']);
8487 String dirPath = context.joinAll([libPath, 'dir']);
8488 String firstPath = context.joinAll([dirPath, 'first.dart']);
8489 String secondPath = context.joinAll([dirPath, 'second.dart']);
8490
8491 provider.newFolder(packagePath);
8492 Folder libFolder = provider.newFolder(libPath);
8493 provider.newFolder(dirPath);
8494 File firstFile = provider.newFile(firstPath, '');
8495 provider.newFile(secondPath, '');
8496
8497 PackageMapUriResolver resolver = new PackageMapUriResolver(provider, {'packa ge' : [libFolder]});
8498 SourceFactory factory = new SourceFactory([resolver]);
8499 Source librarySource = firstFile.createSource(Uri.parse('package:package/dir /first.dart'));
8500
8501 Source result = factory.resolveUri(librarySource, 'second.dart');
8502 expect(result, isNotNull);
8503 expect(result.fullName, secondPath);
8504 expect(result.uri.toString(), 'package:package/dir/second.dart');
8505 }
8506
8477 void test_restoreUri() { 8507 void test_restoreUri() {
8478 JavaFile file1 = FileUtilities2.createFile("/some/file1.dart"); 8508 JavaFile file1 = FileUtilities2.createFile("/some/file1.dart");
8479 JavaFile file2 = FileUtilities2.createFile("/some/file2.dart"); 8509 JavaFile file2 = FileUtilities2.createFile("/some/file2.dart");
8480 Source source1 = new FileBasedSource.con1(file1); 8510 Source source1 = new FileBasedSource.con1(file1);
8481 Source source2 = new FileBasedSource.con1(file2); 8511 Source source2 = new FileBasedSource.con1(file2);
8482 Uri expected1 = parseUriWithException("file:///my_file.dart"); 8512 Uri expected1 = parseUriWithException("file:///my_file.dart");
8483 SourceFactory factory = 8513 SourceFactory factory =
8484 new SourceFactory([new UriResolver_restoreUri(source1, expected1)]); 8514 new SourceFactory([new UriResolver_restoreUri(source1, expected1)]);
8485 expect(factory.restoreUri(source1), same(expected1)); 8515 expect(factory.restoreUri(source1), same(expected1));
8486 expect(factory.restoreUri(source2), same(null)); 8516 expect(factory.restoreUri(source2), same(null));
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after
8973 } else { 9003 } else {
8974 expect(scriptSource, isNotNull, reason: "script $scriptIndex"); 9004 expect(scriptSource, isNotNull, reason: "script $scriptIndex");
8975 String actualExternalScriptName = scriptSource.shortName; 9005 String actualExternalScriptName = scriptSource.shortName;
8976 expect( 9006 expect(
8977 actualExternalScriptName, 9007 actualExternalScriptName,
8978 _expectedExternalScriptName, 9008 _expectedExternalScriptName,
8979 reason: "script $scriptIndex"); 9009 reason: "script $scriptIndex");
8980 } 9010 }
8981 } 9011 }
8982 } 9012 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/generated/engine.dart ('k') | pkg/analyzer/test/source/package_map_resolver_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698