| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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.src.task.dart_test; | 5 library analyzer.test.src.task.dart_test; |
| 6 | 6 |
| 7 import 'package:analyzer/dart/element/element.dart'; | 7 import 'package:analyzer/dart/element/element.dart'; |
| 8 import 'package:analyzer/dart/element/type.dart'; | 8 import 'package:analyzer/dart/element/type.dart'; |
| 9 import 'package:analyzer/src/context/cache.dart'; | 9 import 'package:analyzer/src/context/cache.dart'; |
| 10 import 'package:analyzer/src/dart/element/element.dart'; | 10 import 'package:analyzer/src/dart/element/element.dart'; |
| 11 import 'package:analyzer/src/generated/ast.dart'; | 11 import 'package:analyzer/src/generated/ast.dart'; |
| 12 import 'package:analyzer/src/generated/constant.dart'; | 12 import 'package:analyzer/src/generated/constant.dart'; |
| 13 import 'package:analyzer/src/generated/engine.dart' | 13 import 'package:analyzer/src/generated/engine.dart' |
| 14 show AnalysisOptionsImpl, CacheState; | 14 show AnalysisOptions, AnalysisOptionsImpl, CacheState; |
| 15 import 'package:analyzer/src/generated/error.dart'; | 15 import 'package:analyzer/src/generated/error.dart'; |
| 16 import 'package:analyzer/src/generated/resolver.dart'; | 16 import 'package:analyzer/src/generated/resolver.dart'; |
| 17 import 'package:analyzer/src/generated/scanner.dart'; | 17 import 'package:analyzer/src/generated/scanner.dart'; |
| 18 import 'package:analyzer/src/generated/sdk.dart'; | 18 import 'package:analyzer/src/generated/sdk.dart'; |
| 19 import 'package:analyzer/src/generated/source.dart'; | 19 import 'package:analyzer/src/generated/source.dart'; |
| 20 import 'package:analyzer/src/services/lint.dart'; | 20 import 'package:analyzer/src/services/lint.dart'; |
| 21 import 'package:analyzer/src/task/dart.dart'; | 21 import 'package:analyzer/src/task/dart.dart'; |
| 22 import 'package:analyzer/src/task/html.dart'; | 22 import 'package:analyzer/src/task/html.dart'; |
| 23 import 'package:analyzer/src/task/strong/info.dart'; | 23 import 'package:analyzer/src/task/strong/info.dart'; |
| 24 import 'package:analyzer/task/dart.dart'; | 24 import 'package:analyzer/task/dart.dart'; |
| 25 import 'package:analyzer/task/general.dart'; | 25 import 'package:analyzer/task/general.dart'; |
| 26 import 'package:analyzer/task/model.dart'; | 26 import 'package:analyzer/task/model.dart'; |
| 27 import 'package:unittest/unittest.dart'; | 27 import 'package:unittest/unittest.dart'; |
| 28 | 28 |
| 29 import '../../generated/resolver_test.dart'; | 29 import '../../generated/resolver_test.dart'; |
| 30 import '../../generated/test_support.dart'; | 30 import '../../generated/test_support.dart'; |
| 31 import '../../reflective_tests.dart'; | 31 import '../../reflective_tests.dart'; |
| 32 import '../../utils.dart'; | 32 import '../../utils.dart'; |
| 33 import '../context/abstract_context.dart'; | 33 import '../context/abstract_context.dart'; |
| 34 import '../mock_sdk.dart'; |
| 34 | 35 |
| 35 main() { | 36 main() { |
| 36 initializeTestEnvironment(); | 37 initializeTestEnvironment(); |
| 37 runReflectiveTests(BuildCompilationUnitElementTaskTest); | 38 runReflectiveTests(BuildCompilationUnitElementTaskTest); |
| 38 runReflectiveTests(BuildDirectiveElementsTaskTest); | 39 runReflectiveTests(BuildDirectiveElementsTaskTest); |
| 39 runReflectiveTests(BuildEnumMemberElementsTaskTest); | 40 runReflectiveTests(BuildEnumMemberElementsTaskTest); |
| 40 runReflectiveTests(BuildExportNamespaceTaskTest); | 41 runReflectiveTests(BuildExportNamespaceTaskTest); |
| 41 runReflectiveTests(BuildLibraryElementTaskTest); | 42 runReflectiveTests(BuildLibraryElementTaskTest); |
| 42 runReflectiveTests(BuildPublicNamespaceTaskTest); | 43 runReflectiveTests(BuildPublicNamespaceTaskTest); |
| 43 runReflectiveTests(BuildSourceExportClosureTaskTest); | 44 runReflectiveTests(BuildSourceExportClosureTaskTest); |
| 44 runReflectiveTests(BuildTypeProviderTaskTest); | 45 runReflectiveTests(BuildTypeProviderTaskTest); |
| 46 runReflectiveTests(BuildTypeProviderTaskTest_noAsync); |
| 45 runReflectiveTests(ComputeConstantDependenciesTaskTest); | 47 runReflectiveTests(ComputeConstantDependenciesTaskTest); |
| 46 runReflectiveTests(ComputeConstantValueTaskTest); | 48 runReflectiveTests(ComputeConstantValueTaskTest); |
| 47 runReflectiveTests(ComputeInferableStaticVariableDependenciesTaskTest); | 49 runReflectiveTests(ComputeInferableStaticVariableDependenciesTaskTest); |
| 48 runReflectiveTests(ComputeLibraryCycleTaskTest); | 50 runReflectiveTests(ComputeLibraryCycleTaskTest); |
| 49 runReflectiveTests(ComputePropagableVariableDependenciesTaskTest); | 51 runReflectiveTests(ComputePropagableVariableDependenciesTaskTest); |
| 50 runReflectiveTests(ContainingLibrariesTaskTest); | 52 runReflectiveTests(ContainingLibrariesTaskTest); |
| 51 runReflectiveTests(DartErrorsTaskTest); | 53 runReflectiveTests(DartErrorsTaskTest); |
| 52 runReflectiveTests(EvaluateUnitConstantsTaskTest); | 54 runReflectiveTests(EvaluateUnitConstantsTaskTest); |
| 53 runReflectiveTests(GatherUsedImportedElementsTaskTest); | 55 runReflectiveTests(GatherUsedImportedElementsTaskTest); |
| 54 runReflectiveTests(GatherUsedLocalElementsTaskTest); | 56 runReflectiveTests(GatherUsedLocalElementsTaskTest); |
| (...skipping 943 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 998 // validate | 1000 // validate |
| 999 TypeProvider typeProvider = outputs[TYPE_PROVIDER]; | 1001 TypeProvider typeProvider = outputs[TYPE_PROVIDER]; |
| 1000 expect(typeProvider, isNotNull); | 1002 expect(typeProvider, isNotNull); |
| 1001 expect(typeProvider.boolType, isNotNull); | 1003 expect(typeProvider.boolType, isNotNull); |
| 1002 expect(typeProvider.intType, isNotNull); | 1004 expect(typeProvider.intType, isNotNull); |
| 1003 expect(typeProvider.futureType, isNotNull); | 1005 expect(typeProvider.futureType, isNotNull); |
| 1004 } | 1006 } |
| 1005 } | 1007 } |
| 1006 | 1008 |
| 1007 @reflectiveTest | 1009 @reflectiveTest |
| 1010 class BuildTypeProviderTaskTest_noAsync extends _AbstractDartTaskTest { |
| 1011 void prepareAnalysisContext([AnalysisOptions options]) { |
| 1012 AnalysisOptionsImpl newOptions = new AnalysisOptionsImpl(); |
| 1013 newOptions.enableAsync = false; |
| 1014 super.prepareAnalysisContext(newOptions); |
| 1015 } |
| 1016 |
| 1017 void setUp() { |
| 1018 sdk = new MockSdk(dartAsync: false); |
| 1019 super.setUp(); |
| 1020 } |
| 1021 |
| 1022 test_perform_noAsync() { |
| 1023 expect(context, isNotNull); |
| 1024 computeResult(AnalysisContextTarget.request, TYPE_PROVIDER, |
| 1025 matcher: isBuildTypeProviderTask); |
| 1026 // validate |
| 1027 TypeProvider typeProvider = outputs[TYPE_PROVIDER]; |
| 1028 expect(typeProvider, isNotNull); |
| 1029 expect(typeProvider.boolType, isNotNull); |
| 1030 expect(typeProvider.intType, isNotNull); |
| 1031 expect(typeProvider.futureType, isNotNull); |
| 1032 } |
| 1033 } |
| 1034 |
| 1035 @reflectiveTest |
| 1008 class ComputeConstantDependenciesTaskTest extends _AbstractDartTaskTest { | 1036 class ComputeConstantDependenciesTaskTest extends _AbstractDartTaskTest { |
| 1009 Annotation findClassAnnotation(CompilationUnit unit, String className) { | 1037 Annotation findClassAnnotation(CompilationUnit unit, String className) { |
| 1010 for (CompilationUnitMember member in unit.declarations) { | 1038 for (CompilationUnitMember member in unit.declarations) { |
| 1011 if (member is ClassDeclaration && member.name.name == className) { | 1039 if (member is ClassDeclaration && member.name.name == className) { |
| 1012 expect(member.metadata, hasLength(1)); | 1040 expect(member.metadata, hasLength(1)); |
| 1013 return member.metadata[0]; | 1041 return member.metadata[0]; |
| 1014 } | 1042 } |
| 1015 } | 1043 } |
| 1016 fail('Annotation not found'); | 1044 fail('Annotation not found'); |
| 1017 return null; | 1045 return null; |
| (...skipping 3828 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4846 /** | 4874 /** |
| 4847 * Fill [errorListener] with [result] errors in the current [task]. | 4875 * Fill [errorListener] with [result] errors in the current [task]. |
| 4848 */ | 4876 */ |
| 4849 void _fillErrorListener(ResultDescriptor<List<AnalysisError>> result) { | 4877 void _fillErrorListener(ResultDescriptor<List<AnalysisError>> result) { |
| 4850 List<AnalysisError> errors = task.outputs[result]; | 4878 List<AnalysisError> errors = task.outputs[result]; |
| 4851 expect(errors, isNotNull, reason: result.name); | 4879 expect(errors, isNotNull, reason: result.name); |
| 4852 errorListener = new GatheringErrorListener(); | 4880 errorListener = new GatheringErrorListener(); |
| 4853 errorListener.addAll(errors); | 4881 errorListener.addAll(errors); |
| 4854 } | 4882 } |
| 4855 } | 4883 } |
| OLD | NEW |