| 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/error/error.dart'; | 7 import 'package:analyzer/error/error.dart'; |
| 8 import 'package:analyzer/src/error/codes.dart'; | 8 import 'package:analyzer/src/error/codes.dart'; |
| 9 import 'package:analyzer/src/generated/engine.dart'; | 9 import 'package:analyzer/src/generated/engine.dart'; |
| 10 import 'package:analyzer/src/generated/parser.dart'; | 10 import 'package:analyzer/src/generated/parser.dart'; |
| 11 import 'package:analyzer/src/generated/source_io.dart'; | 11 import 'package:analyzer/src/generated/source_io.dart'; |
| 12 import 'package:test/test.dart'; | 12 import 'package:test/test.dart'; |
| 13 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 13 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
| 14 | 14 |
| 15 import 'resolver_test_case.dart'; | 15 import 'resolver_test_case.dart'; |
| 16 | 16 |
| 17 main() { | 17 main() { |
| 18 defineReflectiveSuite(() { | 18 defineReflectiveSuite(() { |
| 19 defineReflectiveTests(HintCodeTest); | 19 defineReflectiveTests(HintCodeTest); |
| 20 }); | 20 }); |
| 21 } | 21 } |
| 22 | 22 |
| 23 @reflectiveTest | 23 @reflectiveTest |
| 24 class HintCodeTest extends ResolverTestCase { | 24 class HintCodeTest extends ResolverTestCase { |
| 25 @override | 25 @override |
| 26 void reset({List<List<String>> packages}) { | 26 void reset() { |
| 27 super.reset(packages: [ | 27 super.resetWith(packages: [ |
| 28 [ | 28 [ |
| 29 'meta', | 29 'meta', |
| 30 r''' | 30 r''' |
| 31 library meta; | 31 library meta; |
| 32 | 32 |
| 33 const _Factory factory = const _Factory(); | 33 const _Factory factory = const _Factory(); |
| 34 const _Literal literal = const _Literal(); | 34 const _Literal literal = const _Literal(); |
| 35 const _MustCallSuper mustCallSuper = const _MustCallSuper(); | 35 const _MustCallSuper mustCallSuper = const _MustCallSuper(); |
| 36 const _Protected protected = const _Protected(); | 36 const _Protected protected = const _Protected(); |
| 37 const Required required = const Required(); | 37 const Required required = const Required(); |
| (...skipping 1715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1753 // TODO(brianwilkerson) This should produce a hint because the annotation is | 1753 // TODO(brianwilkerson) This should produce a hint because the annotation is |
| 1754 // being applied to the wrong kind of declaration. | 1754 // being applied to the wrong kind of declaration. |
| 1755 await computeAnalysisResult(source); | 1755 await computeAnalysisResult(source); |
| 1756 assertNoErrors(source); | 1756 assertNoErrors(source); |
| 1757 verify([source]); | 1757 verify([source]); |
| 1758 } | 1758 } |
| 1759 | 1759 |
| 1760 test_isDouble() async { | 1760 test_isDouble() async { |
| 1761 AnalysisOptionsImpl options = new AnalysisOptionsImpl(); | 1761 AnalysisOptionsImpl options = new AnalysisOptionsImpl(); |
| 1762 options.dart2jsHint = true; | 1762 options.dart2jsHint = true; |
| 1763 resetWithOptions(options); | 1763 resetWith(options: options); |
| 1764 Source source = addSource("var v = 1 is double;"); | 1764 Source source = addSource("var v = 1 is double;"); |
| 1765 await computeAnalysisResult(source); | 1765 await computeAnalysisResult(source); |
| 1766 assertErrors(source, [HintCode.IS_DOUBLE]); | 1766 assertErrors(source, [HintCode.IS_DOUBLE]); |
| 1767 verify([source]); | 1767 verify([source]); |
| 1768 } | 1768 } |
| 1769 | 1769 |
| 1770 @failingTest | 1770 @failingTest |
| 1771 test_isInt() async { | 1771 test_isInt() async { |
| 1772 Source source = addSource("var v = 1 is int;"); | 1772 Source source = addSource("var v = 1 is int;"); |
| 1773 await computeAnalysisResult(source); | 1773 await computeAnalysisResult(source); |
| 1774 assertErrors(source, [HintCode.IS_INT]); | 1774 assertErrors(source, [HintCode.IS_INT]); |
| 1775 verify([source]); | 1775 verify([source]); |
| 1776 } | 1776 } |
| 1777 | 1777 |
| 1778 test_isNotDouble() async { | 1778 test_isNotDouble() async { |
| 1779 AnalysisOptionsImpl options = new AnalysisOptionsImpl(); | 1779 AnalysisOptionsImpl options = new AnalysisOptionsImpl(); |
| 1780 options.dart2jsHint = true; | 1780 options.dart2jsHint = true; |
| 1781 resetWithOptions(options); | 1781 resetWith(options: options); |
| 1782 Source source = addSource("var v = 1 is! double;"); | 1782 Source source = addSource("var v = 1 is! double;"); |
| 1783 await computeAnalysisResult(source); | 1783 await computeAnalysisResult(source); |
| 1784 assertErrors(source, [HintCode.IS_NOT_DOUBLE]); | 1784 assertErrors(source, [HintCode.IS_NOT_DOUBLE]); |
| 1785 verify([source]); | 1785 verify([source]); |
| 1786 } | 1786 } |
| 1787 | 1787 |
| 1788 @failingTest | 1788 @failingTest |
| 1789 test_isNotInt() async { | 1789 test_isNotInt() async { |
| 1790 Source source = addSource("var v = 1 is! int;"); | 1790 Source source = addSource("var v = 1 is! int;"); |
| 1791 await computeAnalysisResult(source); | 1791 await computeAnalysisResult(source); |
| (...skipping 2241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4033 n() { | 4033 n() { |
| 4034 var a = m(), b = m(); | 4034 var a = m(), b = m(); |
| 4035 } | 4035 } |
| 4036 }'''); | 4036 }'''); |
| 4037 await computeAnalysisResult(source); | 4037 await computeAnalysisResult(source); |
| 4038 assertErrors( | 4038 assertErrors( |
| 4039 source, [HintCode.USE_OF_VOID_RESULT, HintCode.USE_OF_VOID_RESULT]); | 4039 source, [HintCode.USE_OF_VOID_RESULT, HintCode.USE_OF_VOID_RESULT]); |
| 4040 verify([source]); | 4040 verify([source]); |
| 4041 } | 4041 } |
| 4042 } | 4042 } |
| OLD | NEW |