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

Unified 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: Additional test. 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/test/services/correction/fix_test.dart
diff --git a/pkg/analysis_server/test/services/correction/fix_test.dart b/pkg/analysis_server/test/services/correction/fix_test.dart
index a54eb0085168550511eccd2fab76a53f3c558375..6f0d8ab05171ee679a2d7586811c9f608d1a3e26 100644
--- a/pkg/analysis_server/test/services/correction/fix_test.dart
+++ b/pkg/analysis_server/test/services/correction/fix_test.dart
@@ -597,6 +597,55 @@ main(B b) {
''');
}
+ test_changeTypeAnnotation_BAD_multipleVariables() async {
+ resolveTestUnit('''
+main() {
+ String a, b = 42;
+}
+''');
+ await assertNoFix(DartFixKind.CHANGE_TYPE_ANNOTATION);
+ }
+
+ test_changeTypeAnnotation_BAD_notVariableDeclaration() async {
+ resolveTestUnit('''
+main() {
+ String p;
+ p = 42;
+}
+''');
+ await assertNoFix(DartFixKind.CHANGE_TYPE_ANNOTATION);
+ }
+
+ test_changeTypeAnnotation_OK_generic() async {
+ resolveTestUnit('''
+main() {
+ String v = <int>[];
+}
+''');
+ await assertHasFix(
+ DartFixKind.CHANGE_TYPE_ANNOTATION,
+ '''
+main() {
+ List<int> v = <int>[];
+}
+''');
+ }
+
+ test_changeTypeAnnotation_OK_simple() async {
+ resolveTestUnit('''
+main() {
+ String v = 'abc'.length;
+}
+''');
+ await assertHasFix(
+ DartFixKind.CHANGE_TYPE_ANNOTATION,
+ '''
+main() {
+ int v = 'abc'.length;
+}
+''');
+ }
+
test_createClass() async {
resolveTestUnit('''
main() {
« 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