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 'resolver_test_case.dart'; | 10 import 'resolver_test_case.dart'; |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 Source source = addSource(''' | 188 Source source = addSource(''' |
189 int x = ''; //INVALID_ASSIGNMENT | 189 int x = ''; //INVALID_ASSIGNMENT |
190 const y = x; //CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE | 190 const y = x; //CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE |
191 '''); | 191 '''); |
192 await computeAnalysisResult(source); | 192 await computeAnalysisResult(source); |
193 assertErrors(source, [ | 193 assertErrors(source, [ |
194 StaticTypeWarningCode.INVALID_ASSIGNMENT, | 194 StaticTypeWarningCode.INVALID_ASSIGNMENT, |
195 CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE | 195 CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE |
196 ]); | 196 ]); |
197 } | 197 } |
| 198 |
| 199 test_ignore_for_file() async { |
| 200 Source source = addSource(''' |
| 201 int x = ''; //INVALID_ASSIGNMENT |
| 202 const y = x; //CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE |
| 203 // ignore_for_file: invalid_assignment |
| 204 '''); |
| 205 await computeAnalysisResult(source); |
| 206 assertErrors(source, |
| 207 [CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE]); |
| 208 } |
| 209 |
| 210 test_multiple_ignore_for_files() async { |
| 211 Source source = addSource(''' |
| 212 int x = ''; //INVALID_ASSIGNMENT |
| 213 const y = x; //CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE |
| 214 // ignore_for_file: invalid_assignment,const_initialized_with_non_constant_value |
| 215 '''); |
| 216 await computeAnalysisResult(source); |
| 217 assertErrors(source, []); |
| 218 } |
| 219 |
| 220 test_ignore_for_file_whitespace_variant() async { |
| 221 Source source = addSource(''' |
| 222 //ignore_for_file: const_initialized_with_non_constant_value , invalid_assignm
ent |
| 223 int x = ''; //INVALID_ASSIGNMENT |
| 224 const y = x; //CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE |
| 225 '''); |
| 226 await computeAnalysisResult(source); |
| 227 assertErrors(source, []); |
| 228 } |
198 } | 229 } |
OLD | NEW |