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/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/ast/visitor.dart'; | 9 import 'package:analyzer/dart/ast/visitor.dart'; |
10 import 'package:analyzer/dart/element/element.dart'; | 10 import 'package:analyzer/dart/element/element.dart'; |
(...skipping 3256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3267 expect(import.configurations[1].uriSource.shortName, 'foo_html.dart'); | 3267 expect(import.configurations[1].uriSource.shortName, 'foo_html.dart'); |
3268 | 3268 |
3269 var exported = outputs[EXPORTED_LIBRARIES] as List<Source>; | 3269 var exported = outputs[EXPORTED_LIBRARIES] as List<Source>; |
3270 _assertContainsOnlyShortName(exported, 'bar_io.dart'); | 3270 _assertContainsOnlyShortName(exported, 'bar_io.dart'); |
3271 | 3271 |
3272 var export = unit.directives[1] as ExportDirective; | 3272 var export = unit.directives[1] as ExportDirective; |
3273 expect(export.uriSource.shortName, 'bar.dart'); | 3273 expect(export.uriSource.shortName, 'bar.dart'); |
3274 expect(export.selectedSource.shortName, 'bar_io.dart'); | 3274 expect(export.selectedSource.shortName, 'bar_io.dart'); |
3275 expect(export.configurations[0].uriSource.shortName, 'bar_io.dart'); | 3275 expect(export.configurations[0].uriSource.shortName, 'bar_io.dart'); |
3276 expect(export.configurations[1].uriSource.shortName, 'bar_html.dart'); | 3276 expect(export.configurations[1].uriSource.shortName, 'bar_html.dart'); |
| 3277 |
| 3278 var refSources = outputs[REFERENCED_SOURCES] as List<Source>; |
| 3279 var refNames = refSources.map((source) => source.shortName).toList(); |
| 3280 expect(refNames, contains('test.dart')); |
| 3281 expect(refNames, contains('foo.dart')); |
| 3282 expect(refNames, contains('foo_io.dart')); |
| 3283 expect(refNames, contains('foo_html.dart')); |
| 3284 expect(refNames, contains('bar.dart')); |
| 3285 expect(refNames, contains('bar_io.dart')); |
| 3286 expect(refNames, contains('bar_html.dart')); |
3277 } | 3287 } |
3278 | 3288 |
3279 test_perform_library_configurations_bool2() { | 3289 test_perform_library_configurations_bool2() { |
3280 context.declaredVariables.define('dart.library.html', 'true'); | 3290 context.declaredVariables.define('dart.library.html', 'true'); |
3281 newSource('/foo.dart', ''); | 3291 newSource('/foo.dart', ''); |
3282 newSource('/foo_io.dart', ''); | 3292 newSource('/foo_io.dart', ''); |
3283 newSource('/foo_html.dart', ''); | 3293 newSource('/foo_html.dart', ''); |
3284 _performParseTask(r''' | 3294 _performParseTask(r''' |
3285 import 'foo.dart' | 3295 import 'foo.dart' |
3286 if (dart.library.io) 'foo_io.dart' | 3296 if (dart.library.io) 'foo_io.dart' |
(...skipping 2373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5660 /** | 5670 /** |
5661 * Fill [errorListener] with [result] errors in the current [task]. | 5671 * Fill [errorListener] with [result] errors in the current [task]. |
5662 */ | 5672 */ |
5663 void _fillErrorListener(ResultDescriptor<List<AnalysisError>> result) { | 5673 void _fillErrorListener(ResultDescriptor<List<AnalysisError>> result) { |
5664 List<AnalysisError> errors = task.outputs[result] as List<AnalysisError>; | 5674 List<AnalysisError> errors = task.outputs[result] as List<AnalysisError>; |
5665 expect(errors, isNotNull, reason: result.name); | 5675 expect(errors, isNotNull, reason: result.name); |
5666 errorListener = new GatheringErrorListener(); | 5676 errorListener = new GatheringErrorListener(); |
5667 errorListener.addAll(errors); | 5677 errorListener.addAll(errors); |
5668 } | 5678 } |
5669 } | 5679 } |
OLD | NEW |