| 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 test.src.task.dart_test; | 5 library test.src.task.dart_test; |
| 6 | 6 |
| 7 import 'package:analyzer/src/context/cache.dart'; | 7 import 'package:analyzer/src/context/cache.dart'; |
| 8 import 'package:analyzer/src/generated/ast.dart'; | 8 import 'package:analyzer/src/generated/ast.dart'; |
| 9 import 'package:analyzer/src/generated/constant.dart'; | 9 import 'package:analyzer/src/generated/constant.dart'; |
| 10 import 'package:analyzer/src/generated/element.dart'; | 10 import 'package:analyzer/src/generated/element.dart'; |
| (...skipping 2119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2130 expect(outputs[EXPLICITLY_IMPORTED_LIBRARIES], hasLength(0)); | 2130 expect(outputs[EXPLICITLY_IMPORTED_LIBRARIES], hasLength(0)); |
| 2131 expect(outputs[EXPORTED_LIBRARIES], hasLength(0)); | 2131 expect(outputs[EXPORTED_LIBRARIES], hasLength(0)); |
| 2132 _assertHasCore(outputs[IMPORTED_LIBRARIES], 1); | 2132 _assertHasCore(outputs[IMPORTED_LIBRARIES], 1); |
| 2133 expect(outputs[INCLUDED_PARTS], hasLength(0)); | 2133 expect(outputs[INCLUDED_PARTS], hasLength(0)); |
| 2134 expect(outputs[PARSE_ERRORS], hasLength(0)); | 2134 expect(outputs[PARSE_ERRORS], hasLength(0)); |
| 2135 expect(outputs[PARSED_UNIT], isNotNull); | 2135 expect(outputs[PARSED_UNIT], isNotNull); |
| 2136 expect(outputs[SOURCE_KIND], SourceKind.PART); | 2136 expect(outputs[SOURCE_KIND], SourceKind.PART); |
| 2137 expect(outputs[UNITS], hasLength(1)); | 2137 expect(outputs[UNITS], hasLength(1)); |
| 2138 } | 2138 } |
| 2139 | 2139 |
| 2140 test_perform_computeSourceKind_noDirectives_noContainingLibraries() { |
| 2141 _performParseTask(''); |
| 2142 expect(outputs[SOURCE_KIND], SourceKind.LIBRARY); |
| 2143 } |
| 2144 |
| 2145 test_perform_computeSourceKind_noDirectives_hasContainingLibraries() { |
| 2146 // Parse "lib.dart" to let the context know that "test.dart" is a part. |
| 2147 _computeResult(newSource('/lib.dart', r''' |
| 2148 library lib; |
| 2149 part 'test.dart'; |
| 2150 '''), PARSED_UNIT); |
| 2151 // So, know "test.dat" is parsed as a part. |
| 2152 _performParseTask(''); |
| 2153 expect(outputs[SOURCE_KIND], SourceKind.PART); |
| 2154 } |
| 2155 |
| 2140 test_perform_doesNotExist() { | 2156 test_perform_doesNotExist() { |
| 2141 _performParseTask(null); | 2157 _performParseTask(null); |
| 2142 expect(outputs, hasLength(8)); | 2158 expect(outputs, hasLength(8)); |
| 2143 expect(outputs[EXPLICITLY_IMPORTED_LIBRARIES], hasLength(0)); | 2159 expect(outputs[EXPLICITLY_IMPORTED_LIBRARIES], hasLength(0)); |
| 2144 expect(outputs[EXPORTED_LIBRARIES], hasLength(0)); | 2160 expect(outputs[EXPORTED_LIBRARIES], hasLength(0)); |
| 2145 _assertHasCore(outputs[IMPORTED_LIBRARIES], 1); | 2161 _assertHasCore(outputs[IMPORTED_LIBRARIES], 1); |
| 2146 expect(outputs[INCLUDED_PARTS], hasLength(0)); | 2162 expect(outputs[INCLUDED_PARTS], hasLength(0)); |
| 2147 expect(outputs[PARSE_ERRORS], hasLength(0)); | 2163 expect(outputs[PARSE_ERRORS], hasLength(0)); |
| 2148 expect(outputs[PARSED_UNIT], isNotNull); | 2164 expect(outputs[PARSED_UNIT], isNotNull); |
| 2149 expect(outputs[SOURCE_KIND], SourceKind.UNKNOWN); | 2165 expect(outputs[SOURCE_KIND], SourceKind.UNKNOWN); |
| (...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2548 /** | 2564 /** |
| 2549 * Fill [errorListener] with [result] errors in the current [task]. | 2565 * Fill [errorListener] with [result] errors in the current [task]. |
| 2550 */ | 2566 */ |
| 2551 void _fillErrorListener(ResultDescriptor<List<AnalysisError>> result) { | 2567 void _fillErrorListener(ResultDescriptor<List<AnalysisError>> result) { |
| 2552 List<AnalysisError> errors = task.outputs[result]; | 2568 List<AnalysisError> errors = task.outputs[result]; |
| 2553 expect(errors, isNotNull, reason: result.name); | 2569 expect(errors, isNotNull, reason: result.name); |
| 2554 errorListener = new GatheringErrorListener(); | 2570 errorListener = new GatheringErrorListener(); |
| 2555 errorListener.addAll(errors); | 2571 errorListener.addAll(errors); |
| 2556 } | 2572 } |
| 2557 } | 2573 } |
| OLD | NEW |