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 9903a1d59bd20ba49856cc1c837adffe57311329..5bea780f8164b456df16bb059d5b1b90fc01d98a 100644 |
--- a/pkg/analysis_server/test/services/refactoring/extract_local_test.dart |
+++ b/pkg/analysis_server/test/services/refactoring/extract_local_test.dart |
@@ -150,6 +150,19 @@ main() { |
'''); |
} |
+ test_checkInitialConditions_voidExpression() async { |
+ indexTestUnit(''' |
+main() { |
+ print(42); |
+} |
+'''); |
+ _createRefactoringForString('print'); |
+ // check conditions |
+ RefactoringStatus status = await refactoring.checkInitialConditions(); |
+ assertRefactoringStatus(status, RefactoringProblemSeverity.FATAL, |
+ expectedMessage: 'Cannot extract the void expression.'); |
+ } |
+ |
test_checkLocalName() { |
indexTestUnit(''' |
main() { |
@@ -352,6 +365,20 @@ int foo(int x) => x; |
expect(subExpressions, ['111', '111 + 222', 'foo(111 + 222)']); |
} |
+ test_coveringExpressions_inInvocationOfVoidFunction() async { |
+ indexTestUnit(''' |
+main() { |
+ foo(111 + 222); |
+} |
+void foo(int x) {} |
+'''); |
+ _createRefactoring(testCode.indexOf('11 +'), 0); |
+ // check conditions |
+ await refactoring.checkInitialConditions(); |
+ List<String> subExpressions = _getCoveringExpressions(); |
+ expect(subExpressions, ['111', '111 + 222']); |
+ } |
+ |
test_coveringExpressions_skipAssignments() async { |
indexTestUnit(''' |
main() { |