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

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

Issue 1528023002: Issue 25252. Stop collecting covering expressions at void invocations. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years 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_local.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_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() {
« no previous file with comments | « pkg/analysis_server/lib/src/services/refactoring/extract_local.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698