| OLD | NEW |
| 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/analysis_server.dart'; | 10 import 'package:analysis_server/src/analysis_server.dart'; |
| (...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 576 | 576 |
| 577 test_inDartDoc2() async { | 577 test_inDartDoc2() async { |
| 578 addTestFile(''' | 578 addTestFile(''' |
| 579 /// Some text^ | 579 /// Some text^ |
| 580 main(aaa, bbb) {} | 580 main(aaa, bbb) {} |
| 581 '''); | 581 '''); |
| 582 await getSuggestions(); | 582 await getSuggestions(); |
| 583 expect(suggestions, isEmpty); | 583 expect(suggestions, isEmpty); |
| 584 } | 584 } |
| 585 | 585 |
| 586 test_inDartDoc_reference2() async { | 586 test_inDartDoc_reference1() async { |
| 587 addFile( |
| 588 '/testA.dart', |
| 589 ''' |
| 590 part of libA; |
| 591 foo(bar) => 0;'''); |
| 587 addTestFile(''' | 592 addTestFile(''' |
| 593 library libA; |
| 594 part "/testA.dart"; |
| 595 import "dart:math"; |
| 588 /// The [^] | 596 /// The [^] |
| 589 main(aaa, bbb) {} | 597 main(aaa, bbb) {} |
| 590 '''); | 598 '''); |
| 591 await getSuggestions(); | 599 await getSuggestions(); |
| 592 assertHasResult(CompletionSuggestionKind.INVOCATION, 'main', | 600 assertHasResult(CompletionSuggestionKind.IDENTIFIER, 'main', |
| 593 relevance: DART_RELEVANCE_LOCAL_FUNCTION); | 601 relevance: DART_RELEVANCE_LOCAL_FUNCTION); |
| 594 assertHasResult(CompletionSuggestionKind.INVOCATION, 'Object'); | 602 assertHasResult(CompletionSuggestionKind.IDENTIFIER, 'foo', |
| 603 relevance: DART_RELEVANCE_LOCAL_FUNCTION); |
| 604 assertHasResult(CompletionSuggestionKind.IDENTIFIER, 'min'); |
| 595 } | 605 } |
| 596 | 606 |
| 597 test_inDartDoc_reference3() async { | 607 test_inDartDoc_reference2() async { |
| 598 addTestFile(''' | 608 addTestFile(''' |
| 599 /// The [m^] | 609 /// The [m^] |
| 600 main(aaa, bbb) {} | 610 main(aaa, bbb) {} |
| 601 '''); | 611 '''); |
| 602 await getSuggestions(); | 612 await getSuggestions(); |
| 603 assertHasResult(CompletionSuggestionKind.INVOCATION, 'main', | 613 assertHasResult(CompletionSuggestionKind.IDENTIFIER, 'main', |
| 604 relevance: DART_RELEVANCE_LOCAL_FUNCTION); | 614 relevance: DART_RELEVANCE_LOCAL_FUNCTION); |
| 605 } | 615 } |
| 606 | 616 |
| 607 test_inherited() { | 617 test_inherited() { |
| 608 addFile('/libA.dart', 'class A {m() {}}'); | 618 addFile('/libA.dart', 'class A {m() {}}'); |
| 609 addTestFile(''' | 619 addTestFile(''' |
| 610 import '/libA.dart'; | 620 import '/libA.dart'; |
| 611 class B extends A { | 621 class B extends A { |
| 612 x() {^} | 622 x() {^} |
| 613 } | 623 } |
| (...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 979 } | 989 } |
| 980 '''); | 990 '''); |
| 981 await waitForTasksFinished(); | 991 await waitForTasksFinished(); |
| 982 Request request = | 992 Request request = |
| 983 new CompletionGetSuggestionsParams(testFile, 0).toRequest('0'); | 993 new CompletionGetSuggestionsParams(testFile, 0).toRequest('0'); |
| 984 Response response = handler.handleRequest(request); | 994 Response response = handler.handleRequest(request); |
| 985 expect(response.error, isNotNull); | 995 expect(response.error, isNotNull); |
| 986 expect(response.error.code, RequestErrorCode.NO_INDEX_GENERATED); | 996 expect(response.error.code, RequestErrorCode.NO_INDEX_GENERATED); |
| 987 } | 997 } |
| 988 } | 998 } |
| OLD | NEW |