Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(228)

Side by Side Diff: pkg/analysis_server/test/domain_completion_test.dart

Issue 803913003: fix named constructor completion (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698