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

Side by Side Diff: pkg/analysis_server/test/services/correction/fix_test.dart

Issue 1492053004: Issue 25095. Add 'Change X to Y type annotation' Quick Fix. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: 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/correction/fix_internal.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.services.correction.fix; 5 library test.services.correction.fix;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:analysis_server/plugin/edit/fix/fix_core.dart'; 9 import 'package:analysis_server/plugin/edit/fix/fix_core.dart';
10 import 'package:analysis_server/plugin/edit/fix/fix_dart.dart'; 10 import 'package:analysis_server/plugin/edit/fix/fix_dart.dart';
(...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 DartFixKind.CHANGE_TO_STATIC_ACCESS, 590 DartFixKind.CHANGE_TO_STATIC_ACCESS,
591 ''' 591 '''
592 import 'libB.dart'; 592 import 'libB.dart';
593 import 'libA.dart'; 593 import 'libA.dart';
594 main(B b) { 594 main(B b) {
595 A.foo; 595 A.foo;
596 } 596 }
597 '''); 597 ''');
598 } 598 }
599 599
600 test_changeTypeAnnotation_BAD_multipleVariables() async {
601 resolveTestUnit('''
602 main() {
603 String a, b = 42;
604 }
605 ''');
606 await assertNoFix(DartFixKind.CHANGE_TYPE_ANNOTATION);
607 }
608
609 test_changeTypeAnnotation_OK_generic() async {
610 resolveTestUnit('''
611 main() {
612 String v = <int>[];
613 }
614 ''');
615 await assertHasFix(
616 DartFixKind.CHANGE_TYPE_ANNOTATION,
617 '''
618 main() {
619 List<int> v = <int>[];
620 }
621 ''');
622 }
623
624 test_changeTypeAnnotation_OK_simple() async {
625 resolveTestUnit('''
626 main() {
627 String v = 'abc'.length;
628 }
629 ''');
630 await assertHasFix(
631 DartFixKind.CHANGE_TYPE_ANNOTATION,
632 '''
633 main() {
634 int v = 'abc'.length;
635 }
636 ''');
637 }
Brian Wilkerson 2015/12/03 01:48:04 Perhaps also f(String s) { s = 42; }
638
600 test_createClass() async { 639 test_createClass() async {
601 resolveTestUnit(''' 640 resolveTestUnit('''
602 main() { 641 main() {
603 Test v = null; 642 Test v = null;
604 } 643 }
605 '''); 644 ''');
606 await assertHasFix( 645 await assertHasFix(
607 DartFixKind.CREATE_CLASS, 646 DartFixKind.CREATE_CLASS,
608 ''' 647 '''
609 main() { 648 main() {
(...skipping 4113 matching lines...) Expand 10 before | Expand all | Expand 10 after
4723 int offset = resultCode.indexOf(search); 4762 int offset = resultCode.indexOf(search);
4724 positions.add(new Position(testFile, offset)); 4763 positions.add(new Position(testFile, offset));
4725 } 4764 }
4726 return positions; 4765 return positions;
4727 } 4766 }
4728 4767
4729 void _performAnalysis() { 4768 void _performAnalysis() {
4730 while (context.performAnalysisTask().hasMoreWork); 4769 while (context.performAnalysisTask().hasMoreWork);
4731 } 4770 }
4732 } 4771 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/services/correction/fix_internal.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698