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

Unified Diff: pkg/analyzer/test/generated/static_warning_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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analyzer/test/generated/compile_time_error_code_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/generated/static_warning_code_test.dart
diff --git a/pkg/analyzer/test/generated/static_warning_code_test.dart b/pkg/analyzer/test/generated/static_warning_code_test.dart
index c808b49ec12e0c75d4f42e1d73e1f764bdf345e6..b6aecefafddd634ebadb3be7ca727b94d563c04d 100644
--- a/pkg/analyzer/test/generated/static_warning_code_test.dart
+++ b/pkg/analyzer/test/generated/static_warning_code_test.dart
@@ -1328,6 +1328,29 @@ main() {
verify([source]);
}
+ test_extraPositionalArgumentsCouldBeNamed() async {
+ Source source = addSource(r'''
+f({x, y}) {}
+main() {
+ f(0, 1, '2');
+}''');
+ await computeAnalysisResult(source);
+ assertErrors(
+ source, [StaticWarningCode.EXTRA_POSITIONAL_ARGUMENTS_COULD_BE_NAMED]);
+ verify([source]);
+ }
+
+ test_extraPositionalArgumentsCouldBeNamed_functionExpression() async {
+ Source source = addSource(r'''
+main() {
+ (int x, {int y}) {} (0, 1);
+}''');
+ await computeAnalysisResult(source);
+ assertErrors(
+ source, [StaticWarningCode.EXTRA_POSITIONAL_ARGUMENTS_COULD_BE_NAMED]);
+ verify([source]);
+ }
+
test_fieldInitializedInInitializerAndDeclaration_final() async {
Source source = addSource(r'''
class A {
@@ -3062,16 +3085,6 @@ class B {
verify([source]);
}
- test_returnWithoutValue_Null() async {
- // Test that block bodied functions with return type Null and an empty
- // return cause a static warning.
- Source source = addSource(r'''
-Null f() {return;}
-''');
- await computeAnalysisResult(source);
- assertErrors(source, [StaticWarningCode.RETURN_WITHOUT_VALUE]);
- }
-
test_returnWithoutValue_async() async {
Source source = addSource('''
import 'dart:async';
@@ -3120,6 +3133,16 @@ int f(int x) {
verify([source]);
}
+ test_returnWithoutValue_Null() async {
+ // Test that block bodied functions with return type Null and an empty
+ // return cause a static warning.
+ Source source = addSource(r'''
+Null f() {return;}
+''');
+ await computeAnalysisResult(source);
+ assertErrors(source, [StaticWarningCode.RETURN_WITHOUT_VALUE]);
+ }
+
test_staticAccessToInstanceMember_method_invocation() async {
Source source = addSource(r'''
class A {
« no previous file with comments | « pkg/analyzer/test/generated/compile_time_error_code_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698