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 823 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
834 ''', | 834 ''', |
835 '/part1.dart': ''' | 835 '/part1.dart': ''' |
836 part of lib; | 836 part of lib; |
837 int get test => 0; | 837 int get test => 0; |
838 ''', | 838 ''', |
839 '/part2.dart': ''' | 839 '/part2.dart': ''' |
840 part of lib; | 840 part of lib; |
841 void set test(_) {} | 841 void set test(_) {} |
842 ''' | 842 ''' |
843 }); | 843 }); |
844 CompilationUnitElement unitElement1 = partUnits[0].element; | 844 CompilationUnitElement unitElement1 = partUnits |
845 CompilationUnitElement unitElement2 = partUnits[1].element; | 845 .singleWhere((u) => u.element.name.endsWith('part1.dart')) |
| 846 .element; |
| 847 CompilationUnitElement unitElement2 = partUnits |
| 848 .singleWhere((u) => u.element.name.endsWith('part2.dart')) |
| 849 .element; |
846 PropertyAccessorElement getter = unitElement1.accessors[0]; | 850 PropertyAccessorElement getter = unitElement1.accessors[0]; |
847 PropertyAccessorElement setter = unitElement2.accessors[0]; | 851 PropertyAccessorElement setter = unitElement2.accessors[0]; |
848 PropertyInducingElement variable = getter.variable; | 852 PropertyInducingElement variable = getter.variable; |
849 expect(getter.isGetter, isTrue); | 853 expect(getter.isGetter, isTrue); |
850 expect(setter.isSetter, isTrue); | 854 expect(setter.isSetter, isTrue); |
851 expect(variable, isNotNull); | 855 expect(variable, isNotNull); |
852 expect(setter.variable, same(variable)); | 856 expect(setter.variable, same(variable)); |
853 expect(unitElement1.topLevelVariables, [variable]); | 857 expect(unitElement1.topLevelVariables, [variable]); |
854 expect(unitElement2.topLevelVariables, [variable]); | 858 expect(unitElement2.topLevelVariables, [variable]); |
855 } | 859 } |
(...skipping 3561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4417 /** | 4421 /** |
4418 * Fill [errorListener] with [result] errors in the current [task]. | 4422 * Fill [errorListener] with [result] errors in the current [task]. |
4419 */ | 4423 */ |
4420 void _fillErrorListener(ResultDescriptor<List<AnalysisError>> result) { | 4424 void _fillErrorListener(ResultDescriptor<List<AnalysisError>> result) { |
4421 List<AnalysisError> errors = task.outputs[result]; | 4425 List<AnalysisError> errors = task.outputs[result]; |
4422 expect(errors, isNotNull, reason: result.name); | 4426 expect(errors, isNotNull, reason: result.name); |
4423 errorListener = new GatheringErrorListener(); | 4427 errorListener = new GatheringErrorListener(); |
4424 errorListener.addAll(errors); | 4428 errorListener.addAll(errors); |
4425 } | 4429 } |
4426 } | 4430 } |
OLD | NEW |