| 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 679a8791a6ef01168cd71b997fc3e43b3bf04176..e7f4feacd5b4271669e7ce164a0f1c9e84290fa1 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
|
| @@ -79,6 +79,20 @@ class ArgListContributorTest extends DartCompletionContributorTest {
|
| /**
|
| * Assert that the specified suggestions are the only suggestions.
|
| */
|
| + void assertSuggestions(List<String> suggestions) {
|
| + List<CompletionSuggestion> expected = new List<CompletionSuggestion>();
|
| + for (String suggestion in suggestions) {
|
| + expected.add(assertSuggest('$suggestion',
|
| + csKind: CompletionSuggestionKind.NAMED_ARGUMENT,
|
| + relevance: DART_RELEVANCE_NAMED_PARAMETER));
|
| + }
|
| + assertNoOtherSuggestions(expected);
|
| + }
|
| +
|
| + /**
|
| + * Assert that the specified named argument suggestions are the only
|
| + * suggestions.
|
| + */
|
| void assertSuggestArguments({List<String> namedArguments}) {
|
| List<CompletionSuggestion> expected = new List<CompletionSuggestion>();
|
| for (String name in namedArguments) {
|
| @@ -94,6 +108,15 @@ class ArgListContributorTest extends DartCompletionContributorTest {
|
| return new ArgListContributor();
|
| }
|
|
|
| + test_Annotation_local_constructor_named_param_negative() async {
|
| + addTestSource('''
|
| +class A { const A(int one, int two, int three, {int four, String five:
|
| + 'defaultValue'}); }
|
| +@A(1, ^, 3) main() { }''');
|
| + await computeSuggestions();
|
| + assertNoSuggestions();
|
| + }
|
| +
|
| test_Annotation_local_constructor_named_param() async {
|
| addTestSource('''
|
| class A { const A({int one, String two: 'defaultValue'}); }
|
| @@ -102,6 +125,86 @@ class A { const A({int one, String two: 'defaultValue'}); }
|
| assertSuggestArguments(namedArguments: ['one', 'two']);
|
| }
|
|
|
| + test_Annotation_local_constructor_named_param_2() async {
|
| + addTestSource('''
|
| +class A { const A({int one, String two: 'defaultValue'}); }
|
| +@A(^ two: '2') main() { }''');
|
| + await computeSuggestions();
|
| + assertSuggestions(['one: ,']);
|
| + }
|
| +
|
| + test_Annotation_local_constructor_named_param_3() async {
|
| + addTestSource('''
|
| +class A { const A({int one, String two: 'defaultValue'}); }
|
| +@A(^two: '2') main() { }''');
|
| + await computeSuggestions();
|
| + assertSuggestions(['one: ,']);
|
| + }
|
| +
|
| + test_Annotation_local_constructor_named_param_4() async {
|
| + addTestSource('''
|
| +class A { const A({int one, String two: 'defaultValue'}); }
|
| +@A(^, two: '2') main() { }''');
|
| + await computeSuggestions();
|
| + assertSuggestArguments(namedArguments: ['one']);
|
| + }
|
| +
|
| + test_Annotation_local_constructor_named_param_5() async {
|
| + addTestSource('''
|
| +class A { const A({int one, String two: 'defaultValue'}); }
|
| +@A(^ , two: '2') main() { }''');
|
| + await computeSuggestions();
|
| + assertSuggestArguments(namedArguments: ['one']);
|
| + }
|
| +
|
| + test_Annotation_local_constructor_named_param_6() async {
|
| + addTestSource('''
|
| +class A { const A(int zero, {int one, String two: 'defaultValue'}); }
|
| +@A(0, ^, two: '2') main() { }''');
|
| + await computeSuggestions();
|
| + assertSuggestArguments(namedArguments: ['one']);
|
| + }
|
| +
|
| + test_Annotation_local_constructor_named_param_7() async {
|
| + addTestSource('''
|
| +class A { const A(int zero, {int one, String two: 'defaultValue'}); }
|
| +@A(0, ^ two: '2') main() { }''');
|
| + await computeSuggestions();
|
| + assertSuggestions(['one: ,']);
|
| + }
|
| +
|
| + test_Annotation_local_constructor_named_param_8() async {
|
| + addTestSource('''
|
| +class A { const A(int zero, {int one, String two: 'defaultValue'}); }
|
| +@A(0, ^two: '2') main() { }''');
|
| + await computeSuggestions();
|
| + assertSuggestions(['one: ,']);
|
| + }
|
| +
|
| + fail_test_Annotation_local_constructor_named_param_9() async {
|
| + addTestSource('''
|
| +class A { const A({int one, String two: 'defaultValue'}); }
|
| +@A(two: '2'^) main() { }''');
|
| + await computeSuggestions();
|
| + assertSuggestions([', one: ']);
|
| + }
|
| +
|
| + fail_test_Annotation_local_constructor_named_param_10() async {
|
| + addTestSource('''
|
| +class A { const A({int one, String two: 'defaultValue'}); }
|
| +@A(two: '2' ^) main() { }''');
|
| + await computeSuggestions();
|
| + assertSuggestions([', one: ']);
|
| + }
|
| +
|
| + test_Annotation_local_constructor_named_param_11() async {
|
| + addTestSource('''
|
| +class A { const A({int one, String two: 'defaultValue'}); }
|
| +@A(two: '2', ^) main() { }''');
|
| + await computeSuggestions();
|
| + assertSuggestArguments(namedArguments: ['one']);
|
| + }
|
| +
|
| test_Annotation_imported_constructor_named_param() async {
|
| addSource(
|
| '/libA.dart',
|
| @@ -317,7 +420,7 @@ library libA; class A { const A({int one, String two: 'defaultValue'}); }''');
|
| //
|
| addTestSource('main() { int.parse("16", ^r: 16);}');
|
| await computeSuggestions();
|
| - assertSuggestArguments(namedArguments: ['radix', 'onError']);
|
| + assertSuggestions(['radix: ,', 'onError: ,']);
|
| }
|
|
|
| test_ArgumentList_imported_function_named_param_label3() async {
|
|
|