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

Unified Diff: pkg/analysis_server/test/services/correction/fix_test.dart

Issue 1159273004: Issue 11200. Quick Fix for adding required/positional parameters. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 7 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/analysis_server/lib/src/services/correction/fix_internal.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/test/services/correction/fix_test.dart
diff --git a/pkg/analysis_server/test/services/correction/fix_test.dart b/pkg/analysis_server/test/services/correction/fix_test.dart
index d43d0a1d2194ee10e21225ca84521bca98835441..3fb657bfaf9b5dd151a74a15b527514ccc0ea23d 100644
--- a/pkg/analysis_server/test/services/correction/fix_test.dart
+++ b/pkg/analysis_server/test/services/correction/fix_test.dart
@@ -162,6 +162,108 @@ class Test {
''');
}
+ void test_addMissingParameter_function_positional_hasZero() {
+ resolveTestUnit('''
+test() {}
+main() {
+ test(1);
+}
+''');
+ assertHasFix(DartFixKind.ADD_MISSING_PARAMETER_POSITIONAL, '''
+test([int i]) {}
+main() {
+ test(1);
+}
+''');
+ }
+
+ void test_addMissingParameter_function_required_hasOne() {
+ resolveTestUnit('''
+test(int a) {}
+main() {
+ test(1, 2.0);
+}
+''');
+ assertHasFix(DartFixKind.ADD_MISSING_PARAMETER_REQUIRED, '''
+test(int a, double d) {}
+main() {
+ test(1, 2.0);
+}
+''');
+ }
+
+ void test_addMissingParameter_function_required_hasZero() {
+ resolveTestUnit('''
+test() {}
+main() {
+ test(1);
+}
+''');
+ assertHasFix(DartFixKind.ADD_MISSING_PARAMETER_REQUIRED, '''
+test(int i) {}
+main() {
+ test(1);
+}
+''');
+ }
+
+ void test_addMissingParameter_method_positional_hasOne() {
+ resolveTestUnit('''
+class A {
+ test(int a) {}
+ main() {
+ test(1, 2.0);
+ }
+}
+''');
+ assertHasFix(DartFixKind.ADD_MISSING_PARAMETER_POSITIONAL, '''
+class A {
+ test(int a, [double d]) {}
+ main() {
+ test(1, 2.0);
+ }
+}
+''');
+ }
+
+ void test_addMissingParameter_method_required_hasOne() {
+ resolveTestUnit('''
+class A {
+ test(int a) {}
+ main() {
+ test(1, 2.0);
+ }
+}
+''');
+ assertHasFix(DartFixKind.ADD_MISSING_PARAMETER_REQUIRED, '''
+class A {
+ test(int a, double d) {}
+ main() {
+ test(1, 2.0);
+ }
+}
+''');
+ }
+
+ void test_addMissingParameter_method_required_hasZero() {
+ resolveTestUnit('''
+class A {
+ test() {}
+ main() {
+ test(1);
+ }
+}
+''');
+ assertHasFix(DartFixKind.ADD_MISSING_PARAMETER_REQUIRED, '''
+class A {
+ test(int i) {}
+ main() {
+ test(1);
+ }
+}
+''');
+ }
+
void test_addPartOfDirective() {
String partCode = r'''
// Comment first.
@@ -390,7 +492,6 @@ class Test {
}
void test_createClass_inLibraryOfPrefix() {
- // TODO
String libCode = r'''
library my.lib;
« no previous file with comments | « pkg/analysis_server/lib/src/services/correction/fix_internal.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698