| 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 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 addTestFile('class A {A.c(); x() {new A.^}}'); | 414 addTestFile('class A {A.c(); x() {new A.^}}'); |
| 415 return getSuggestions().then((_) { | 415 return getSuggestions().then((_) { |
| 416 expect(replacementOffset, equals(completionOffset)); | 416 expect(replacementOffset, equals(completionOffset)); |
| 417 expect(replacementLength, equals(0)); | 417 expect(replacementLength, equals(0)); |
| 418 assertHasResult(CompletionSuggestionKind.INVOCATION, 'c'); | 418 assertHasResult(CompletionSuggestionKind.INVOCATION, 'c'); |
| 419 assertNoResult('A'); | 419 assertNoResult('A'); |
| 420 }); | 420 }); |
| 421 } | 421 } |
| 422 | 422 |
| 423 test_locals() { | 423 test_locals() { |
| 424 addTestFile('class A {var a; x() {var b;^}}'); | 424 addTestFile('class A {var a; x() {var b;^}} class DateTime { }'); |
| 425 return getSuggestions().then((_) { | 425 return getSuggestions().then((_) { |
| 426 expect(replacementOffset, equals(completionOffset)); | 426 expect(replacementOffset, equals(completionOffset)); |
| 427 expect(replacementLength, equals(0)); | 427 expect(replacementLength, equals(0)); |
| 428 assertHasResult(CompletionSuggestionKind.INVOCATION, 'A'); | 428 assertHasResult(CompletionSuggestionKind.INVOCATION, 'A'); |
| 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 }); | 436 }); |
| 436 } | 437 } |
| 437 | 438 |
| 438 test_partFile() { | 439 test_partFile() { |
| 439 addFile('/project/bin/testA.dart', ''' | 440 addFile('/project/bin/testA.dart', ''' |
| 440 library libA; | 441 library libA; |
| 441 part "$testFile"; | 442 part "$testFile"; |
| 442 import 'dart:html'; | 443 import 'dart:html'; |
| 443 class A { } | 444 class A { } |
| 444 '''); | 445 '''); |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 674 } | 675 } |
| 675 '''); | 676 '''); |
| 676 await waitForTasksFinished(); | 677 await waitForTasksFinished(); |
| 677 Request request = | 678 Request request = |
| 678 new CompletionGetSuggestionsParams(testFile, 0).toRequest('0'); | 679 new CompletionGetSuggestionsParams(testFile, 0).toRequest('0'); |
| 679 Response response = handler.handleRequest(request); | 680 Response response = handler.handleRequest(request); |
| 680 expect(response.error, isNotNull); | 681 expect(response.error, isNotNull); |
| 681 expect(response.error.code, RequestErrorCode.NO_INDEX_GENERATED); | 682 expect(response.error.code, RequestErrorCode.NO_INDEX_GENERATED); |
| 682 } | 683 } |
| 683 } | 684 } |
| OLD | NEW |