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

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

Issue 1843513003: tests to assert completion suggestion replacementLength includes entire URI (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: merge Created 4 years, 8 months 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
« no previous file with comments | « no previous file | pkg/analysis_server/test/services/completion/dart/uri_contributor_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/plugin/protocol/protocol.dart'; 9 import 'package:analysis_server/plugin/protocol/protocol.dart';
10 import 'package:analysis_server/src/domain_completion.dart'; 10 import 'package:analysis_server/src/domain_completion.dart';
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 return getSuggestions().then((_) { 505 return getSuggestions().then((_) {
506 expect(replacementOffset, equals(completionOffset - 3)); 506 expect(replacementOffset, equals(completionOffset - 3));
507 expect(replacementLength, equals(4)); 507 expect(replacementLength, equals(4));
508 // Suggestions based upon imported elements are partially filtered 508 // Suggestions based upon imported elements are partially filtered
509 //assertHasResult(CompletionSuggestionKind.INVOCATION, 'Object'); 509 //assertHasResult(CompletionSuggestionKind.INVOCATION, 'Object');
510 assertHasResult(CompletionSuggestionKind.INVOCATION, 'test', 510 assertHasResult(CompletionSuggestionKind.INVOCATION, 'test',
511 relevance: DART_RELEVANCE_LOCAL_TOP_LEVEL_VARIABLE); 511 relevance: DART_RELEVANCE_LOCAL_TOP_LEVEL_VARIABLE);
512 assertNoResult('HtmlElement'); 512 assertNoResult('HtmlElement');
513 }); 513 });
514 } 514 }
515
516 test_import_uri_with_trailing() {
517 addFile('/project/bin/testA.dart', 'library libA;');
518 addTestFile('''
519 import '/project/bin/t^.dart';
520 main() {}''');
521 return getSuggestions().then((_) {
522 expect(replacementOffset, equals(completionOffset - 14));
523 expect(replacementLength, equals(5 + 14));
524 assertHasResult(
525 CompletionSuggestionKind.IMPORT, '/project/bin/testA.dart');
526 assertNoResult('test');
527 });
528 }
515 } 529 }
516 530
517 class MockRelevancySorter implements DartContributionSorter { 531 class MockRelevancySorter implements DartContributionSorter {
518 bool enabled = true; 532 bool enabled = true;
519 533
520 @override 534 @override
521 Future sort( 535 Future sort(
522 CompletionRequest request, Iterable<CompletionSuggestion> suggestions) { 536 CompletionRequest request, Iterable<CompletionSuggestion> suggestions) {
523 if (!enabled) { 537 if (!enabled) {
524 throw 'unexpected sort'; 538 throw 'unexpected sort';
(...skipping 18 matching lines...) Expand all
543 } 557 }
544 '''); 558 ''');
545 await waitForTasksFinished(); 559 await waitForTasksFinished();
546 Request request = 560 Request request =
547 new CompletionGetSuggestionsParams(testFile, 0).toRequest('0'); 561 new CompletionGetSuggestionsParams(testFile, 0).toRequest('0');
548 Response response = handler.handleRequest(request); 562 Response response = handler.handleRequest(request);
549 expect(response.error, isNotNull); 563 expect(response.error, isNotNull);
550 expect(response.error.code, RequestErrorCode.NO_INDEX_GENERATED); 564 expect(response.error.code, RequestErrorCode.NO_INDEX_GENERATED);
551 } 565 }
552 } 566 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analysis_server/test/services/completion/dart/uri_contributor_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698