OLD | NEW |
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 15 matching lines...) Expand all Loading... |
26 import 'package:analyzer/src/generated/sdk.dart'; | 26 import 'package:analyzer/src/generated/sdk.dart'; |
27 import 'package:analyzer/src/generated/sdk_io.dart'; | 27 import 'package:analyzer/src/generated/sdk_io.dart'; |
28 import 'package:analyzer/src/generated/source.dart'; | 28 import 'package:analyzer/src/generated/source.dart'; |
29 import 'package:analyzer/src/generated/source_io.dart'; | 29 import 'package:analyzer/src/generated/source_io.dart'; |
30 import 'package:analyzer/src/generated/testing/ast_factory.dart'; | 30 import 'package:analyzer/src/generated/testing/ast_factory.dart'; |
31 import 'package:analyzer/src/generated/testing/element_factory.dart'; | 31 import 'package:analyzer/src/generated/testing/element_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/testing/token_factory.dart'; | 33 import 'package:analyzer/src/generated/testing/token_factory.dart'; |
34 import 'package:analyzer/src/generated/utilities_dart.dart'; | 34 import 'package:analyzer/src/generated/utilities_dart.dart'; |
35 import 'package:analyzer/src/source/source_resource.dart'; | 35 import 'package:analyzer/src/source/source_resource.dart'; |
36 import 'package:path/path.dart'; | 36 import 'package:path/path.dart' as path; |
37 import 'package:source_span/source_span.dart'; | 37 import 'package:source_span/source_span.dart'; |
38 import 'package:test/test.dart'; | 38 import 'package:test/test.dart'; |
39 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 39 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
40 | 40 |
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 defineReflectiveSuite(() { | 46 defineReflectiveSuite(() { |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 | 121 |
122 void test_resolve_unknown_uri() { | 122 void test_resolve_unknown_uri() { |
123 UriResolver resolver = new CustomUriResolver({ | 123 UriResolver resolver = new CustomUriResolver({ |
124 'custom:library': '/path/to/library.dart', | 124 'custom:library': '/path/to/library.dart', |
125 }); | 125 }); |
126 Source result = resolver.resolveAbsolute(Uri.parse("custom:non_library")); | 126 Source result = resolver.resolveAbsolute(Uri.parse("custom:non_library")); |
127 expect(result, isNull); | 127 expect(result, isNull); |
128 } | 128 } |
129 | 129 |
130 void test_resolve_uri() { | 130 void test_resolve_uri() { |
131 String path = | 131 String filePath = |
132 FileUtilities2.createFile("/path/to/library.dart").getAbsolutePath(); | 132 FileUtilities2.createFile("/path/to/library.dart").getAbsolutePath(); |
133 UriResolver resolver = new CustomUriResolver({ | 133 UriResolver resolver = new CustomUriResolver({ |
134 'custom:library': path, | 134 'custom:library': filePath, |
135 }); | 135 }); |
136 Source result = resolver.resolveAbsolute(Uri.parse("custom:library")); | 136 Source result = resolver.resolveAbsolute(Uri.parse("custom:library")); |
137 expect(result, isNotNull); | 137 expect(result, isNotNull); |
138 expect(result.fullName, path); | 138 expect(result.fullName, filePath); |
139 } | 139 } |
140 } | 140 } |
141 | 141 |
142 @reflectiveTest | 142 @reflectiveTest |
143 class DartUriResolverTest { | 143 class DartUriResolverTest { |
144 void test_creation() { | 144 void test_creation() { |
145 DartSdk sdk = _createSdk(); | 145 DartSdk sdk = _createSdk(); |
146 expect(new DartUriResolver(sdk), isNotNull); | 146 expect(new DartUriResolver(sdk), isNotNull); |
147 } | 147 } |
148 | 148 |
(...skipping 3027 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3176 expect(error.offset, element.nameOffset); | 3176 expect(error.offset, element.nameOffset); |
3177 } | 3177 } |
3178 | 3178 |
3179 void test_reportErrorForElement_unnamed() { | 3179 void test_reportErrorForElement_unnamed() { |
3180 ImportElementImpl element = | 3180 ImportElementImpl element = |
3181 ElementFactory.importFor(ElementFactory.library(null, ''), null); | 3181 ElementFactory.importFor(ElementFactory.library(null, ''), null); |
3182 GatheringErrorListener listener = new GatheringErrorListener(); | 3182 GatheringErrorListener listener = new GatheringErrorListener(); |
3183 ErrorReporter reporter = new ErrorReporter( | 3183 ErrorReporter reporter = new ErrorReporter( |
3184 listener, | 3184 listener, |
3185 new NonExistingSource( | 3185 new NonExistingSource( |
3186 '/test.dart', toUri('/test.dart'), UriKind.FILE_URI)); | 3186 '/test.dart', path.toUri('/test.dart'), UriKind.FILE_URI)); |
3187 reporter.reportErrorForElement( | 3187 reporter.reportErrorForElement( |
3188 StaticWarningCode.CONFLICTING_INSTANCE_GETTER_AND_SUPERCLASS_MEMBER, | 3188 StaticWarningCode.CONFLICTING_INSTANCE_GETTER_AND_SUPERCLASS_MEMBER, |
3189 element, | 3189 element, |
3190 ['A']); | 3190 ['A']); |
3191 AnalysisError error = listener.errors[0]; | 3191 AnalysisError error = listener.errors[0]; |
3192 expect(error.offset, element.nameOffset); | 3192 expect(error.offset, element.nameOffset); |
3193 } | 3193 } |
3194 | 3194 |
3195 void test_reportErrorForSpan() { | 3195 void test_reportErrorForSpan() { |
3196 GatheringErrorListener listener = new GatheringErrorListener(); | 3196 GatheringErrorListener listener = new GatheringErrorListener(); |
(...skipping 1328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4525 expect(UriKind.fromEncoding(0x70), same(UriKind.PACKAGE_URI)); | 4525 expect(UriKind.fromEncoding(0x70), same(UriKind.PACKAGE_URI)); |
4526 expect(UriKind.fromEncoding(0x58), same(null)); | 4526 expect(UriKind.fromEncoding(0x58), same(null)); |
4527 } | 4527 } |
4528 | 4528 |
4529 void test_getEncoding() { | 4529 void test_getEncoding() { |
4530 expect(UriKind.DART_URI.encoding, 0x64); | 4530 expect(UriKind.DART_URI.encoding, 0x64); |
4531 expect(UriKind.FILE_URI.encoding, 0x66); | 4531 expect(UriKind.FILE_URI.encoding, 0x66); |
4532 expect(UriKind.PACKAGE_URI.encoding, 0x70); | 4532 expect(UriKind.PACKAGE_URI.encoding, 0x70); |
4533 } | 4533 } |
4534 } | 4534 } |
OLD | NEW |