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 2691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2702 "/lib1.dart", | 2702 "/lib1.dart", |
2703 r''' | 2703 r''' |
2704 library lib1; | 2704 library lib1; |
2705 class A {}'''); | 2705 class A {}'''); |
2706 computeLibrarySourceErrors(source); | 2706 computeLibrarySourceErrors(source); |
2707 assertErrors(source, [HintCode.UNUSED_IMPORT]); | 2707 assertErrors(source, [HintCode.UNUSED_IMPORT]); |
2708 assertNoErrors(source2); | 2708 assertNoErrors(source2); |
2709 verify([source, source2]); | 2709 verify([source, source2]); |
2710 } | 2710 } |
2711 | 2711 |
| 2712 void test_unusedImport_inComment_libraryDirective() { |
| 2713 Source source = addSource(r''' |
| 2714 /// Use [Future] class. |
| 2715 library L; |
| 2716 import 'dart:async'; |
| 2717 '''); |
| 2718 assertNoErrors(source); |
| 2719 } |
| 2720 |
2712 void test_unusedImport_show() { | 2721 void test_unusedImport_show() { |
2713 Source source = addSource(r''' | 2722 Source source = addSource(r''' |
2714 library L; | 2723 library L; |
2715 import 'lib1.dart' show A; | 2724 import 'lib1.dart' show A; |
2716 import 'lib1.dart' show B; | 2725 import 'lib1.dart' show B; |
2717 A a;'''); | 2726 A a;'''); |
2718 Source source2 = addNamedSource( | 2727 Source source2 = addNamedSource( |
2719 "/lib1.dart", | 2728 "/lib1.dart", |
2720 r''' | 2729 r''' |
2721 library lib1; | 2730 library lib1; |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2988 n() { | 2997 n() { |
2989 var a = m(), b = m(); | 2998 var a = m(), b = m(); |
2990 } | 2999 } |
2991 }'''); | 3000 }'''); |
2992 computeLibrarySourceErrors(source); | 3001 computeLibrarySourceErrors(source); |
2993 assertErrors( | 3002 assertErrors( |
2994 source, [HintCode.USE_OF_VOID_RESULT, HintCode.USE_OF_VOID_RESULT]); | 3003 source, [HintCode.USE_OF_VOID_RESULT, HintCode.USE_OF_VOID_RESULT]); |
2995 verify([source]); | 3004 verify([source]); |
2996 } | 3005 } |
2997 } | 3006 } |
OLD | NEW |