| 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 c4358484e10200b10d4ae34902838cf58ad98508..db178595d3a7940e5b06b3157098a4e80c49fd4a 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
|
| @@ -77,16 +77,19 @@ class ArgListContributorTest extends DartCompletionContributorTest {
|
| }
|
|
|
| /**
|
| - * Assert that the specified named argument suggestions are the only
|
| - * suggestions.
|
| + * Assert that the specified named argument suggestions with their types are
|
| + * the only suggestions.
|
| */
|
| - void assertSuggestArguments({List<String> namedArguments}) {
|
| + void assertSuggestArgumentsAndTypes(
|
| + {Map<String, String> namedArgumentsWithTypes}) {
|
| List<CompletionSuggestion> expected = new List<CompletionSuggestion>();
|
| - for (String name in namedArguments) {
|
| + namedArgumentsWithTypes.forEach((String name, String type) {
|
| expected.add(assertSuggest('$name: ',
|
| csKind: CompletionSuggestionKind.NAMED_ARGUMENT,
|
| - relevance: DART_RELEVANCE_NAMED_PARAMETER));
|
| - }
|
| + relevance: DART_RELEVANCE_NAMED_PARAMETER,
|
| + paramName: name,
|
| + paramType: type));
|
| + });
|
| assertNoOtherSuggestions(expected);
|
| }
|
|
|
| @@ -131,7 +134,8 @@ class A { const A({int one, String two: 'defaultValue'}); }
|
| library libA; class A { const A({int one, String two: 'defaultValue'}); }''');
|
| addTestSource('import "/libA.dart"; @A(^) main() { }');
|
| await computeSuggestions();
|
| - assertSuggestArguments(namedArguments: ['one', 'two']);
|
| + assertSuggestArgumentsAndTypes(
|
| + namedArgumentsWithTypes: {'one': 'int', 'two': 'String'});
|
| }
|
|
|
| test_Annotation_local_constructor_named_param() async {
|
| @@ -139,7 +143,8 @@ library libA; class A { const A({int one, String two: 'defaultValue'}); }''');
|
| class A { const A({int one, String two: 'defaultValue'}); }
|
| @A(^) main() { }''');
|
| await computeSuggestions();
|
| - assertSuggestArguments(namedArguments: ['one', 'two']);
|
| + assertSuggestArgumentsAndTypes(
|
| + namedArgumentsWithTypes: {'one': 'int', 'two': 'String'});
|
| }
|
|
|
| test_Annotation_local_constructor_named_param_11() async {
|
| @@ -147,7 +152,7 @@ class A { const A({int one, String two: 'defaultValue'}); }
|
| class A { const A({int one, String two: 'defaultValue'}); }
|
| @A(two: '2', ^) main() { }''');
|
| await computeSuggestions();
|
| - assertSuggestArguments(namedArguments: ['one']);
|
| + assertSuggestArgumentsAndTypes(namedArgumentsWithTypes: {'one': 'int'});
|
| }
|
|
|
| test_Annotation_local_constructor_named_param_2() async {
|
| @@ -171,7 +176,7 @@ class A { const A({int one, String two: 'defaultValue'}); }
|
| class A { const A({int one, String two: 'defaultValue'}); }
|
| @A(^, two: '2') main() { }''');
|
| await computeSuggestions();
|
| - assertSuggestArguments(namedArguments: ['one']);
|
| + assertSuggestArgumentsAndTypes(namedArgumentsWithTypes: {'one': 'int'});
|
| }
|
|
|
| test_Annotation_local_constructor_named_param_5() async {
|
| @@ -179,7 +184,7 @@ class A { const A({int one, String two: 'defaultValue'}); }
|
| class A { const A({int one, String two: 'defaultValue'}); }
|
| @A(^ , two: '2') main() { }''');
|
| await computeSuggestions();
|
| - assertSuggestArguments(namedArguments: ['one']);
|
| + assertSuggestArgumentsAndTypes(namedArgumentsWithTypes: {'one': 'int'});
|
| }
|
|
|
| test_Annotation_local_constructor_named_param_6() async {
|
| @@ -187,7 +192,7 @@ class A { const A({int one, String two: 'defaultValue'}); }
|
| class A { const A(int zero, {int one, String two: 'defaultValue'}); }
|
| @A(0, ^, two: '2') main() { }''');
|
| await computeSuggestions();
|
| - assertSuggestArguments(namedArguments: ['one']);
|
| + assertSuggestArgumentsAndTypes(namedArgumentsWithTypes: {'one': 'int'});
|
| }
|
|
|
| test_Annotation_local_constructor_named_param_7() async {
|
| @@ -226,7 +231,7 @@ class A { const A(int one, int two, int three, {int four, String five:
|
| addSource('/libA.dart', 'library libA; class A{A({int one}); }');
|
| addTestSource('import "/libA.dart"; main() { new A(^);}');
|
| await computeSuggestions();
|
| - assertSuggestArguments(namedArguments: ['one']);
|
| + assertSuggestArgumentsAndTypes(namedArgumentsWithTypes: {'one': 'int'});
|
| }
|
|
|
| test_ArgumentList_imported_constructor_named_param2() async {
|
| @@ -234,7 +239,17 @@ class A { const A(int one, int two, int three, {int four, String five:
|
| addSource('/libA.dart', 'library libA; class A{A.foo({int one}); }');
|
| addTestSource('import "/libA.dart"; main() { new A.foo(^);}');
|
| await computeSuggestions();
|
| - assertSuggestArguments(namedArguments: ['one']);
|
| + assertSuggestArgumentsAndTypes(namedArgumentsWithTypes: {'one': 'int'});
|
| + }
|
| +
|
| + test_ArgumentList_imported_constructor_named_typed_param() async {
|
| + //
|
| + addSource(
|
| + '/libA.dart', 'library libA; class A { 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 {
|
| @@ -385,21 +400,24 @@ class A { const A(int one, int two, int three, {int four, String five:
|
| //
|
| addTestSource('main() { int.parse("16", ^);}');
|
| await computeSuggestions();
|
| - assertSuggestArguments(namedArguments: ['radix', 'onError']);
|
| + assertSuggestArgumentsAndTypes(
|
| + namedArgumentsWithTypes: {'radix': 'int', 'onError': '(String) → int'});
|
| }
|
|
|
| test_ArgumentList_imported_function_named_param1() async {
|
| //
|
| addTestSource('main() { int.parse("16", r^);}');
|
| await computeSuggestions();
|
| - assertSuggestArguments(namedArguments: ['radix', 'onError']);
|
| + assertSuggestArgumentsAndTypes(
|
| + namedArgumentsWithTypes: {'radix': 'int', 'onError': '(String) → int'});
|
| }
|
|
|
| test_ArgumentList_imported_function_named_param2() async {
|
| //
|
| addTestSource('main() { int.parse("16", radix: 7, ^);}');
|
| await computeSuggestions();
|
| - assertSuggestArguments(namedArguments: ['onError']);
|
| + assertSuggestArgumentsAndTypes(
|
| + namedArgumentsWithTypes: {'onError': '(String) → int'});
|
| }
|
|
|
| test_ArgumentList_imported_function_named_param2a() async {
|
| @@ -413,7 +431,8 @@ class A { const A(int one, int two, int three, {int four, String five:
|
| //
|
| addTestSource('main() { int.parse("16", r^: 16);}');
|
| await computeSuggestions();
|
| - assertSuggestArguments(namedArguments: ['radix', 'onError']);
|
| + assertSuggestArgumentsAndTypes(
|
| + namedArgumentsWithTypes: {'radix': 'int', 'onError': '(String) → int'});
|
| }
|
|
|
| test_ArgumentList_imported_function_named_param_label2() async {
|
| @@ -427,7 +446,8 @@ class A { const A(int one, int two, int three, {int four, String five:
|
| //
|
| addTestSource('main() { int.parse("16", ^: 16);}');
|
| await computeSuggestions();
|
| - assertSuggestArguments(namedArguments: ['radix', 'onError']);
|
| + assertSuggestArgumentsAndTypes(
|
| + namedArgumentsWithTypes: {'radix': 'int', 'onError': '(String) → int'});
|
| }
|
|
|
| test_ArgumentList_local_constructor_named_param() async {
|
| @@ -436,7 +456,8 @@ class A { const A(int one, int two, int three, {int four, String five:
|
| class A { A({int one, String two: 'defaultValue'}) { } }
|
| main() { new A(^);}''');
|
| await computeSuggestions();
|
| - assertSuggestArguments(namedArguments: ['one', 'two']);
|
| + assertSuggestArgumentsAndTypes(
|
| + namedArgumentsWithTypes: {'one': 'int', 'two': 'String'});
|
| }
|
|
|
| test_ArgumentList_local_constructor_named_param2() async {
|
| @@ -445,7 +466,8 @@ main() { new A(^);}''');
|
| class A { A.foo({int one, String two: 'defaultValue'}) { } }
|
| main() { new A.foo(^);}''');
|
| await computeSuggestions();
|
| - assertSuggestArguments(namedArguments: ['one', 'two']);
|
| + assertSuggestArgumentsAndTypes(
|
| + namedArgumentsWithTypes: {'one': 'int', 'two': 'String'});
|
| }
|
|
|
| test_ArgumentList_local_function_1() async {
|
| @@ -538,7 +560,8 @@ main() { new A.foo(^);}''');
|
| f(v,{int radix, int onError(String s)}){}
|
| main() { f("16", ^);}''');
|
| await computeSuggestions();
|
| - assertSuggestArguments(namedArguments: ['radix', 'onError']);
|
| + assertSuggestArgumentsAndTypes(
|
| + namedArgumentsWithTypes: {'radix': 'int', 'onError': '(String) → int'});
|
| }
|
|
|
| test_ArgumentList_local_function_named_param1() async {
|
| @@ -547,7 +570,8 @@ main() { f("16", ^);}''');
|
| f(v,{int radix, int onError(String s)}){}
|
| main() { f("16", r^);}''');
|
| await computeSuggestions();
|
| - assertSuggestArguments(namedArguments: ['radix', 'onError']);
|
| + assertSuggestArgumentsAndTypes(
|
| + namedArgumentsWithTypes: {'radix': 'int', 'onError': '(String) → int'});
|
| }
|
|
|
| test_ArgumentList_local_function_named_param2() async {
|
| @@ -556,7 +580,8 @@ main() { f("16", r^);}''');
|
| f(v,{int radix, int onError(String s)}){}
|
| main() { f("16", radix: 7, ^);}''');
|
| await computeSuggestions();
|
| - assertSuggestArguments(namedArguments: ['onError']);
|
| + assertSuggestArgumentsAndTypes(
|
| + namedArgumentsWithTypes: {'onError': '(String) → int'});
|
| }
|
|
|
| test_ArgumentList_local_function_named_param2a() async {
|
|
|