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

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

Issue 2813553006: Split error code to ease future improvements (Closed)
Patch Set: Created 3 years, 8 months 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 analyzer.test.generated.compile_time_error_code_test; 5 library analyzer.test.generated.compile_time_error_code_test;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:analyzer/error/error.dart'; 9 import 'package:analyzer/error/error.dart';
10 import 'package:analyzer/src/error/codes.dart'; 10 import 'package:analyzer/src/error/codes.dart';
(...skipping 2172 matching lines...) Expand 10 before | Expand all | Expand 10 after
2183 const A(); 2183 const A();
2184 } 2184 }
2185 class B extends A { 2185 class B extends A {
2186 const B() : super(0); 2186 const B() : super(0);
2187 }'''); 2187 }''');
2188 await computeAnalysisResult(source); 2188 await computeAnalysisResult(source);
2189 assertErrors(source, [CompileTimeErrorCode.EXTRA_POSITIONAL_ARGUMENTS]); 2189 assertErrors(source, [CompileTimeErrorCode.EXTRA_POSITIONAL_ARGUMENTS]);
2190 verify([source]); 2190 verify([source]);
2191 } 2191 }
2192 2192
2193 test_extraPositionalArgumentsCouldBeNamed_const() async {
2194 Source source = addSource(r'''
2195 class A {
2196 const A({int x});
2197 }
2198 main() {
2199 const A(0);
2200 }''');
2201 await computeAnalysisResult(source);
2202 assertErrors(source,
2203 [CompileTimeErrorCode.EXTRA_POSITIONAL_ARGUMENTS_COULD_BE_NAMED]);
2204 verify([source]);
2205 }
2206
2207 test_extraPositionalArgumentsCouldBeNamed_const_super() async {
2208 Source source = addSource(r'''
2209 class A {
2210 const A({int x});
2211 }
2212 class B extends A {
2213 const B() : super(0);
2214 }''');
2215 await computeAnalysisResult(source);
2216 assertErrors(source,
2217 [CompileTimeErrorCode.EXTRA_POSITIONAL_ARGUMENTS_COULD_BE_NAMED]);
2218 verify([source]);
2219 }
2220
2193 test_fieldFormalParameter_assignedInInitializer() async { 2221 test_fieldFormalParameter_assignedInInitializer() async {
2194 Source source = addSource(r''' 2222 Source source = addSource(r'''
2195 class A { 2223 class A {
2196 int x; 2224 int x;
2197 A(this.x) : x = 3 {} 2225 A(this.x) : x = 3 {}
2198 }'''); 2226 }''');
2199 await computeAnalysisResult(source); 2227 await computeAnalysisResult(source);
2200 assertErrors(source, 2228 assertErrors(source,
2201 [CompileTimeErrorCode.FIELD_INITIALIZED_IN_PARAMETER_AND_INITIALIZER]); 2229 [CompileTimeErrorCode.FIELD_INITIALIZED_IN_PARAMETER_AND_INITIALIZER]);
2202 verify([source]); 2230 verify([source]);
(...skipping 4389 matching lines...) Expand 10 before | Expand all | Expand 10 after
6592 source, [CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR]); 6620 source, [CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR]);
6593 verify([source]); 6621 verify([source]);
6594 reset(); 6622 reset();
6595 } 6623 }
6596 6624
6597 Future<Null> _check_wrongNumberOfParametersForOperator1(String name) async { 6625 Future<Null> _check_wrongNumberOfParametersForOperator1(String name) async {
6598 await _check_wrongNumberOfParametersForOperator(name, ""); 6626 await _check_wrongNumberOfParametersForOperator(name, "");
6599 await _check_wrongNumberOfParametersForOperator(name, "a, b"); 6627 await _check_wrongNumberOfParametersForOperator(name, "a, b");
6600 } 6628 }
6601 } 6629 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/generated/resolver.dart ('k') | pkg/analyzer/test/generated/static_warning_code_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698