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

Unified Diff: pkg/analysis_server/test/services/correction/assist_test.dart

Issue 1473513003: Disable merging of 'if' statements when there are other staments in the outer one. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 1 month 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/correction/assist_internal.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/correction/assist_test.dart
diff --git a/pkg/analysis_server/test/services/correction/assist_test.dart b/pkg/analysis_server/test/services/correction/assist_test.dart
index 1d965e516a34c688c614649584d401f65f32caf4..8a9fc8aed1c67bb67954aafb04c0bec28771d532 100644
--- a/pkg/analysis_server/test/services/correction/assist_test.dart
+++ b/pkg/analysis_server/test/services/correction/assist_test.dart
@@ -2684,6 +2684,34 @@ main() {
await assertNoAssistAt('if (1 ==', DartAssistKind.JOIN_IF_WITH_INNER);
}
+ test_joinIfStatementInner_wrong_statementAfterInner() async {
+ resolveTestUnit('''
+main() {
+ if (1 == 1) {
+ if (2 == 2) {
+ print(2);
+ }
+ print(1);
+ }
+}
+''');
+ await assertNoAssistAt('if (1 ==', DartAssistKind.JOIN_IF_WITH_INNER);
+ }
+
+ test_joinIfStatementInner_wrong_statementBeforeInner() async {
+ resolveTestUnit('''
+main() {
+ if (1 == 1) {
+ print(1);
+ if (2 == 2) {
+ print(2);
+ }
+ }
+}
+''');
+ await assertNoAssistAt('if (1 ==', DartAssistKind.JOIN_IF_WITH_INNER);
+ }
+
test_joinIfStatementInner_wrong_targetNotIf() async {
resolveTestUnit('''
main() {
@@ -2914,6 +2942,34 @@ main() {
await assertNoAssistAt('if (2 == 2', DartAssistKind.JOIN_IF_WITH_OUTER);
}
+ test_joinIfStatementOuter_wrong_statementAfterInner() async {
+ resolveTestUnit('''
+main() {
+ if (1 == 1) {
+ if (2 == 2) {
+ print(2);
+ }
+ print(1);
+ }
+}
+''');
+ await assertNoAssistAt('if (2 == 2', DartAssistKind.JOIN_IF_WITH_OUTER);
+ }
+
+ test_joinIfStatementOuter_wrong_statementBeforeInner() async {
+ resolveTestUnit('''
+main() {
+ if (1 == 1) {
+ print(1);
+ if (2 == 2) {
+ print(2);
+ }
+ }
+}
+''');
+ await assertNoAssistAt('if (2 == 2', DartAssistKind.JOIN_IF_WITH_OUTER);
+ }
+
test_joinIfStatementOuter_wrong_targetNotIf() async {
resolveTestUnit('''
main() {
« no previous file with comments | « pkg/analysis_server/lib/src/services/correction/assist_internal.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698