JetPsiCheckerTest and its testdata moved back to plugin tests
This commit is contained in:
@@ -1,16 +0,0 @@
|
|||||||
package org.jetbrains.jet;
|
|
||||||
|
|
||||||
import com.intellij.openapi.projectRoots.Sdk;
|
|
||||||
import com.intellij.testFramework.fixtures.DefaultLightProjectDescriptor;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author yole
|
|
||||||
*/
|
|
||||||
public class JetLightProjectDescriptor extends DefaultLightProjectDescriptor {
|
|
||||||
public static JetLightProjectDescriptor INSTANCE = new JetLightProjectDescriptor();
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Sdk getSdk() {
|
|
||||||
return JetTestCaseBase.jdkFromIdeaHome();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -3,7 +3,6 @@ package org.jetbrains.jet;
|
|||||||
import com.intellij.codeInsight.daemon.LightDaemonAnalyzerTestCase;
|
import com.intellij.codeInsight.daemon.LightDaemonAnalyzerTestCase;
|
||||||
import com.intellij.openapi.application.PathManager;
|
import com.intellij.openapi.application.PathManager;
|
||||||
import com.intellij.openapi.projectRoots.Sdk;
|
import com.intellij.openapi.projectRoots.Sdk;
|
||||||
import com.intellij.openapi.projectRoots.impl.JavaSdkImpl;
|
|
||||||
import junit.framework.Test;
|
import junit.framework.Test;
|
||||||
import junit.framework.TestSuite;
|
import junit.framework.TestSuite;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
@@ -21,7 +20,6 @@ import java.util.List;
|
|||||||
public abstract class JetTestCaseBase extends LightDaemonAnalyzerTestCase {
|
public abstract class JetTestCaseBase extends LightDaemonAnalyzerTestCase {
|
||||||
|
|
||||||
private static FilenameFilter emptyFilter;
|
private static FilenameFilter emptyFilter;
|
||||||
private boolean checkInfos = false;
|
|
||||||
private String dataPath;
|
private String dataPath;
|
||||||
protected final String name;
|
protected final String name;
|
||||||
|
|
||||||
@@ -30,15 +28,6 @@ public abstract class JetTestCaseBase extends LightDaemonAnalyzerTestCase {
|
|||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public final JetTestCaseBase setCheckInfos(boolean checkInfos) {
|
|
||||||
this.checkInfos = checkInfos;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Sdk jdkFromIdeaHome() {
|
|
||||||
return new JavaSdkImpl().createJdk("JDK", "compiler/testData/mockJDK-1.7/jre", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String getTestDataPath() {
|
protected String getTestDataPath() {
|
||||||
return getTestDataPathBase();
|
return getTestDataPathBase();
|
||||||
@@ -52,26 +41,6 @@ public abstract class JetTestCaseBase extends LightDaemonAnalyzerTestCase {
|
|||||||
return new File(PathManager.getResourceRoot(JetTestCaseBase.class, "/org/jetbrains/jet/JetTestCaseBase.class")).getParentFile().getParentFile().getParent();
|
return new File(PathManager.getResourceRoot(JetTestCaseBase.class, "/org/jetbrains/jet/JetTestCaseBase.class")).getParentFile().getParentFile().getParent();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Sdk getProjectJDK() {
|
|
||||||
return jdkFromIdeaHome();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return "test" + name;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void runTest() throws Throwable {
|
|
||||||
doTest(getTestFilePath(), true, checkInfos);
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
protected String getTestFilePath() {
|
|
||||||
return dataPath + File.separator + name + ".jet";
|
|
||||||
}
|
|
||||||
|
|
||||||
protected String getDataPath() {
|
protected String getDataPath() {
|
||||||
return dataPath;
|
return dataPath;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,42 +0,0 @@
|
|||||||
package org.jetbrains.jet.checkers;
|
|
||||||
|
|
||||||
import junit.framework.Test;
|
|
||||||
import junit.framework.TestSuite;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
import org.jetbrains.jet.JetTestCaseBase;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author abreslav
|
|
||||||
*/
|
|
||||||
public class JetPsiCheckerTest extends JetTestCaseBase {
|
|
||||||
|
|
||||||
public JetPsiCheckerTest(String dataPath, String name) {
|
|
||||||
super(dataPath, name);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Test suite() {
|
|
||||||
TestSuite suite = new TestSuite();
|
|
||||||
suite.addTest(JetTestCaseBase.suiteForDirectory(getTestDataPathBase(), "/checker/", false, new JetTestCaseBase.NamedTestFactory() {
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public Test createTest(@NotNull String dataPath, @NotNull String name) {
|
|
||||||
return new JetPsiCheckerTest(dataPath, name);
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
suite.addTest(JetTestCaseBase.suiteForDirectory(getTestDataPathBase(), "/checker/regression/", false, new JetTestCaseBase.NamedTestFactory() {
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public Test createTest(@NotNull String dataPath, @NotNull String name) {
|
|
||||||
return new JetPsiCheckerTest(dataPath, name);
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
suite.addTest(JetTestCaseBase.suiteForDirectory(getTestDataPathBase(), "/checker/infos/", false, new JetTestCaseBase.NamedTestFactory() {
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public Test createTest(@NotNull String dataPath, @NotNull String name) {
|
|
||||||
return new JetPsiCheckerTest(dataPath, name).setCheckInfos(true);
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
return suite;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -2,7 +2,6 @@ package org.jetbrains.jet.resolve;
|
|||||||
|
|
||||||
import com.intellij.openapi.application.PathManager;
|
import com.intellij.openapi.application.PathManager;
|
||||||
import com.intellij.openapi.project.Project;
|
import com.intellij.openapi.project.Project;
|
||||||
import com.intellij.openapi.projectRoots.Sdk;
|
|
||||||
import com.intellij.psi.JavaPsiFacade;
|
import com.intellij.psi.JavaPsiFacade;
|
||||||
import com.intellij.psi.PsiClass;
|
import com.intellij.psi.PsiClass;
|
||||||
import com.intellij.psi.PsiElement;
|
import com.intellij.psi.PsiElement;
|
||||||
@@ -133,10 +132,12 @@ public class JetResolveTest extends ExtensibleResolveTestCase {
|
|||||||
return getHomeDirectory() + "/compiler/testData";
|
return getHomeDirectory() + "/compiler/testData";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
@Override
|
@Override
|
||||||
protected Sdk getProjectJDK() {
|
protected Sdk getProjectJDK() {
|
||||||
return JetTestCaseBase.jdkFromIdeaHome();
|
return PluginTestCaseBase.jdkFromIdeaHome();
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
private static String getHomeDirectory() {
|
private static String getHomeDirectory() {
|
||||||
return new File(PathManager.getResourceRoot(JetParsingTest.class, "/org/jetbrains/jet/parsing/JetParsingTest.class")).getParentFile().getParentFile().getParent();
|
return new File(PathManager.getResourceRoot(JetParsingTest.class, "/org/jetbrains/jet/parsing/JetParsingTest.class")).getParentFile().getParentFile().getParent();
|
||||||
|
|||||||
@@ -0,0 +1,81 @@
|
|||||||
|
package org.jetbrains.jet.checkers;
|
||||||
|
|
||||||
|
import com.intellij.codeInsight.daemon.LightDaemonAnalyzerTestCase;
|
||||||
|
import com.intellij.openapi.projectRoots.Sdk;
|
||||||
|
import junit.framework.Test;
|
||||||
|
import junit.framework.TestSuite;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.jet.JetTestCaseBase;
|
||||||
|
import org.jetbrains.jet.plugin.quickfix.PluginTestCaseBase;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author abreslav
|
||||||
|
*/
|
||||||
|
public class JetPsiCheckerTest extends LightDaemonAnalyzerTestCase {
|
||||||
|
private boolean checkInfos = false;
|
||||||
|
private String myDataPath;
|
||||||
|
private String myName;
|
||||||
|
|
||||||
|
public JetPsiCheckerTest(String dataPath, String name) {
|
||||||
|
myDataPath = dataPath;
|
||||||
|
myName = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void runTest() throws Throwable {
|
||||||
|
doTest(getTestFilePath(), true, checkInfos);
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
protected String getTestFilePath() {
|
||||||
|
return myDataPath + File.separator + myName + ".jet";
|
||||||
|
}
|
||||||
|
|
||||||
|
public final JetPsiCheckerTest setCheckInfos(boolean checkInfos) {
|
||||||
|
this.checkInfos = checkInfos;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getTestDataPath() {
|
||||||
|
return PluginTestCaseBase.getTestDataPathBase();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Sdk getProjectJDK() {
|
||||||
|
return PluginTestCaseBase.jdkFromIdeaHome();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "test" + myName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Test suite() {
|
||||||
|
TestSuite suite = new TestSuite();
|
||||||
|
suite.addTest(JetTestCaseBase.suiteForDirectory(PluginTestCaseBase.getTestDataPathBase(), "/checker/", false, new JetTestCaseBase.NamedTestFactory() {
|
||||||
|
@NotNull
|
||||||
|
@Override
|
||||||
|
public Test createTest(@NotNull String dataPath, @NotNull String name) {
|
||||||
|
return new JetPsiCheckerTest(dataPath, name);
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
suite.addTest(JetTestCaseBase.suiteForDirectory(PluginTestCaseBase.getTestDataPathBase(), "/checker/regression/", false, new JetTestCaseBase.NamedTestFactory() {
|
||||||
|
@NotNull
|
||||||
|
@Override
|
||||||
|
public Test createTest(@NotNull String dataPath, @NotNull String name) {
|
||||||
|
return new JetPsiCheckerTest(dataPath, name);
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
suite.addTest(JetTestCaseBase.suiteForDirectory(PluginTestCaseBase.getTestDataPathBase(), "/checker/infos/", false, new JetTestCaseBase.NamedTestFactory() {
|
||||||
|
@NotNull
|
||||||
|
@Override
|
||||||
|
public Test createTest(@NotNull String dataPath, @NotNull String name) {
|
||||||
|
return new JetPsiCheckerTest(dataPath, name).setCheckInfos(true);
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
return suite;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -91,6 +91,6 @@ public class JetQuickFixTest extends LightQuickFixTestCase {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Sdk getProjectJDK() {
|
protected Sdk getProjectJDK() {
|
||||||
return JetTestCaseBase.jdkFromIdeaHome();
|
return PluginTestCaseBase.jdkFromIdeaHome();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package org.jetbrains.jet.plugin.quickfix;
|
package org.jetbrains.jet.plugin.quickfix;
|
||||||
|
|
||||||
|
import com.intellij.openapi.projectRoots.Sdk;
|
||||||
|
import com.intellij.openapi.projectRoots.impl.JavaSdkImpl;
|
||||||
import org.jetbrains.jet.JetTestCaseBase;
|
import org.jetbrains.jet.JetTestCaseBase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -9,4 +11,8 @@ public class PluginTestCaseBase {
|
|||||||
public static String getTestDataPathBase() {
|
public static String getTestDataPathBase() {
|
||||||
return JetTestCaseBase.getHomeDirectory() + "/idea/testData";
|
return JetTestCaseBase.getHomeDirectory() + "/idea/testData";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Sdk jdkFromIdeaHome() {
|
||||||
|
return new JavaSdkImpl().createJdk("JDK", "compiler/testData/mockJDK-1.7/jre", true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user