| 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 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 396 CompletionSuggestionKind.KEYWORD, | 396 CompletionSuggestionKind.KEYWORD, |
| 397 'import', | 397 'import', |
| 398 CompletionRelevance.HIGH); | 398 CompletionRelevance.HIGH); |
| 399 assertHasResult( | 399 assertHasResult( |
| 400 CompletionSuggestionKind.KEYWORD, | 400 CompletionSuggestionKind.KEYWORD, |
| 401 'class', | 401 'class', |
| 402 CompletionRelevance.HIGH); | 402 CompletionRelevance.HIGH); |
| 403 }); | 403 }); |
| 404 } | 404 } |
| 405 | 405 |
| 406 test_local_named_constructor() { |
| 407 addTestFile('class A {A.c(); x() {new A.^}}'); |
| 408 return getSuggestions().then((_) { |
| 409 expect(replacementOffset, equals(completionOffset)); |
| 410 expect(replacementLength, equals(0)); |
| 411 assertHasResult(CompletionSuggestionKind.INVOCATION, 'c'); |
| 412 assertNoResult('A'); |
| 413 }); |
| 414 } |
| 415 |
| 406 test_locals() { | 416 test_locals() { |
| 407 addTestFile('class A {var a; x() {var b;^}}'); | 417 addTestFile('class A {var a; x() {var b;^}}'); |
| 408 return getSuggestions().then((_) { | 418 return getSuggestions().then((_) { |
| 409 expect(replacementOffset, equals(completionOffset)); | 419 expect(replacementOffset, equals(completionOffset)); |
| 410 expect(replacementLength, equals(0)); | 420 expect(replacementLength, equals(0)); |
| 411 assertHasResult(CompletionSuggestionKind.INVOCATION, 'A'); | 421 assertHasResult(CompletionSuggestionKind.INVOCATION, 'A'); |
| 412 assertHasResult(CompletionSuggestionKind.INVOCATION, 'a'); | 422 assertHasResult(CompletionSuggestionKind.INVOCATION, 'a'); |
| 413 assertHasResult(CompletionSuggestionKind.INVOCATION, 'b'); | 423 assertHasResult(CompletionSuggestionKind.INVOCATION, 'b'); |
| 414 assertHasResult(CompletionSuggestionKind.INVOCATION, 'x'); | 424 assertHasResult(CompletionSuggestionKind.INVOCATION, 'x'); |
| 415 }); | 425 }); |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 566 | 576 |
| 567 void contextsChangedRaw(ContextsChangedEvent newEvent) { | 577 void contextsChangedRaw(ContextsChangedEvent newEvent) { |
| 568 super.contextsChanged(newEvent); | 578 super.contextsChanged(newEvent); |
| 569 } | 579 } |
| 570 | 580 |
| 571 CompletionManager createCompletionManager(AnalysisContext context, | 581 CompletionManager createCompletionManager(AnalysisContext context, |
| 572 Source source, SearchEngine searchEngine) { | 582 Source source, SearchEngine searchEngine) { |
| 573 return new MockCompletionManager(mockContext, source, searchEngine); | 583 return new MockCompletionManager(mockContext, source, searchEngine); |
| 574 } | 584 } |
| 575 } | 585 } |
| OLD | NEW |