Index: pkg/analysis_server/test/services/refactoring/extract_local_test.dart |
diff --git a/pkg/analysis_server/test/services/refactoring/extract_local_test.dart b/pkg/analysis_server/test/services/refactoring/extract_local_test.dart |
index 4dfb55d29e2b95310f0bd5825deffea3bb2c9dad..1cb626f0071248e2c17056b98d71bb71e8766137 100644 |
--- a/pkg/analysis_server/test/services/refactoring/extract_local_test.dart |
+++ b/pkg/analysis_server/test/services/refactoring/extract_local_test.dart |
@@ -69,17 +69,16 @@ main() { |
expectedMessage: 'Cannot extract the left-hand side of an assignment.'); |
} |
- test_checkInitialConditions_methodName_reference() async { |
+ test_checkInitialConditions_namePartOfDeclaration_function() async { |
indexTestUnit(''' |
main() { |
- main(); |
} |
'''); |
- _createRefactoringWithSuffix('main', '();'); |
+ _createRefactoringWithSuffix('main', '()'); |
// check conditions |
RefactoringStatus status = await refactoring.checkAllConditions(); |
assertRefactoringStatus(status, RefactoringProblemSeverity.FATAL, |
- expectedMessage: 'Cannot extract a single method name.'); |
+ expectedMessage: 'Cannot extract the name part of a declaration.'); |
} |
test_checkInitialConditions_namePartOfDeclaration_variable() async { |
@@ -859,6 +858,24 @@ main() { |
'''); |
} |
+ test_singleExpression_methodName_reference() async { |
+ indexTestUnit(''' |
+main() { |
+ var v = foo().length; |
+} |
+String foo() => ''; |
+'''); |
+ _createRefactoringWithSuffix('foo', '().'); |
+ // apply refactoring |
+ return _assertSuccessfulRefactoring(''' |
+main() { |
+ var res = foo(); |
+ var v = res.length; |
+} |
+String foo() => ''; |
+'''); |
+ } |
+ |
test_singleExpression_nameOfProperty_prefixedIdentifier() async { |
indexTestUnit(''' |
main(p) { |
@@ -894,7 +911,7 @@ String foo() => ''; |
} |
/** |
- * Here we use knowledge how exactly `1 + 2 + 3 + 41 is parsed. We know that |
+ * Here we use knowledge how exactly `1 + 2 + 3 + 4` is parsed. We know that |
* `1 + 2` will be a separate and complete binary expression, so it can be |
* handled as a single expression. |
*/ |