This commit is contained in:
Roman Shevchenko
2012-10-10 13:03:57 +02:00
parent f24fc7ba67
commit 4dd466fde6
4 changed files with 141 additions and 148 deletions
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<problems>
<!-- no problem -->
</problems>
@@ -0,0 +1,30 @@
/*
* Copyright 2000-2012 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.codeInspection;
import com.intellij.codeInsight.slice.SliceTreeTest;
import junit.framework.Test;
import junit.framework.TestSuite;
public class DataFlowInspectionSuite {
public static Test suite() {
TestSuite suite = new TestSuite();
suite.addTestSuite(DataFlowInspectionFixtureTest.class);
suite.addTestSuite(DataFlowInspectionTest.class);
suite.addTestSuite(SliceTreeTest.class);
return suite;
}
}
@@ -1,164 +1,120 @@
/*
* Created by IntelliJ IDEA.
* User: max
* Date: Apr 11, 2002
* Time: 6:50:50 PM
* To change template for new class use
* Code Style | Class Templates options (Tools | IDE Options).
* Copyright 2000-2012 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.codeInspection;
import com.intellij.JavaTestUtil;
import com.intellij.codeInsight.slice.SliceTreeTest;
import com.intellij.codeInspection.dataFlow.DataFlowInspection;
import com.intellij.codeInspection.ex.LocalInspectionToolWrapper;
import com.intellij.testFramework.InspectionTestCase;
import junit.framework.Test;
import junit.framework.TestSuite;
import org.jetbrains.annotations.NonNls;
/**
* @author max
* @since Apr 11, 2002
*/
public class DataFlowInspectionTest extends InspectionTestCase {
@Override
protected String getTestDataPath() {
return JavaTestUtil.getJavaTestDataPath() + "/inspection";
}
private void doTest() throws Exception {
doTest("dataFlow/" + getTestName(false), new DataFlowInspection());
private void doTest() {
doTest(false);
}
private void doTest(boolean lowercase) {
doTest("dataFlow/" + getTestName(lowercase), new DataFlowInspection());
}
private void doTest15() throws Exception {
final LocalInspectionToolWrapper tool = new LocalInspectionToolWrapper(new DataFlowInspection());
doTest("dataFlow/" + getTestName(false), tool, "java 1.5");
private void doTest15() {
doTest15(false);
}
private void doTest15(boolean lowercase) {
doTest("dataFlow/" + getTestName(lowercase), new DataFlowInspection(), "java 1.5");
}
public void testnpe1() throws Exception { doTest(); }
public void testNpe1() { doTest(true); }
public void testCaseAndNpe() { doTest(true); }
public void testCce() { doTest(true); }
public void testExceptionCFG() { doTest(true); }
public void testInst() { doTest(true); }
public void testWrongEqualTypes() { doTest(true); }
public void testSCR13702() { doTest(); }
public void testSCR13626() { doTest(); }
public void testSCR13871() { doTest(); }
public void testInstanceof() { doTest(); }
public void testOrBug() { doTest(true); }
public void testSCR14819() { doTest(); }
public void testSCR14314() { doTest(); }
public void testSCR15162() { doTest(); }
public void testCatchParameterCantBeNull() { doTest(); }
public void testXor() { doTest(true); }
public void testGenericInstanceof() { doTest(); }
public void testThisInstanceof() { doTest(true); }
public void testAndEq() { doTest(true); }
public void testNullableField() { doTest(true); }
public void testSCR39950() { doTest(); }
public void testScrIDEA1() { doTest(true); }
public void testSCR18186() { doTest(); }
public void testConstantExpr() { doTest(true); }
public void testIDEADEV74518() { doTest(); }
public void testIDEADEV74518_2() { doTest(); }
public void testIDEADEV77819() { doTest(); }
public void testIDEADEV78370() { doTest(); }
public void testRegressionByPti() { doTest(); }
public void testJspTemplateStatement() { doTest(true); /* should not crash */ }
public void testcaseAndNpe() throws Exception { doTest(); }
public void testcce() throws Exception { doTest(); }
public void testexceptionCFG() throws Exception { doTest(); }
public void testinst() throws Exception { doTest(); }
public void testwrongEqualTypes() throws Exception { doTest(); }
public void testSCR13702() throws Exception { doTest(); }
public void testSCR13626() throws Exception { doTest(); }
public void testSCR13871() throws Exception { doTest(); }
public void testInstanceof() throws Exception { doTest(); }
public void testorBug() throws Exception { doTest(); }
public void testSCR14819() throws Exception { doTest(); }
public void testSCR14314() throws Exception { doTest(); }
public void testSCR15162() throws Exception { doTest(); }
public void testCatchParameterCantBeNull() throws Exception { doTest(); }
public void testxor() throws Exception { doTest(); }
public void testGenericInstanceof() throws Exception { doTest(); }
public void testthisInstanceof() throws Exception { doTest(); }
public void testandEq() throws Exception { doTest(); }
public void testnullableField() throws Exception { doTest(); }
public void testSCR39950() throws Exception { doTest(); }
public void testscrIDEA1() throws Exception { doTest(); }
public void testSCR18186() throws Exception { doTest(); }
//public void testSCR15406() throws Exception {
// doTest();
//}
public void testconstantExpr() throws Exception { doTest(); }
public void testIDEADEV74518() throws Exception { doTest(); }
public void testIDEADEV74518_2() throws Exception { doTest(); }
public void testIDEADEV77819() throws Exception { doTest(); }
public void testIDEADEV78370() throws Exception { doTest(); }
public void testRegressionByPti() throws Exception { doTest(); }
public void testNotNullable() throws Exception { doTest15(); }
public void testNotNullableParameter() throws Exception { doTest15(); }
public void testNotNullableParameter2() throws Exception { doTest15(); }
public void testNullable() throws Exception { doTest15(); }
public void testNullableThroughCast() throws Exception { doTest15(); }
public void testNullableProblemThroughCast() throws Exception { doTest15(); }
public void testNullableThroughVariable() throws Exception { doTest15(); }
public void testNullableThroughVariableShouldNotBeReported() throws Exception { doTest15(); }
public void testNullableAssignment() throws Exception { doTest15(); }
public void testNullableLocalVariable() throws Exception { doTest15(); }
public void testNotNullLocalVariable() throws Exception { doTest15(); }
public void testNullableReturn() throws Exception { doTest15(); }
public void testNullableReturn1() throws Exception { doTest15(); }
public void testfinalFields() throws Exception { doTest15(); }
public void testNotNullArray() throws Exception { doTest15(); }
public void testFieldsFlashing() throws Exception { doTest15(); }
public void testConditionFalseAndNPE() throws Exception { doTest15(); }
public void testIDEADEV1575() throws Exception { doTest15(); }
public void testAlexBug() throws Exception { doTest15(); }
public void testYoleBug() throws Exception { doTest15(); }
public void testForeachFlow() throws Exception { doTest15(); }
public void testForEachNPE() throws Exception { doTest15(); }
public void testArrayAccessNPE() throws Exception { doTest15(); }
public void testArrayAccessDoesntCancelAnalysis() throws Exception { doTest15(); }
public void testcompileTimeConst() throws Exception { doTest15(); }
public void testautoboxing() throws Exception { doTest15(); }
public void testunboxingNPE() throws Exception { doTest15(); }
public void testStrangeArrayIndexOutOfBounds() throws Exception { doTest15(); }
public void testIDEADEV2605() throws Exception { doTest15(); }
public void testConstantsDifferentTypes() throws Exception { doTest15(); }
public void testBoxingNaN() throws Exception { doTest15(); }
public void testjspTemplateStatement() throws Exception {
@NonNls final String testDir = getTestDataPath() + "/"+ "dataFlow/" + getTestName(false);
runTool(testDir, "java 1.4", new LocalInspectionToolWrapper(new DataFlowInspection()));
// should not crash
}
public void testboxingBoolean() throws Exception { doTest15();}
public void testCheckedExceptionDominance() throws Exception { doTest15();}
public void testIDEADEV10489() throws Exception { doTest15();}
public void testPlusOnStrings() throws Exception { doTest15();}
public void testSwitchQualifierProducesNPE() throws Exception {doTest15();}
public void testIDEADEV15583() throws Exception {doTest15();}
public void testIDEADEV13153() throws Exception { doTest15(); }
public void testIDEADEV13156() throws Exception { doTest15(); }
//public void testIDEADEV11033() throws Exception { doTest15(); }
public void testSwitchEnumCases() throws Exception { doTest15(); }
public static Test suite() {
TestSuite suite = new TestSuite();
suite.addTestSuite(DataFlowInspectionFixtureTest.class);
suite.addTestSuite(DataFlowInspectionTest.class);
suite.addTestSuite(SliceTreeTest.class);
return suite;
}
public void testNotNullable() { doTest15(); }
public void testNotNullableParameter() { doTest15(); }
public void testNotNullableParameter2() { doTest15(); }
public void testNullable() { doTest15(); }
public void testNullableThroughCast() { doTest15(); }
public void testNullableProblemThroughCast() { doTest15(); }
public void testNullableThroughVariable() { doTest15(); }
public void testNullableThroughVariableShouldNotBeReported() { doTest15(); }
public void testNullableAssignment() { doTest15(); }
public void testNullableLocalVariable() { doTest15(); }
public void testNotNullLocalVariable() { doTest15(); }
public void testNullableReturn() { doTest15(); }
public void testNullableReturn1() { doTest15(); }
public void testFinalFields() { doTest15(true); }
public void testNotNullArray() { doTest15(); }
public void testFieldsFlashing() { doTest15(); }
public void testConditionFalseAndNPE() { doTest15(); }
public void testIDEADEV1575() { doTest15(); }
public void testAlexBug() { doTest15(); }
public void testYoleBug() { doTest15(); }
public void testForeachFlow() { doTest15(); }
public void testForEachNPE() { doTest15(); }
public void testArrayAccessNPE() { doTest15(); }
public void testArrayAccessDoesntCancelAnalysis() { doTest15(); }
public void testCompileTimeConst() { doTest15(true); }
public void testAutoboxing() { doTest15(true); }
public void testUnboxingNPE() { doTest15(true); }
public void testStrangeArrayIndexOutOfBounds() { doTest15(); }
public void testIDEADEV2605() { doTest15(); }
public void testConstantsDifferentTypes() { doTest15(); }
public void testBoxingNaN() { doTest15(); }
public void testBoxingBoolean() { doTest15(true); }
public void testCheckedExceptionDominance() { doTest15(); }
public void testIDEADEV10489() { doTest15(); }
public void testPlusOnStrings() { doTest15(); }
public void testSwitchQualifierProducesNPE() {doTest15(); }
public void testIDEADEV15583() {doTest15(); }
public void testIDEADEV13153() { doTest15(); }
public void testIDEADEV13156() { doTest15(); }
public void testSwitchEnumCases() { doTest15(); }
//public void testSCR15406() { doTest(); } // added by cdr, 2005
//public void testIDEADEV11033() { doTest15(); } // added by max, 2007
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2012 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.
@@ -47,10 +47,9 @@ import org.jetbrains.annotations.NotNull;
import java.io.File;
/*
* User: max
* Date: Apr 11, 2002
* Time: 5:18:36 PM
/**
* @author max
* @since Apr 11, 2002
*/
@SuppressWarnings({"HardCodedStringLiteral"})
public abstract class InspectionTestCase extends PsiTestCase {
@@ -86,6 +85,10 @@ public abstract class InspectionTestCase extends PsiTestCase {
doTest(folderName, tool, "java 1.4", checkRange);
}
public void doTest(@NonNls String folderName, LocalInspectionTool tool, @NonNls final String jdkName) {
doTest(folderName, new LocalInspectionToolWrapper(tool), jdkName);
}
public void doTest(@NonNls String folderName, InspectionTool tool, @NonNls final String jdkName) {
doTest(folderName, tool, jdkName, false);
}