From 4376c7a87cf9cd2fb69280b07a990a92c9f1138d Mon Sep 17 00:00:00 2001 From: Nikolay Krasko Date: Fri, 7 Sep 2012 15:11:55 +0400 Subject: [PATCH] Use separate test methods instead of generated suit --- .../{multiResolve.kt => MultiResolve.kt} | 0 .../jet/resolve/ResolveBaseTest.java | 63 ++++--------------- 2 files changed, 12 insertions(+), 51 deletions(-) rename idea/testData/resolve/{multiResolve.kt => MultiResolve.kt} (100%) diff --git a/idea/testData/resolve/multiResolve.kt b/idea/testData/resolve/MultiResolve.kt similarity index 100% rename from idea/testData/resolve/multiResolve.kt rename to idea/testData/resolve/MultiResolve.kt diff --git a/idea/tests/org/jetbrains/jet/resolve/ResolveBaseTest.java b/idea/tests/org/jetbrains/jet/resolve/ResolveBaseTest.java index c3674a6c33a..3085b280819 100644 --- a/idea/tests/org/jetbrains/jet/resolve/ResolveBaseTest.java +++ b/idea/tests/org/jetbrains/jet/resolve/ResolveBaseTest.java @@ -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; } }