| 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/src/analysis_server.dart'; | 9 import 'package:analysis_server/src/analysis_server.dart'; |
| 10 import 'package:analysis_server/src/channel/channel.dart'; | 10 import 'package:analysis_server/src/channel/channel.dart'; |
| (...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 assertHasResult( | 429 assertHasResult( |
| 430 CompletionSuggestionKind.INVOCATION, 'a', DART_RELEVANCE_LOCAL_FIELD); | 430 CompletionSuggestionKind.INVOCATION, 'a', DART_RELEVANCE_LOCAL_FIELD); |
| 431 assertHasResult(CompletionSuggestionKind.INVOCATION, 'b', | 431 assertHasResult(CompletionSuggestionKind.INVOCATION, 'b', |
| 432 DART_RELEVANCE_LOCAL_VARIABLE); | 432 DART_RELEVANCE_LOCAL_VARIABLE); |
| 433 assertHasResult(CompletionSuggestionKind.INVOCATION, 'x', | 433 assertHasResult(CompletionSuggestionKind.INVOCATION, 'x', |
| 434 DART_RELEVANCE_LOCAL_METHOD); | 434 DART_RELEVANCE_LOCAL_METHOD); |
| 435 assertHasResult(CompletionSuggestionKind.INVOCATION, 'DateTime'); | 435 assertHasResult(CompletionSuggestionKind.INVOCATION, 'DateTime'); |
| 436 }); | 436 }); |
| 437 } | 437 } |
| 438 | 438 |
| 439 test_overrides() { |
| 440 addFile('/libA.dart', 'class A {m() {}}'); |
| 441 addTestFile(''' |
| 442 import '/libA.dart'; |
| 443 class B extends A {m() {^}} |
| 444 '''); |
| 445 return getSuggestions().then((_) { |
| 446 expect(replacementOffset, equals(completionOffset)); |
| 447 expect(replacementLength, equals(0)); |
| 448 assertHasResult(CompletionSuggestionKind.INVOCATION, 'm', |
| 449 DART_RELEVANCE_LOCAL_METHOD); |
| 450 }); |
| 451 } |
| 452 |
| 439 test_partFile() { | 453 test_partFile() { |
| 440 addFile('/project/bin/testA.dart', ''' | 454 addFile('/project/bin/testA.dart', ''' |
| 441 library libA; | 455 library libA; |
| 442 part "$testFile"; | 456 part "$testFile"; |
| 443 import 'dart:html'; | 457 import 'dart:html'; |
| 444 class A { } | 458 class A { } |
| 445 '''); | 459 '''); |
| 446 addTestFile(''' | 460 addTestFile(''' |
| 447 part of libA; | 461 part of libA; |
| 448 main() {^}'''); | 462 main() {^}'''); |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 675 } | 689 } |
| 676 '''); | 690 '''); |
| 677 await waitForTasksFinished(); | 691 await waitForTasksFinished(); |
| 678 Request request = | 692 Request request = |
| 679 new CompletionGetSuggestionsParams(testFile, 0).toRequest('0'); | 693 new CompletionGetSuggestionsParams(testFile, 0).toRequest('0'); |
| 680 Response response = handler.handleRequest(request); | 694 Response response = handler.handleRequest(request); |
| 681 expect(response.error, isNotNull); | 695 expect(response.error, isNotNull); |
| 682 expect(response.error.code, RequestErrorCode.NO_INDEX_GENERATED); | 696 expect(response.error.code, RequestErrorCode.NO_INDEX_GENERATED); |
| 683 } | 697 } |
| 684 } | 698 } |
| OLD | NEW |