| 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/completion/completion_core.dart' | 9 import 'package:analysis_server/completion/completion_core.dart' |
| 10 show CompletionRequest; | 10 show CompletionRequest; |
| (...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 assertHasResult(CompletionSuggestionKind.INVOCATION, 'b'); | 404 assertHasResult(CompletionSuggestionKind.INVOCATION, 'b'); |
| 405 }); | 405 }); |
| 406 } | 406 } |
| 407 | 407 |
| 408 test_keyword() { | 408 test_keyword() { |
| 409 addTestFile('library A; cl^'); | 409 addTestFile('library A; cl^'); |
| 410 return getSuggestions().then((_) { | 410 return getSuggestions().then((_) { |
| 411 expect(replacementOffset, equals(completionOffset - 2)); | 411 expect(replacementOffset, equals(completionOffset - 2)); |
| 412 expect(replacementLength, equals(2)); | 412 expect(replacementLength, equals(2)); |
| 413 assertHasResult( | 413 assertHasResult( |
| 414 CompletionSuggestionKind.KEYWORD, 'import', DART_RELEVANCE_HIGH); | 414 CompletionSuggestionKind.KEYWORD, 'export', DART_RELEVANCE_HIGH); |
| 415 assertHasResult( | 415 assertHasResult( |
| 416 CompletionSuggestionKind.KEYWORD, 'class', DART_RELEVANCE_HIGH); | 416 CompletionSuggestionKind.KEYWORD, 'class', DART_RELEVANCE_HIGH); |
| 417 }); | 417 }); |
| 418 } | 418 } |
| 419 | 419 |
| 420 test_local_named_constructor() { | 420 test_local_named_constructor() { |
| 421 addTestFile('class A {A.c(); x() {new A.^}}'); | 421 addTestFile('class A {A.c(); x() {new A.^}}'); |
| 422 return getSuggestions().then((_) { | 422 return getSuggestions().then((_) { |
| 423 expect(replacementOffset, equals(completionOffset)); | 423 expect(replacementOffset, equals(completionOffset)); |
| 424 expect(replacementLength, equals(0)); | 424 expect(replacementLength, equals(0)); |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 712 } | 712 } |
| 713 '''); | 713 '''); |
| 714 await waitForTasksFinished(); | 714 await waitForTasksFinished(); |
| 715 Request request = | 715 Request request = |
| 716 new CompletionGetSuggestionsParams(testFile, 0).toRequest('0'); | 716 new CompletionGetSuggestionsParams(testFile, 0).toRequest('0'); |
| 717 Response response = handler.handleRequest(request); | 717 Response response = handler.handleRequest(request); |
| 718 expect(response.error, isNotNull); | 718 expect(response.error, isNotNull); |
| 719 expect(response.error.code, RequestErrorCode.NO_INDEX_GENERATED); | 719 expect(response.error.code, RequestErrorCode.NO_INDEX_GENERATED); |
| 720 } | 720 } |
| 721 } | 721 } |
| OLD | NEW |