remove redundant else: check all then clauses (IDEA-58136)

This commit is contained in:
anna
2010-08-30 20:52:53 +04:00
parent ad9c77ecca
commit 0bb2f844f2
5 changed files with 102 additions and 8 deletions
@@ -0,0 +1,13 @@
// "Remove Redundant 'else'" "true"
class a {
void foo() {
int a = 0;
int b = 0;
if (a != b) {
return;
}
a = b;
a++;
}
}
@@ -0,0 +1,14 @@
// "Remove Redundant 'else'" "true"
class a {
void foo() {
int a = 0;
int b = 0;
if (a != b) {
return;
} e<caret>lse {
a = b;
}
a++;
}
}
@@ -0,0 +1,17 @@
// "Remove Redundant 'else'" "false"
class a {
void foo() {
int a = 0;
int b = 0;
if (a != b) {
a = 10;
} else if (a + 1 == b) {
return;
}
e<caret>lse {
a = b;
}
a++;
}
}
@@ -0,0 +1,31 @@
/*
* Copyright 2000-2010 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.codeInsight.daemon.quickFix;
/**
* User: anna
* Date: Aug 30, 2010
*/
public class RemoveRedundantElseActionTest extends LightQuickFixTestCase {
public void test() throws Exception { doAllTests(); }
protected String getBasePath() {
return "/codeInsight/daemonCodeAnalyzer/quickFix/removeRedundantElse";
}
}