| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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.generated.hint_code_test; | 5 library analyzer.test.generated.hint_code_test; |
| 6 | 6 |
| 7 import 'package:analyzer/src/generated/engine.dart'; | 7 import 'package:analyzer/src/generated/engine.dart'; |
| 8 import 'package:analyzer/src/generated/error.dart'; | 8 import 'package:analyzer/src/generated/error.dart'; |
| 9 import 'package:analyzer/src/generated/source_io.dart'; | 9 import 'package:analyzer/src/generated/source_io.dart'; |
| 10 import 'package:unittest/unittest.dart'; | 10 import 'package:unittest/unittest.dart'; |
| (...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 651 class A { | 651 class A { |
| 652 @deprecated | 652 @deprecated |
| 653 m() {} | 653 m() {} |
| 654 n() {m();} | 654 n() {m();} |
| 655 }'''); | 655 }'''); |
| 656 computeLibrarySourceErrors(source); | 656 computeLibrarySourceErrors(source); |
| 657 assertErrors(source, [HintCode.DEPRECATED_MEMBER_USE]); | 657 assertErrors(source, [HintCode.DEPRECATED_MEMBER_USE]); |
| 658 verify([source]); | 658 verify([source]); |
| 659 } | 659 } |
| 660 | 660 |
| 661 void test_deprecatedAnnotationUse_positional() { |
| 662 Source source = addSource(r''' |
| 663 class A { |
| 664 m([@deprecated int x]) {} |
| 665 n() {m(1);} |
| 666 }'''); |
| 667 computeLibrarySourceErrors(source); |
| 668 assertErrors(source, [HintCode.DEPRECATED_MEMBER_USE]); |
| 669 verify([source]); |
| 670 } |
| 671 |
| 672 void test_deprecatedAnnotationUse_named() { |
| 673 Source source = addSource(r''' |
| 674 class A { |
| 675 m({@deprecated int x}) {} |
| 676 n() {m(x: 1);} |
| 677 }'''); |
| 678 computeLibrarySourceErrors(source); |
| 679 assertErrors(source, [HintCode.DEPRECATED_MEMBER_USE]); |
| 680 verify([source]); |
| 681 } |
| 682 |
| 661 void test_deprecatedAnnotationUse_export() { | 683 void test_deprecatedAnnotationUse_export() { |
| 662 Source source = addSource("export 'deprecated_library.dart';"); | 684 Source source = addSource("export 'deprecated_library.dart';"); |
| 663 addNamedSource( | 685 addNamedSource( |
| 664 "/deprecated_library.dart", | 686 "/deprecated_library.dart", |
| 665 r''' | 687 r''' |
| 666 @deprecated | 688 @deprecated |
| 667 library deprecated_library; | 689 library deprecated_library; |
| 668 class A {}'''); | 690 class A {}'''); |
| 669 computeLibrarySourceErrors(source); | 691 computeLibrarySourceErrors(source); |
| 670 assertErrors(source, [HintCode.DEPRECATED_MEMBER_USE]); | 692 assertErrors(source, [HintCode.DEPRECATED_MEMBER_USE]); |
| (...skipping 2641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3312 n() { | 3334 n() { |
| 3313 var a = m(), b = m(); | 3335 var a = m(), b = m(); |
| 3314 } | 3336 } |
| 3315 }'''); | 3337 }'''); |
| 3316 computeLibrarySourceErrors(source); | 3338 computeLibrarySourceErrors(source); |
| 3317 assertErrors( | 3339 assertErrors( |
| 3318 source, [HintCode.USE_OF_VOID_RESULT, HintCode.USE_OF_VOID_RESULT]); | 3340 source, [HintCode.USE_OF_VOID_RESULT, HintCode.USE_OF_VOID_RESULT]); |
| 3319 verify([source]); | 3341 verify([source]); |
| 3320 } | 3342 } |
| 3321 } | 3343 } |
| OLD | NEW |