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 4392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4403 '''); | 4403 '''); |
4404 LibrarySpecificUnit target = new LibrarySpecificUnit(source, source); | 4404 LibrarySpecificUnit target = new LibrarySpecificUnit(source, source); |
4405 computeResult(target, VERIFY_ERRORS, matcher: isVerifyUnitTask); | 4405 computeResult(target, VERIFY_ERRORS, matcher: isVerifyUnitTask); |
4406 // validate | 4406 // validate |
4407 _fillErrorListener(VERIFY_ERRORS); | 4407 _fillErrorListener(VERIFY_ERRORS); |
4408 errorListener.assertErrorsWithCodes(<ErrorCode>[ | 4408 errorListener.assertErrorsWithCodes(<ErrorCode>[ |
4409 CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE | 4409 CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE |
4410 ]); | 4410 ]); |
4411 } | 4411 } |
4412 | 4412 |
| 4413 test_perform_ConstantValidator_duplicateFields() { |
| 4414 Source source = newSource( |
| 4415 '/test.dart', |
| 4416 ''' |
| 4417 class Test { |
| 4418 final int x = 1; |
| 4419 final int x = 2; |
| 4420 const Test(); |
| 4421 } |
| 4422 |
| 4423 main() { |
| 4424 const Test(); |
| 4425 } |
| 4426 '''); |
| 4427 LibrarySpecificUnit target = new LibrarySpecificUnit(source, source); |
| 4428 computeResult(target, VERIFY_ERRORS, matcher: isVerifyUnitTask); |
| 4429 // validate |
| 4430 _fillErrorListener(VERIFY_ERRORS); |
| 4431 errorListener.assertNoErrors(); |
| 4432 } |
| 4433 |
4413 test_perform_directiveError() { | 4434 test_perform_directiveError() { |
4414 Source source = newSource( | 4435 Source source = newSource( |
4415 '/test.dart', | 4436 '/test.dart', |
4416 ''' | 4437 ''' |
4417 import 'no-such-file.dart'; | 4438 import 'no-such-file.dart'; |
4418 '''); | 4439 '''); |
4419 LibrarySpecificUnit target = new LibrarySpecificUnit(source, source); | 4440 LibrarySpecificUnit target = new LibrarySpecificUnit(source, source); |
4420 computeResult(target, VERIFY_ERRORS, matcher: isVerifyUnitTask); | 4441 computeResult(target, VERIFY_ERRORS, matcher: isVerifyUnitTask); |
4421 // validate | 4442 // validate |
4422 _fillErrorListener(VERIFY_ERRORS); | 4443 _fillErrorListener(VERIFY_ERRORS); |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4564 /** | 4585 /** |
4565 * Fill [errorListener] with [result] errors in the current [task]. | 4586 * Fill [errorListener] with [result] errors in the current [task]. |
4566 */ | 4587 */ |
4567 void _fillErrorListener(ResultDescriptor<List<AnalysisError>> result) { | 4588 void _fillErrorListener(ResultDescriptor<List<AnalysisError>> result) { |
4568 List<AnalysisError> errors = task.outputs[result]; | 4589 List<AnalysisError> errors = task.outputs[result]; |
4569 expect(errors, isNotNull, reason: result.name); | 4590 expect(errors, isNotNull, reason: result.name); |
4570 errorListener = new GatheringErrorListener(); | 4591 errorListener = new GatheringErrorListener(); |
4571 errorListener.addAll(errors); | 4592 errorListener.addAll(errors); |
4572 } | 4593 } |
4573 } | 4594 } |
OLD | NEW |