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/services/correction/assist_test.dart

Issue 2955913002: Fixes and tests for adding library imports. (Closed)
Patch Set: Created 3 years, 5 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/correction/fix_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 import 'dart:async'; 5 import 'dart:async';
6 6
7 import 'package:analysis_server/plugin/edit/assist/assist_core.dart'; 7 import 'package:analysis_server/plugin/edit/assist/assist_core.dart';
8 import 'package:analysis_server/plugin/edit/assist/assist_dart.dart'; 8 import 'package:analysis_server/plugin/edit/assist/assist_dart.dart';
9 import 'package:analysis_server/src/plugin/server_plugin.dart'; 9 import 'package:analysis_server/src/plugin/server_plugin.dart';
10 import 'package:analysis_server/src/services/correction/assist.dart'; 10 import 'package:analysis_server/src/services/correction/assist.dart';
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 main() { 328 main() {
329 for (var future in getFutures()) { 329 for (var future in getFutures()) {
330 } 330 }
331 } 331 }
332 '''); 332 ''');
333 await assertHasAssistAt( 333 await assertHasAssistAt(
334 'future in', 334 'future in',
335 DartAssistKind.ADD_TYPE_ANNOTATION, 335 DartAssistKind.ADD_TYPE_ANNOTATION,
336 ''' 336 '''
337 import 'dart:async'; 337 import 'dart:async';
338
338 import 'my_lib.dart'; 339 import 'my_lib.dart';
339 main() { 340 main() {
340 for (Future<int> future in getFutures()) { 341 for (Future<int> future in getFutures()) {
341 } 342 }
342 } 343 }
343 '''); 344 ''');
344 } 345 }
345 346
346 test_addTypeAnnotation_declaredIdentifier_OK_final() async { 347 test_addTypeAnnotation_declaredIdentifier_OK_final() async {
347 await resolveTestUnit(''' 348 await resolveTestUnit('''
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 import 'my_lib.dart'; 478 import 'my_lib.dart';
478 main() { 479 main() {
479 var v = getFutureInt(); 480 var v = getFutureInt();
480 } 481 }
481 '''); 482 ''');
482 await assertHasAssistAt( 483 await assertHasAssistAt(
483 'v =', 484 'v =',
484 DartAssistKind.ADD_TYPE_ANNOTATION, 485 DartAssistKind.ADD_TYPE_ANNOTATION,
485 ''' 486 '''
486 import 'dart:async'; 487 import 'dart:async';
488
487 import 'my_lib.dart'; 489 import 'my_lib.dart';
488 main() { 490 main() {
489 Future<int> v = getFutureInt(); 491 Future<int> v = getFutureInt();
490 } 492 }
491 '''); 493 ''');
492 } 494 }
493 495
494 test_addTypeAnnotation_local_OK_addImport_notLibraryUnit() async { 496 test_addTypeAnnotation_local_OK_addImport_notLibraryUnit() async {
495 // prepare library 497 // prepare library
496 addSource( 498 addSource(
(...skipping 25 matching lines...) Expand all
522 change = assist.change; 524 change = assist.change;
523 // verify 525 // verify
524 { 526 {
525 var testFileEdit = change.getFileEdit('/app.dart'); 527 var testFileEdit = change.getFileEdit('/app.dart');
526 var resultCode = SourceEdit.applySequence(appCode, testFileEdit.edits); 528 var resultCode = SourceEdit.applySequence(appCode, testFileEdit.edits);
527 expect( 529 expect(
528 resultCode, 530 resultCode,
529 ''' 531 '''
530 library my_app; 532 library my_app;
531 import 'dart:async'; 533 import 'dart:async';
534
532 import 'my_lib.dart'; 535 import 'my_lib.dart';
533 part 'test.dart'; 536 part 'test.dart';
534 '''); 537 ''');
535 } 538 }
536 { 539 {
537 var testFileEdit = change.getFileEdit('/test.dart'); 540 var testFileEdit = change.getFileEdit('/test.dart');
538 var resultCode = SourceEdit.applySequence(testCode, testFileEdit.edits); 541 var resultCode = SourceEdit.applySequence(testCode, testFileEdit.edits);
539 expect( 542 expect(
540 resultCode, 543 resultCode,
541 ''' 544 '''
(...skipping 4214 matching lines...) Expand 10 before | Expand all | Expand 10 after
4756 4759
4757 @override 4760 @override
4758 final AstProvider astProvider; 4761 final AstProvider astProvider;
4759 4762
4760 @override 4763 @override
4761 final CompilationUnit unit; 4764 final CompilationUnit unit;
4762 4765
4763 _DartAssistContextForValues(this.source, this.selectionOffset, 4766 _DartAssistContextForValues(this.source, this.selectionOffset,
4764 this.selectionLength, this.analysisDriver, this.astProvider, this.unit); 4767 this.selectionLength, this.analysisDriver, this.astProvider, this.unit);
4765 } 4768 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analysis_server/test/services/correction/fix_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698