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

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

Issue 2298913003: Pull in test_reflective_loader 0.0.4 and switch analyzer to it. (Closed)
Patch Set: Fixes for review comments. Created 4 years, 3 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';
(...skipping 16 matching lines...) Expand all
27 import 'package:analyzer/src/generated/source.dart'; 27 import 'package:analyzer/src/generated/source.dart';
28 import 'package:analyzer/src/generated/source_io.dart'; 28 import 'package:analyzer/src/generated/source_io.dart';
29 import 'package:analyzer/src/generated/testing/ast_factory.dart'; 29 import 'package:analyzer/src/generated/testing/ast_factory.dart';
30 import 'package:analyzer/src/generated/testing/element_factory.dart'; 30 import 'package:analyzer/src/generated/testing/element_factory.dart';
31 import 'package:analyzer/src/generated/testing/test_type_provider.dart'; 31 import 'package:analyzer/src/generated/testing/test_type_provider.dart';
32 import 'package:analyzer/src/generated/testing/token_factory.dart'; 32 import 'package:analyzer/src/generated/testing/token_factory.dart';
33 import 'package:analyzer/src/generated/utilities_dart.dart'; 33 import 'package:analyzer/src/generated/utilities_dart.dart';
34 import 'package:analyzer/src/source/source_resource.dart'; 34 import 'package:analyzer/src/source/source_resource.dart';
35 import 'package:path/path.dart'; 35 import 'package:path/path.dart';
36 import 'package:source_span/source_span.dart'; 36 import 'package:source_span/source_span.dart';
37 import 'package:test_reflective_loader/test_reflective_loader.dart';
37 import 'package:unittest/unittest.dart'; 38 import 'package:unittest/unittest.dart';
38 39
39 import '../reflective_tests.dart';
40 import '../utils.dart'; 40 import '../utils.dart';
41 import 'parser_test.dart'; 41 import 'parser_test.dart';
42 import 'resolver_test_case.dart'; 42 import 'resolver_test_case.dart';
43 import 'test_support.dart'; 43 import 'test_support.dart';
44 44
45 main() { 45 main() {
46 initializeTestEnvironment(); 46 initializeTestEnvironment();
47 runReflectiveTests(ContentCacheTest); 47 defineReflectiveTests(ContentCacheTest);
48 runReflectiveTests(CustomUriResolverTest); 48 defineReflectiveTests(CustomUriResolverTest);
49 runReflectiveTests(DartUriResolverTest); 49 defineReflectiveTests(DartUriResolverTest);
50 // ignore: deprecated_member_use 50 // ignore: deprecated_member_use
51 runReflectiveTests(DirectoryBasedDartSdkTest); 51 defineReflectiveTests(DirectoryBasedDartSdkTest);
52 runReflectiveTests(DirectoryBasedSourceContainerTest); 52 defineReflectiveTests(DirectoryBasedSourceContainerTest);
53 runReflectiveTests(ElementBuilderTest); 53 defineReflectiveTests(ElementBuilderTest);
54 runReflectiveTests(ElementLocatorTest); 54 defineReflectiveTests(ElementLocatorTest);
55 runReflectiveTests(EnumMemberBuilderTest); 55 defineReflectiveTests(EnumMemberBuilderTest);
56 runReflectiveTests(ErrorReporterTest); 56 defineReflectiveTests(ErrorReporterTest);
57 runReflectiveTests(ErrorSeverityTest); 57 defineReflectiveTests(ErrorSeverityTest);
58 runReflectiveTests(ExitDetectorTest); 58 defineReflectiveTests(ExitDetectorTest);
59 runReflectiveTests(ExitDetectorTest2); 59 defineReflectiveTests(ExitDetectorTest2);
60 runReflectiveTests(FileBasedSourceTest); 60 defineReflectiveTests(FileBasedSourceTest);
61 runReflectiveTests(ResolveRelativeUriTest); 61 defineReflectiveTests(ResolveRelativeUriTest);
62 // ignore: deprecated_member_use 62 // ignore: deprecated_member_use
63 runReflectiveTests(SDKLibrariesReaderTest); 63 defineReflectiveTests(SDKLibrariesReaderTest);
64 runReflectiveTests(UriKindTest); 64 defineReflectiveTests(UriKindTest);
65 } 65 }
66 66
67 /** 67 /**
68 * Create a tiny mock SDK for use in URI resolution tests. 68 * Create a tiny mock SDK for use in URI resolution tests.
69 */ 69 */
70 DartSdk _createSdk() { 70 DartSdk _createSdk() {
71 MemoryResourceProvider resourceProvider = new MemoryResourceProvider(); 71 MemoryResourceProvider resourceProvider = new MemoryResourceProvider();
72 String sdkFolderName = 72 String sdkFolderName =
73 resourceProvider.pathContext.separator == '/' ? '/sdk' : r'C:\sdk'; 73 resourceProvider.pathContext.separator == '/' ? '/sdk' : r'C:\sdk';
74 Folder sdkFolder = resourceProvider.newFolder(sdkFolderName); 74 Folder sdkFolder = resourceProvider.newFolder(sdkFolderName);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 } 109 }
110 } 110 }
111 111
112 @reflectiveTest 112 @reflectiveTest
113 class CustomUriResolverTest { 113 class CustomUriResolverTest {
114 void test_creation() { 114 void test_creation() {
115 expect(new CustomUriResolver({}), isNotNull); 115 expect(new CustomUriResolver({}), isNotNull);
116 } 116 }
117 117
118 void test_resolve_unknown_uri() { 118 void test_resolve_unknown_uri() {
119 UriResolver resolver = 119 UriResolver resolver = new CustomUriResolver({
120 new CustomUriResolver({'custom:library': '/path/to/library.dart',}); 120 'custom:library': '/path/to/library.dart',
121 });
121 Source result = 122 Source result =
122 resolver.resolveAbsolute(parseUriWithException("custom:non_library")); 123 resolver.resolveAbsolute(parseUriWithException("custom:non_library"));
123 expect(result, isNull); 124 expect(result, isNull);
124 } 125 }
125 126
126 void test_resolve_uri() { 127 void test_resolve_uri() {
127 String path = 128 String path =
128 FileUtilities2.createFile("/path/to/library.dart").getAbsolutePath(); 129 FileUtilities2.createFile("/path/to/library.dart").getAbsolutePath();
129 UriResolver resolver = new CustomUriResolver({'custom:library': path,}); 130 UriResolver resolver = new CustomUriResolver({
131 'custom:library': path,
132 });
130 Source result = 133 Source result =
131 resolver.resolveAbsolute(parseUriWithException("custom:library")); 134 resolver.resolveAbsolute(parseUriWithException("custom:library"));
132 expect(result, isNotNull); 135 expect(result, isNotNull);
133 expect(result.fullName, path); 136 expect(result.fullName, path);
134 } 137 }
135 } 138 }
136 139
137 @reflectiveTest 140 @reflectiveTest
138 class DartUriResolverTest { 141 class DartUriResolverTest {
139 void test_creation() { 142 void test_creation() {
(...skipping 4417 matching lines...) Expand 10 before | Expand all | Expand 10 after
4557 expect(UriKind.fromEncoding(0x70), same(UriKind.PACKAGE_URI)); 4560 expect(UriKind.fromEncoding(0x70), same(UriKind.PACKAGE_URI));
4558 expect(UriKind.fromEncoding(0x58), same(null)); 4561 expect(UriKind.fromEncoding(0x58), same(null));
4559 } 4562 }
4560 4563
4561 void test_getEncoding() { 4564 void test_getEncoding() {
4562 expect(UriKind.DART_URI.encoding, 0x64); 4565 expect(UriKind.DART_URI.encoding, 0x64);
4563 expect(UriKind.FILE_URI.encoding, 0x66); 4566 expect(UriKind.FILE_URI.encoding, 0x66);
4564 expect(UriKind.PACKAGE_URI.encoding, 0x70); 4567 expect(UriKind.PACKAGE_URI.encoding, 0x70);
4565 } 4568 }
4566 } 4569 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698