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

Unified Diff: pkg/analysis_server/test/services/refactoring/inline_method_test.dart

Issue 2463493002: Fix for inlining async methods/getters. (Closed)
Patch Set: Created 4 years, 2 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/refactoring/inline_method.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/refactoring/inline_method_test.dart
diff --git a/pkg/analysis_server/test/services/refactoring/inline_method_test.dart b/pkg/analysis_server/test/services/refactoring/inline_method_test.dart
index 7c35f5ead856c57707912f2540e97f73cf48eca0..17f6462d7552b07d63063343763a7d885ad294a2 100644
--- a/pkg/analysis_server/test/services/refactoring/inline_method_test.dart
+++ b/pkg/analysis_server/test/services/refactoring/inline_method_test.dart
@@ -711,6 +711,28 @@ main() {
''');
}
+ test_getter_async() {
Brian Wilkerson 2016/10/31 14:00:38 Given that we are inlining 'test' into 'foo, perha
scheglov 2016/10/31 15:48:29 Done.
+ indexTestUnit(r'''
+import 'dart:async';
+class A {
+ Future<int> get test async => 42;
+ Future<int> get foo {
+ return test;
+ }
+}
+''');
+ _createRefactoring('test async');
+ // validate change
+ return _assertSuccessfulRefactoring(r'''
+import 'dart:async';
+class A {
+ Future<int> get foo async {
+ return 42;
+ }
+}
+''');
+ }
+
test_getter_classMember_instance() {
indexTestUnit(r'''
class A {
@@ -803,6 +825,50 @@ main() {
expect(refactoring.inlineAll, false);
}
+ test_method_async() {
+ indexTestUnit(r'''
+import 'dart:async';
+class A {
+ Future<int> test() async => 42;
+ Future<int> foo() {
+ return test();
+ }
+}
+''');
+ _createRefactoring('test() async');
+ // validate change
+ return _assertSuccessfulRefactoring(r'''
+import 'dart:async';
+class A {
+ Future<int> foo() async {
+ return 42;
+ }
+}
+''');
+ }
+
+ test_method_async2() {
+ indexTestUnit(r'''
+import 'dart:async';
+class A {
+ Future<int> test() async => 42;
+ Future foo() {
+ return [test(), test()];
+ }
+}
+''');
+ _createRefactoring('test() async');
+ // validate change
+ return _assertSuccessfulRefactoring(r'''
+import 'dart:async';
+class A {
+ Future foo() async {
+ return [42, 42];
+ }
+}
+''');
+ }
+
test_method_emptyBody() {
indexTestUnit(r'''
abstract class A {
« no previous file with comments | « pkg/analysis_server/lib/src/services/refactoring/inline_method.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698