| 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 1692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1703 void test_typeCheck_type_not_Null() { | 1703 void test_typeCheck_type_not_Null() { |
| 1704 Source source = addSource(r''' | 1704 Source source = addSource(r''' |
| 1705 m(i) { | 1705 m(i) { |
| 1706 bool b = i is! Null; | 1706 bool b = i is! Null; |
| 1707 }'''); | 1707 }'''); |
| 1708 computeLibrarySourceErrors(source); | 1708 computeLibrarySourceErrors(source); |
| 1709 assertErrors(source, [HintCode.TYPE_CHECK_IS_NOT_NULL]); | 1709 assertErrors(source, [HintCode.TYPE_CHECK_IS_NOT_NULL]); |
| 1710 verify([source]); | 1710 verify([source]); |
| 1711 } | 1711 } |
| 1712 | 1712 |
| 1713 void test_undefinedIdentifier_hide() { |
| 1714 Source source = addSource(r''' |
| 1715 library L; |
| 1716 export 'lib1.dart' hide a;'''); |
| 1717 addNamedSource("/lib1.dart", "library lib1;"); |
| 1718 computeLibrarySourceErrors(source); |
| 1719 assertErrors(source, [HintCode.UNDEFINED_HIDDEN_NAME]); |
| 1720 verify([source]); |
| 1721 } |
| 1722 |
| 1723 void test_undefinedIdentifier_show() { |
| 1724 Source source = addSource(r''' |
| 1725 library L; |
| 1726 export 'lib1.dart' show a;'''); |
| 1727 addNamedSource("/lib1.dart", "library lib1;"); |
| 1728 computeLibrarySourceErrors(source); |
| 1729 assertErrors(source, [HintCode.UNDEFINED_SHOWN_NAME]); |
| 1730 verify([source]); |
| 1731 } |
| 1732 |
| 1713 void test_undefinedGetter() { | 1733 void test_undefinedGetter() { |
| 1714 Source source = addSource(r''' | 1734 Source source = addSource(r''' |
| 1715 class A {} | 1735 class A {} |
| 1716 f(var a) { | 1736 f(var a) { |
| 1717 if(a is A) { | 1737 if(a is A) { |
| 1718 return a.m; | 1738 return a.m; |
| 1719 } | 1739 } |
| 1720 }'''); | 1740 }'''); |
| 1721 computeLibrarySourceErrors(source); | 1741 computeLibrarySourceErrors(source); |
| 1722 assertErrors(source, [HintCode.UNDEFINED_GETTER]); | 1742 assertErrors(source, [HintCode.UNDEFINED_GETTER]); |
| (...skipping 1517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3240 n() { | 3260 n() { |
| 3241 var a = m(), b = m(); | 3261 var a = m(), b = m(); |
| 3242 } | 3262 } |
| 3243 }'''); | 3263 }'''); |
| 3244 computeLibrarySourceErrors(source); | 3264 computeLibrarySourceErrors(source); |
| 3245 assertErrors( | 3265 assertErrors( |
| 3246 source, [HintCode.USE_OF_VOID_RESULT, HintCode.USE_OF_VOID_RESULT]); | 3266 source, [HintCode.USE_OF_VOID_RESULT, HintCode.USE_OF_VOID_RESULT]); |
| 3247 verify([source]); | 3267 verify([source]); |
| 3248 } | 3268 } |
| 3249 } | 3269 } |
| OLD | NEW |