Use separate test methods instead of generated suit

This commit is contained in:
Nikolay Krasko
2012-09-07 15:11:55 +04:00
parent cd5521d6dc
commit 4376c7a87c
2 changed files with 12 additions and 51 deletions
@@ -22,10 +22,6 @@ import com.intellij.psi.PsiPolyVariantReference;
import com.intellij.psi.PsiReference;
import com.intellij.psi.ResolveResult;
import com.intellij.testFramework.LightCodeInsightTestCase;
import junit.framework.Test;
import junit.framework.TestSuite;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jet.JetTestCaseBuilder;
import org.jetbrains.jet.plugin.PluginTestCaseBase;
import java.io.File;
@@ -34,41 +30,15 @@ import java.io.File;
* @author Nikolay Krasko
*/
public class ResolveBaseTest extends LightCodeInsightTestCase {
private final String myPath;
private final String myName;
protected ResolveBaseTest(@NotNull String path, @NotNull String name) {
myPath = path;
myName = name;
// Set name explicitly because otherwise there will be "TestCase.fName cannot be null"
setName("testResolve");
public void testMultiResolve() throws Exception {
doMultiResolveTest();
}
@Override
protected Sdk getProjectJDK() {
return PluginTestCaseBase.jdkFromIdeaHome();
public void testSeveralOverrides() throws Exception {
doMultiResolveTest();
}
@Override
protected String getTestDataPath() {
return new File(PluginTestCaseBase.getTestDataPathBase(), myPath).getPath() +
File.separator;
}
@NotNull
@Override
public String getName() {
return "test" + myName;
}
public void testResolve() throws Exception {
doTest();
}
// TODO: Currently this test is only for KT-763 bug - it should be extended to framework for testing references
protected void doTest() throws Exception {
protected void doMultiResolveTest() throws Exception {
final String testName = getTestName(false);
configureByFile(testName + ".kt");
@@ -87,22 +57,13 @@ public class ResolveBaseTest extends LightCodeInsightTestCase {
assertTrue("Nothing resolved by reference '" + psiReference.getElement().getText() + "'.", element != null || results.length > 0);
}
@NotNull
public static TestSuite suite() {
TestSuite suite = new TestSuite();
@Override
protected Sdk getProjectJDK() {
return PluginTestCaseBase.jdkFromIdeaHome();
}
JetTestCaseBuilder.appendTestsInDirectory(
PluginTestCaseBase.getTestDataPathBase(), "/resolve/", false,
JetTestCaseBuilder.kotlinFilter, new JetTestCaseBuilder.NamedTestFactory() {
@NotNull
@Override
public Test createTest(@NotNull String dataPath, @NotNull String name, @NotNull File file) {
return new ResolveBaseTest(dataPath, name);
}
}, suite);
return suite;
@Override
protected String getTestDataPath() {
return new File(PluginTestCaseBase.getTestDataPathBase(), "/resolve/").getPath() + File.separator;
}
}