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

Unified Diff: pkg/analysis_server/test/services/completion/dart/arglist_contributor_test.dart

Issue 2671533002: complete named params in constructors (Closed)
Patch Set: merge Created 3 years, 11 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
Index: pkg/analysis_server/test/services/completion/dart/arglist_contributor_test.dart
diff --git a/pkg/analysis_server/test/services/completion/dart/arglist_contributor_test.dart b/pkg/analysis_server/test/services/completion/dart/arglist_contributor_test.dart
index 5d7c0856c0968a4258796e877ae29dffe980ba77..6332eebde90d0a4f6823e7fef53cc16d8cf0bf5c 100644
--- a/pkg/analysis_server/test/services/completion/dart/arglist_contributor_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/arglist_contributor_test.dart
@@ -229,7 +229,7 @@ class A { const A(int one, int two, int three, {int four, String five:
}
test_ArgumentList_imported_constructor_named_param() async {
- //
+ // ArgumentList InstanceCreationExpression ExpressionStatement
addSource('/libA.dart', 'library libA; class A{A({int one}); }');
addTestSource('import "/libA.dart"; main() { new A(^);}');
await computeSuggestions();
@@ -237,7 +237,7 @@ class A { const A(int one, int two, int three, {int four, String five:
}
test_ArgumentList_imported_constructor_named_param2() async {
- //
+ // ArgumentList InstanceCreationExpression ExpressionStatement
addSource('/libA.dart', 'library libA; class A{A.foo({int one}); }');
addTestSource('import "/libA.dart"; main() { new A.foo(^);}');
await computeSuggestions();
@@ -245,7 +245,7 @@ class A { const A(int one, int two, int three, {int four, String five:
}
test_ArgumentList_imported_constructor_named_typed_param() async {
- //
+ // ArgumentList InstanceCreationExpression VariableDeclaration
addSource(
'/libA.dart', 'library libA; class A { A({int i, String s, d}) {} }}');
addTestSource('import "/libA.dart"; main() { var a = new A(^);}');
@@ -254,6 +254,32 @@ class A { const A(int one, int two, int three, {int four, String five:
namedArgumentsWithTypes: {'i': 'int', 's': 'String', 'd': 'dynamic'});
}
+ test_ArgumentList_imported_factory_named_param() async {
+ // ArgumentList InstanceCreationExpression ExpressionStatement
+ addSource('/libA.dart', 'library libA; class A{factory A({int one}) => null;}');
+ addTestSource('import "/libA.dart"; main() { new A(^);}');
+ await computeSuggestions();
+ assertSuggestArgumentsAndTypes(namedArgumentsWithTypes: {'one': 'int'});
+ }
+
+ test_ArgumentList_imported_factory_named_param2() async {
+ // ArgumentList InstanceCreationExpression ExpressionStatement
+ addSource('/libA.dart', 'library libA; abstract class A{factory A.foo({int one});}');
+ addTestSource('import "/libA.dart"; main() { new A.foo(^);}');
+ await computeSuggestions();
+ assertSuggestArgumentsAndTypes(namedArgumentsWithTypes: {'one': 'int'});
+ }
+
+ test_ArgumentList_imported_factory_named_typed_param() async {
+ // ArgumentList InstanceCreationExpression VariableDeclaration
+ addSource('/libA.dart',
+ 'library libA; class A {factory A({int i, String s, d}) {} }}');
+ addTestSource('import "/libA.dart"; main() { var a = new A(^);}');
+ await computeSuggestions();
+ assertSuggestArgumentsAndTypes(
+ namedArgumentsWithTypes: {'i': 'int', 's': 'String', 'd': 'dynamic'});
+ }
+
test_ArgumentList_imported_function_0() async {
// ArgumentList MethodInvocation ExpressionStatement Block
addSource(

Powered by Google App Engine
This is Rietveld 408576698