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 5358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5369 class A {} | 5369 class A {} |
5370 class B extends A {} | 5370 class B extends A {} |
5371 B b = new A(); | 5371 B b = new A(); |
5372 '''); | 5372 '''); |
5373 computeResult(new LibrarySpecificUnit(source, source), STRONG_MODE_ERRORS); | 5373 computeResult(new LibrarySpecificUnit(source, source), STRONG_MODE_ERRORS); |
5374 // validate | 5374 // validate |
5375 _fillErrorListener(STRONG_MODE_ERRORS); | 5375 _fillErrorListener(STRONG_MODE_ERRORS); |
5376 | 5376 |
5377 var errors = errorListener.errors; | 5377 var errors = errorListener.errors; |
5378 expect(errors.length, 1); | 5378 expect(errors.length, 1); |
5379 expect(errors[0].errorCode.name, "STRONG_MODE_STATIC_TYPE_ERROR"); | 5379 expect(errors[0].errorCode.name, "STRONG_MODE_INVALID_CAST_NEW_EXPR"); |
5380 } | 5380 } |
5381 } | 5381 } |
5382 | 5382 |
5383 @reflectiveTest | 5383 @reflectiveTest |
5384 class VerifyUnitTaskTest extends _AbstractDartTaskTest { | 5384 class VerifyUnitTaskTest extends _AbstractDartTaskTest { |
5385 test_perform_constantError() { | 5385 test_perform_constantError() { |
5386 Source source = newSource( | 5386 Source source = newSource( |
5387 '/test.dart', | 5387 '/test.dart', |
5388 ''' | 5388 ''' |
5389 main(int p) { | 5389 main(int p) { |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5658 /** | 5658 /** |
5659 * Fill [errorListener] with [result] errors in the current [task]. | 5659 * Fill [errorListener] with [result] errors in the current [task]. |
5660 */ | 5660 */ |
5661 void _fillErrorListener(ResultDescriptor<List<AnalysisError>> result) { | 5661 void _fillErrorListener(ResultDescriptor<List<AnalysisError>> result) { |
5662 List<AnalysisError> errors = task.outputs[result] as List<AnalysisError>; | 5662 List<AnalysisError> errors = task.outputs[result] as List<AnalysisError>; |
5663 expect(errors, isNotNull, reason: result.name); | 5663 expect(errors, isNotNull, reason: result.name); |
5664 errorListener = new GatheringErrorListener(); | 5664 errorListener = new GatheringErrorListener(); |
5665 errorListener.addAll(errors); | 5665 errorListener.addAll(errors); |
5666 } | 5666 } |
5667 } | 5667 } |
OLD | NEW |