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

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

Issue 545323002: Add error condition INVALID_OVERLAY_CHANGE to analysis server. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 3 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 | 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.analysis; 5 library test.domain.analysis;
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/constants.dart'; 10 import 'package:analysis_server/src/constants.dart';
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 // reread from disk. 255 // reread from disk.
256 helper.sendContentChange(new RemoveContentOverlay()); 256 helper.sendContentChange(new RemoveContentOverlay());
257 // There should be errors now. 257 // There should be errors now.
258 return helper.waitForOperationsFinished().then((_) { 258 return helper.waitForOperationsFinished().then((_) {
259 expect(helper.getTestErrors(), hasLength(1)); 259 expect(helper.getTestErrors(), hasLength(1));
260 }); 260 });
261 }); 261 });
262 }); 262 });
263 }); 263 });
264 }); 264 });
265
266 group('out of range', () {
267 Future outOfRangeTest(SourceEdit edit) {
268 AnalysisTestHelper helper = new AnalysisTestHelper();
269 helper.createSingleFileProject('library A;');
270 return helper.waitForOperationsFinished().then((_) {
271 helper.sendContentChange(new AddContentOverlay('library B;'));
272 return helper.waitForOperationsFinished().then((_) {
273 ChangeContentOverlay contentChange = new ChangeContentOverlay([edit]);
274 Request request = new AnalysisUpdateContentParams({
275 helper.testFile: contentChange}).toRequest('0');
276 Response response = helper.handler.handleRequest(request);
277 expect(response, isResponseFailure('0',
278 RequestErrorCode.INVALID_OVERLAY_CHANGE));
279 });
280 });
281 }
282
283 test('negative length', () {
284 return outOfRangeTest(new SourceEdit(3, -1, 'foo'));
285 });
286
287 test('negative offset', () {
288 return outOfRangeTest(new SourceEdit(-1, 3, 'foo'));
289 });
290
291 test('beyond end', () {
292 return outOfRangeTest(new SourceEdit(6, 6, 'foo'));
293 });
294 });
265 } 295 }
266 296
267 297
268 void test_setSubscriptions() { 298 void test_setSubscriptions() {
269 test('before analysis', () { 299 test('before analysis', () {
270 AnalysisTestHelper helper = new AnalysisTestHelper(); 300 AnalysisTestHelper helper = new AnalysisTestHelper();
271 // subscribe 301 // subscribe
272 helper.addAnalysisSubscriptionHighlights(helper.testFile); 302 helper.addAnalysisSubscriptionHighlights(helper.testFile);
273 // create project 303 // create project
274 helper.createSingleFileProject('int V = 42;'); 304 helper.createSingleFileProject('int V = 42;');
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
607 return waitForServerOperationsPerformed(server); 637 return waitForServerOperationsPerformed(server);
608 } 638 }
609 639
610 static String _getCodeString(code) { 640 static String _getCodeString(code) {
611 if (code is List<String>) { 641 if (code is List<String>) {
612 code = code.join('\n'); 642 code = code.join('\n');
613 } 643 }
614 return code as String; 644 return code as String;
615 } 645 }
616 } 646 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/protocol.dart ('k') | pkg/analysis_server/test/integration/protocol_matchers.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698