Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(220)

Side by Side Diff: pkg/analyzer/test/generated/compile_time_error_code_test.dart

Issue 1480433002: Add support for assert statements with messages to the analyzer. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 import 'annotations.dart' as pref; 255 import 'annotations.dart' as pref;
256 @pref.property(123) 256 @pref.property(123)
257 main() { 257 main() {
258 } 258 }
259 '''); 259 ''');
260 computeLibrarySourceErrors(source); 260 computeLibrarySourceErrors(source);
261 assertErrors(source, [CompileTimeErrorCode.ANNOTATION_WITH_NON_CLASS]); 261 assertErrors(source, [CompileTimeErrorCode.ANNOTATION_WITH_NON_CLASS]);
262 verify([source]); 262 verify([source]);
263 } 263 }
264 264
265 void test_assertWithExtraArgument() {
266 // TODO(paulberry): once DEP 37 is turned on by default, this test should
267 // be removed.
268 Source source = addSource('''
269 f(bool x) {
270 assert(x, 'foo');
271 }
272 ''');
273 computeLibrarySourceErrors(source);
274 assertErrors(source, [CompileTimeErrorCode.EXTRA_ARGUMENT_TO_ASSERT]);
275 verify([source]);
276 }
277
265 void test_async_used_as_identifier_in_annotation() { 278 void test_async_used_as_identifier_in_annotation() {
266 Source source = addSource(''' 279 Source source = addSource('''
267 const int async = 0; 280 const int async = 0;
268 f() async { 281 f() async {
269 g(@async x) {} 282 g(@async x) {}
270 g(0); 283 g(0);
271 } 284 }
272 '''); 285 ''');
273 computeLibrarySourceErrors(source); 286 computeLibrarySourceErrors(source);
274 assertErrors(source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]); 287 assertErrors(source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
(...skipping 5958 matching lines...) Expand 10 before | Expand all | Expand 10 after
6233 source, [CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR]); 6246 source, [CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR]);
6234 verify([source]); 6247 verify([source]);
6235 reset(); 6248 reset();
6236 } 6249 }
6237 6250
6238 void _check_wrongNumberOfParametersForOperator1(String name) { 6251 void _check_wrongNumberOfParametersForOperator1(String name) {
6239 _check_wrongNumberOfParametersForOperator(name, ""); 6252 _check_wrongNumberOfParametersForOperator(name, "");
6240 _check_wrongNumberOfParametersForOperator(name, "a, b"); 6253 _check_wrongNumberOfParametersForOperator(name, "a, b");
6241 } 6254 }
6242 } 6255 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698