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 import 'package:analyzer/src/error/codes.dart'; | 5 import 'package:analyzer/src/error/codes.dart'; |
6 import 'package:analyzer/src/generated/source.dart'; | 6 import 'package:analyzer/src/generated/source.dart'; |
7 import 'package:analyzer/src/generated/source_io.dart'; | 7 import 'package:analyzer/src/generated/source_io.dart'; |
8 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 8 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
9 | 9 |
10 import '../utils.dart'; | |
11 import 'resolver_test_case.dart'; | 10 import 'resolver_test_case.dart'; |
12 | 11 |
13 main() { | 12 main() { |
14 initializeTestEnvironment(); | |
15 defineReflectiveSuite(() { | 13 defineReflectiveSuite(() { |
16 defineReflectiveTests(ErrorSuppressionTest); | 14 defineReflectiveTests(ErrorSuppressionTest); |
17 }); | 15 }); |
18 } | 16 } |
19 | 17 |
20 @reflectiveTest | 18 @reflectiveTest |
21 class ErrorSuppressionTest extends ResolverTestCase { | 19 class ErrorSuppressionTest extends ResolverTestCase { |
22 void test_error_code_mismatch() { | 20 void test_error_code_mismatch() { |
23 Source source = addSource(''' | 21 Source source = addSource(''' |
24 // ignore: const_initialized_with_non_constant_value | 22 // ignore: const_initialized_with_non_constant_value |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 int x = ''; //INVALID_ASSIGNMENT | 189 int x = ''; //INVALID_ASSIGNMENT |
192 const y = x; //CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE | 190 const y = x; //CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE |
193 '''); | 191 '''); |
194 computeLibrarySourceErrors(source); | 192 computeLibrarySourceErrors(source); |
195 assertErrors(source, [ | 193 assertErrors(source, [ |
196 StaticTypeWarningCode.INVALID_ASSIGNMENT, | 194 StaticTypeWarningCode.INVALID_ASSIGNMENT, |
197 CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE | 195 CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE |
198 ]); | 196 ]); |
199 } | 197 } |
200 } | 198 } |
OLD | NEW |