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

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

Issue 879463004: Fix for extracting local variable in if-else-if statements. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 10 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_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 e8ced6ab01547e71b0dfc28f435732ec36998a14..efe70912b8e9d1f7840a8b8dfd856b622354ea97 100644
--- a/pkg/analysis_server/test/services/refactoring/extract_local_test.dart
+++ b/pkg/analysis_server/test/services/refactoring/extract_local_test.dart
@@ -768,6 +768,30 @@ main() {
''');
}
+ test_singleExpression_inIfElseIf() {
+ indexTestUnit('''
+main(int p) {
+ if (p == 1) {
+ print(1);
+ } else if (p == 2) {
+ print(2);
+ }
+}
+''');
+ _createRefactoringForString('2');
+ // apply refactoring
+ return _assertSuccessfulRefactoring('''
+main(int p) {
+ var res = 2;
+ if (p == 1) {
+ print(1);
+ } else if (p == res) {
+ print(res);
+ }
+}
+''');
+ }
+
test_singleExpression_inMethod() {
indexTestUnit('''
class A {
« 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