| 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 2146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2157 | 2157 |
| 2158 @reflectiveTest | 2158 @reflectiveTest |
| 2159 class ParseDartTaskTest extends _AbstractDartTaskTest { | 2159 class ParseDartTaskTest extends _AbstractDartTaskTest { |
| 2160 Source source; | 2160 Source source; |
| 2161 | 2161 |
| 2162 test_buildInputs() { | 2162 test_buildInputs() { |
| 2163 Map<String, TaskInput> inputs = ParseDartTask.buildInputs(emptySource); | 2163 Map<String, TaskInput> inputs = ParseDartTask.buildInputs(emptySource); |
| 2164 expect(inputs, isNotNull); | 2164 expect(inputs, isNotNull); |
| 2165 expect(inputs.keys, unorderedEquals([ | 2165 expect(inputs.keys, unorderedEquals([ |
| 2166 ParseDartTask.LINE_INFO_INPUT_NAME, | 2166 ParseDartTask.LINE_INFO_INPUT_NAME, |
| 2167 ParseDartTask.MODIFICATION_TIME_INPUT_NAME, |
| 2167 ParseDartTask.TOKEN_STREAM_INPUT_NAME | 2168 ParseDartTask.TOKEN_STREAM_INPUT_NAME |
| 2168 ])); | 2169 ])); |
| 2169 } | 2170 } |
| 2170 | 2171 |
| 2171 test_constructor() { | 2172 test_constructor() { |
| 2172 ParseDartTask task = new ParseDartTask(context, emptySource); | 2173 ParseDartTask task = new ParseDartTask(context, emptySource); |
| 2173 expect(task, isNotNull); | 2174 expect(task, isNotNull); |
| 2174 expect(task.context, context); | 2175 expect(task.context, context); |
| 2175 expect(task.target, emptySource); | 2176 expect(task.target, emptySource); |
| 2176 } | 2177 } |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2225 | 2226 |
| 2226 test_perform_doesNotExist() { | 2227 test_perform_doesNotExist() { |
| 2227 _performParseTask(null); | 2228 _performParseTask(null); |
| 2228 expect(outputs, hasLength(8)); | 2229 expect(outputs, hasLength(8)); |
| 2229 expect(outputs[EXPLICITLY_IMPORTED_LIBRARIES], hasLength(0)); | 2230 expect(outputs[EXPLICITLY_IMPORTED_LIBRARIES], hasLength(0)); |
| 2230 expect(outputs[EXPORTED_LIBRARIES], hasLength(0)); | 2231 expect(outputs[EXPORTED_LIBRARIES], hasLength(0)); |
| 2231 _assertHasCore(outputs[IMPORTED_LIBRARIES], 1); | 2232 _assertHasCore(outputs[IMPORTED_LIBRARIES], 1); |
| 2232 expect(outputs[INCLUDED_PARTS], hasLength(0)); | 2233 expect(outputs[INCLUDED_PARTS], hasLength(0)); |
| 2233 expect(outputs[PARSE_ERRORS], hasLength(0)); | 2234 expect(outputs[PARSE_ERRORS], hasLength(0)); |
| 2234 expect(outputs[PARSED_UNIT], isNotNull); | 2235 expect(outputs[PARSED_UNIT], isNotNull); |
| 2235 expect(outputs[SOURCE_KIND], SourceKind.LIBRARY); | 2236 expect(outputs[SOURCE_KIND], SourceKind.UNKNOWN); |
| 2236 expect(outputs[UNITS], hasLength(1)); | 2237 expect(outputs[UNITS], hasLength(1)); |
| 2237 } | 2238 } |
| 2238 | 2239 |
| 2239 test_perform_invalidDirectives() { | 2240 test_perform_invalidDirectives() { |
| 2240 _performParseTask(r''' | 2241 _performParseTask(r''' |
| 2241 library lib; | 2242 library lib; |
| 2242 import '/does/not/exist.dart'; | 2243 import '/does/not/exist.dart'; |
| 2243 import '://invaliduri.dart'; | 2244 import '://invaliduri.dart'; |
| 2244 export '${a}lib3.dart'; | 2245 export '${a}lib3.dart'; |
| 2245 part 'part.dart'; | 2246 part 'part.dart'; |
| (...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2795 /** | 2796 /** |
| 2796 * Fill [errorListener] with [result] errors in the current [task]. | 2797 * Fill [errorListener] with [result] errors in the current [task]. |
| 2797 */ | 2798 */ |
| 2798 void _fillErrorListener(ResultDescriptor<List<AnalysisError>> result) { | 2799 void _fillErrorListener(ResultDescriptor<List<AnalysisError>> result) { |
| 2799 List<AnalysisError> errors = task.outputs[result]; | 2800 List<AnalysisError> errors = task.outputs[result]; |
| 2800 expect(errors, isNotNull, reason: result.name); | 2801 expect(errors, isNotNull, reason: result.name); |
| 2801 errorListener = new GatheringErrorListener(); | 2802 errorListener = new GatheringErrorListener(); |
| 2802 errorListener.addAll(errors); | 2803 errorListener.addAll(errors); |
| 2803 } | 2804 } |
| 2804 } | 2805 } |
| OLD | NEW |