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

Unified Diff: pkg/analysis_server/test/services/correction/assist_test.dart

Issue 2140193003: Issue 26249. Quick Assist to convert final fields into getters. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analysis_server/lib/src/services/correction/assist_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/assist_test.dart
diff --git a/pkg/analysis_server/test/services/correction/assist_test.dart b/pkg/analysis_server/test/services/correction/assist_test.dart
index 445acacab5e75b6b41a9d85772c778d928a6ec8e..4188664a8b854aa91b6411d12fa1b397c5d1e40d 100644
--- a/pkg/analysis_server/test/services/correction/assist_test.dart
+++ b/pkg/analysis_server/test/services/correction/assist_test.dart
@@ -1769,6 +1769,69 @@ main(List<String> items) {
''');
}
+ test_convertToGetter_BAD_noInitializer() async {
+ resolveTestUnit('''
+class A {
+ final int foo;
+}
+''');
+ await assertNoAssistAt('foo', DartAssistKind.CONVERT_INTO_GETTER);
+ }
+
+ test_convertToGetter_BAD_notFinal() async {
+ resolveTestUnit('''
+class A {
+ int foo = 1;
+}
+''');
+ await assertNoAssistAt('foo', DartAssistKind.CONVERT_INTO_GETTER);
+ }
+
+ test_convertToGetter_BAD_notSingleField() async {
+ resolveTestUnit('''
+class A {
+ final int foo = 1, bar = 2;
+}
+''');
+ await assertNoAssistAt('foo', DartAssistKind.CONVERT_INTO_GETTER);
+ }
+
+ test_convertToGetter_OK() async {
+ resolveTestUnit('''
+const myAnnotation = const Object();
+class A {
+ @myAnnotation
+ final int foo = 1 + 2;
+}
+''');
+ await assertHasAssistAt(
+ 'foo =',
+ DartAssistKind.CONVERT_INTO_GETTER,
+ '''
+const myAnnotation = const Object();
+class A {
+ @myAnnotation
+ int get foo => 1 + 2;
+}
+''');
+ }
+
+ test_convertToGetter_OK_noType() async {
+ resolveTestUnit('''
+class A {
+ final foo = 42;
+}
+''');
+ await assertHasAssistAt(
+ 'foo =',
+ DartAssistKind.CONVERT_INTO_GETTER,
+ '''
+class A {
+ get foo => 42;
+}
+''');
+ }
+
test_convertToIsNot_BAD_is_alreadyIsNot() async {
resolveTestUnit('''
main(p) {
« no previous file with comments | « pkg/analysis_server/lib/src/services/correction/assist_internal.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698