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

Side by Side Diff: pkg/analysis_server/test/domain_completion_test.dart

Issue 2671533002: complete named params in constructors (Closed)
Patch Set: merge Created 3 years, 10 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library test.domain.completion; 5 library test.domain.completion;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:analysis_server/plugin/protocol/protocol.dart'; 9 import 'package:analysis_server/plugin/protocol/protocol.dart';
10 import 'package:analysis_server/src/domain_completion.dart'; 10 import 'package:analysis_server/src/domain_completion.dart';
(...skipping 10 matching lines...) Expand all
21 21
22 main() { 22 main() {
23 defineReflectiveSuite(() { 23 defineReflectiveSuite(() {
24 defineReflectiveTests(CompletionDomainHandlerTest); 24 defineReflectiveTests(CompletionDomainHandlerTest);
25 defineReflectiveTests(_NoSearchEngine); 25 defineReflectiveTests(_NoSearchEngine);
26 }); 26 });
27 } 27 }
28 28
29 @reflectiveTest 29 @reflectiveTest
30 class CompletionDomainHandlerTest extends AbstractCompletionDomainTest { 30 class CompletionDomainHandlerTest extends AbstractCompletionDomainTest {
31 test_ArgumentList_constructor_named_param_label() async {
32 addTestFile('main() { new A(^);}'
33 'class A { A({one, two}) {} }');
34 await getSuggestions();
35 assertHasResult(CompletionSuggestionKind.NAMED_ARGUMENT, 'one: ',
36 relevance: DART_RELEVANCE_NAMED_PARAMETER);
37 assertHasResult(CompletionSuggestionKind.NAMED_ARGUMENT, 'two: ',
38 relevance: DART_RELEVANCE_NAMED_PARAMETER);
39 expect(suggestions, hasLength(2));
40 }
41
42 test_ArgumentList_factory_named_param_label() async {
43 addTestFile('main() { new A(^);}'
44 'class A { factory A({one, two}) => null; }');
45 await getSuggestions();
46 assertHasResult(CompletionSuggestionKind.NAMED_ARGUMENT, 'one: ',
47 relevance: DART_RELEVANCE_NAMED_PARAMETER);
48 assertHasResult(CompletionSuggestionKind.NAMED_ARGUMENT, 'two: ',
49 relevance: DART_RELEVANCE_NAMED_PARAMETER);
50 expect(suggestions, hasLength(2));
51 }
52
31 test_ArgumentList_imported_function_named_param() async { 53 test_ArgumentList_imported_function_named_param() async {
32 addTestFile('main() { int.parse("16", ^);}'); 54 addTestFile('main() { int.parse("16", ^);}');
33 await getSuggestions(); 55 await getSuggestions();
34 assertHasResult(CompletionSuggestionKind.NAMED_ARGUMENT, 'radix: ', 56 assertHasResult(CompletionSuggestionKind.NAMED_ARGUMENT, 'radix: ',
35 relevance: DART_RELEVANCE_NAMED_PARAMETER); 57 relevance: DART_RELEVANCE_NAMED_PARAMETER);
36 assertHasResult(CompletionSuggestionKind.NAMED_ARGUMENT, 'onError: ', 58 assertHasResult(CompletionSuggestionKind.NAMED_ARGUMENT, 'onError: ',
37 relevance: DART_RELEVANCE_NAMED_PARAMETER); 59 relevance: DART_RELEVANCE_NAMED_PARAMETER);
38 expect(suggestions, hasLength(2)); 60 expect(suggestions, hasLength(2));
39 } 61 }
40 62
(...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after
606 } 628 }
607 '''); 629 ''');
608 await waitForTasksFinished(); 630 await waitForTasksFinished();
609 Request request = 631 Request request =
610 new CompletionGetSuggestionsParams(testFile, 0).toRequest('0'); 632 new CompletionGetSuggestionsParams(testFile, 0).toRequest('0');
611 Response response = handler.handleRequest(request); 633 Response response = handler.handleRequest(request);
612 expect(response.error, isNotNull); 634 expect(response.error, isNotNull);
613 expect(response.error.code, RequestErrorCode.NO_INDEX_GENERATED); 635 expect(response.error.code, RequestErrorCode.NO_INDEX_GENERATED);
614 } 636 }
615 } 637 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698