OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 engine.compile_time_error_code_test; | 5 library engine.compile_time_error_code_test; |
6 | 6 |
7 import 'package:analyzer/src/generated/error.dart'; | 7 import 'package:analyzer/src/generated/error.dart'; |
8 import 'package:analyzer/src/generated/parser.dart' show ParserErrorCode; | 8 import 'package:analyzer/src/generated/parser.dart' show ParserErrorCode; |
9 import 'package:analyzer/src/generated/source_io.dart'; | 9 import 'package:analyzer/src/generated/source_io.dart'; |
10 | 10 |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 addNamedSource( | 215 addNamedSource( |
216 "/lib2.dart", | 216 "/lib2.dart", |
217 r''' | 217 r''' |
218 library lib2; | 218 library lib2; |
219 class N {}'''); | 219 class N {}'''); |
220 computeLibrarySourceErrors(source); | 220 computeLibrarySourceErrors(source); |
221 assertErrors(source, [CompileTimeErrorCode.AMBIGUOUS_EXPORT]); | 221 assertErrors(source, [CompileTimeErrorCode.AMBIGUOUS_EXPORT]); |
222 verify([source]); | 222 verify([source]); |
223 } | 223 } |
224 | 224 |
| 225 void test_assertWithExtraArgument() { |
| 226 // TODO(paulberry): once DEP 37 is turned on by default, this test should |
| 227 // be removed. |
| 228 Source source = addSource(''' |
| 229 f(bool x) { |
| 230 assert(x, 'foo'); |
| 231 } |
| 232 '''); |
| 233 computeLibrarySourceErrors(source); |
| 234 assertErrors(source, [CompileTimeErrorCode.EXTRA_ARGUMENT_TO_ASSERT]); |
| 235 verify([source]); |
| 236 } |
| 237 |
225 void test_async_used_as_identifier_in_annotation() { | 238 void test_async_used_as_identifier_in_annotation() { |
226 Source source = addSource(''' | 239 Source source = addSource(''' |
227 const int async = 0; | 240 const int async = 0; |
228 f() async { | 241 f() async { |
229 g(@async x) {} | 242 g(@async x) {} |
230 g(0); | 243 g(0); |
231 } | 244 } |
232 '''); | 245 '''); |
233 computeLibrarySourceErrors(source); | 246 computeLibrarySourceErrors(source); |
234 assertErrors(source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]); | 247 assertErrors(source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]); |
(...skipping 5944 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6179 source, [CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR]); | 6192 source, [CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR]); |
6180 verify([source]); | 6193 verify([source]); |
6181 reset(); | 6194 reset(); |
6182 } | 6195 } |
6183 | 6196 |
6184 void _check_wrongNumberOfParametersForOperator1(String name) { | 6197 void _check_wrongNumberOfParametersForOperator1(String name) { |
6185 _check_wrongNumberOfParametersForOperator(name, ""); | 6198 _check_wrongNumberOfParametersForOperator(name, ""); |
6186 _check_wrongNumberOfParametersForOperator(name, "a, b"); | 6199 _check_wrongNumberOfParametersForOperator(name, "a, b"); |
6187 } | 6200 } |
6188 } | 6201 } |
OLD | NEW |