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

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

Issue 533913002: Fix for 'returnType' when extract a method with a single expression. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 3 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/extract_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/extract_method_test.dart
diff --git a/pkg/analysis_server/test/services/refactoring/extract_method_test.dart b/pkg/analysis_server/test/services/refactoring/extract_method_test.dart
index e039419e8e5dd5f2357470646e670f09945b0994..39d38556129dbd334a9659a71d7cb957a192dd0b 100644
--- a/pkg/analysis_server/test/services/refactoring/extract_method_test.dart
+++ b/pkg/analysis_server/test/services/refactoring/extract_method_test.dart
@@ -1032,11 +1032,9 @@ main() {
test_offsets_lengths() {
indexTestUnit('''
main() {
-main() {
int a = 1 + 2;
int b = 1 + 2;
}
-}
''');
_createRefactoringForString('1 + 2');
// apply refactoring
@@ -1048,6 +1046,50 @@ main() {
});
}
+ test_returnType_expression() {
+ indexTestUnit('''
+main() {
+ int a = 1 + 2;
+}
+''');
+ _createRefactoringForString('1 + 2');
+ // do check
+ return refactoring.checkInitialConditions().then((_) {
+ expect(refactoring.returnType, 'int');
+ });
+ }
+
+ test_returnType_statements() {
+ indexTestUnit('''
+main() {
+// start
+ double v = 5.0;
+// end
+ print(v);
+}
+''');
+ _createRefactoringForStartEndComments();
+ // do check
+ return refactoring.checkInitialConditions().then((_) {
+ expect(refactoring.returnType, 'double');
+ });
+ }
+
+ test_returnType_statements_void() {
+ indexTestUnit('''
+main() {
+// start
+ print(42);
+// end
+}
+''');
+ _createRefactoringForStartEndComments();
+ // do check
+ return refactoring.checkInitialConditions().then((_) {
+ expect(refactoring.returnType, 'void');
+ });
+ }
+
test_setExtractGetter() {
indexTestUnit('''
main() {
« no previous file with comments | « pkg/analysis_server/lib/src/services/refactoring/extract_method.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698