OLD | NEW |
---|---|
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 Loading... | |
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 Loading... | |
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 } |
OLD | NEW |