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

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

Issue 1531353002: report invalid param if offset is out of bounds (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: merge Created 5 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
« no previous file with comments | « pkg/analysis_server/lib/src/services/completion/dart_completion_manager.dart ('k') | no next file » | 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/analysis_server.dart'; 10 import 'package:analysis_server/src/analysis_server.dart';
(...skipping 667 matching lines...) Expand 10 before | Expand all | Expand 10 after
678 assertHasResult(CompletionSuggestionKind.INVOCATION, 'b', 678 assertHasResult(CompletionSuggestionKind.INVOCATION, 'b',
679 relevance: DART_RELEVANCE_LOCAL_VARIABLE); 679 relevance: DART_RELEVANCE_LOCAL_VARIABLE);
680 assertHasResult(CompletionSuggestionKind.INVOCATION, 'x', 680 assertHasResult(CompletionSuggestionKind.INVOCATION, 'x',
681 relevance: DART_RELEVANCE_LOCAL_METHOD); 681 relevance: DART_RELEVANCE_LOCAL_METHOD);
682 assertHasResult(CompletionSuggestionKind.INVOCATION, 'DateTime'); 682 assertHasResult(CompletionSuggestionKind.INVOCATION, 'DateTime');
683 }); 683 });
684 } 684 }
685 685
686 test_offset_past_eof() { 686 test_offset_past_eof() {
687 addTestFile('main() { }', offset: 300); 687 addTestFile('main() { }', offset: 300);
688 return getSuggestions().then((_) { 688 Request request =
689 expect(replacementOffset, equals(300)); 689 new CompletionGetSuggestionsParams(testFile, completionOffset)
690 expect(replacementLength, equals(0)); 690 .toRequest('0');
691 expect(suggestionsDone, true); 691 Response response = handler.handleRequest(request);
692 expect(suggestions.length, 0); 692 expect(response.id, '0');
693 }); 693 expect(response.error.code, RequestErrorCode.INVALID_PARAMETER);
694 } 694 }
695 695
696 test_overrides() { 696 test_overrides() {
697 addFile('/libA.dart', 'class A {m() {}}'); 697 addFile('/libA.dart', 'class A {m() {}}');
698 addTestFile(''' 698 addTestFile('''
699 import '/libA.dart'; 699 import '/libA.dart';
700 class B extends A {m() {^}} 700 class B extends A {m() {^}}
701 '''); 701 ''');
702 return getSuggestions().then((_) { 702 return getSuggestions().then((_) {
703 expect(replacementOffset, equals(completionOffset)); 703 expect(replacementOffset, equals(completionOffset));
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
989 } 989 }
990 '''); 990 ''');
991 await waitForTasksFinished(); 991 await waitForTasksFinished();
992 Request request = 992 Request request =
993 new CompletionGetSuggestionsParams(testFile, 0).toRequest('0'); 993 new CompletionGetSuggestionsParams(testFile, 0).toRequest('0');
994 Response response = handler.handleRequest(request); 994 Response response = handler.handleRequest(request);
995 expect(response.error, isNotNull); 995 expect(response.error, isNotNull);
996 expect(response.error.code, RequestErrorCode.NO_INDEX_GENERATED); 996 expect(response.error.code, RequestErrorCode.NO_INDEX_GENERATED);
997 } 997 }
998 } 998 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/services/completion/dart_completion_manager.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698