Refactor OverrideImplementWithLibTest
Use JdkAndMockLibraryProjectDescriptor instead of a jar file, which needs to be regenerated every time binary format changes
This commit is contained in:
@@ -78,12 +78,6 @@ private object BinaryTestData {
|
|||||||
rm("test")
|
rm("test")
|
||||||
}
|
}
|
||||||
|
|
||||||
GenScript("idea/testData/codeInsight/overrideImplement/withLib", "source.kt", "fakeOverride.jar")
|
|
||||||
fun genFakeOverride() {
|
|
||||||
jar("fakeOverride.jar", "dependency")
|
|
||||||
rm("dependency")
|
|
||||||
}
|
|
||||||
|
|
||||||
GenScript("idea/testData/completion/basic/custom/", "TopLevelNonImportedExtFunSource.kt", "TopLevelNonImportedExtFun.jar")
|
GenScript("idea/testData/completion/basic/custom/", "TopLevelNonImportedExtFunSource.kt", "TopLevelNonImportedExtFun.jar")
|
||||||
fun genTopLevelNonImportedExtFun() {
|
fun genTopLevelNonImportedExtFun() {
|
||||||
jar("TopLevelNonImportedExtFun.jar", "abc")
|
jar("TopLevelNonImportedExtFun.jar", "abc")
|
||||||
|
|||||||
Binary file not shown.
@@ -0,0 +1,5 @@
|
|||||||
|
package dependency
|
||||||
|
|
||||||
|
public open class A {
|
||||||
|
public open fun foo() {}
|
||||||
|
}
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
package dependency
|
|
||||||
|
|
||||||
// To regenerate this test, run CompileBinaryTestData.kt
|
|
||||||
// Or manually, compile this file into jar
|
|
||||||
|
|
||||||
public open class A {
|
|
||||||
public open fun foo() {}
|
|
||||||
}
|
|
||||||
@@ -16,17 +16,12 @@
|
|||||||
|
|
||||||
package org.jetbrains.jet.plugin.codeInsight;
|
package org.jetbrains.jet.plugin.codeInsight;
|
||||||
|
|
||||||
import com.intellij.openapi.roots.OrderRootType;
|
import com.intellij.testFramework.LightProjectDescriptor;
|
||||||
import com.intellij.openapi.roots.ui.configuration.libraryEditor.NewLibraryEditor;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import com.intellij.openapi.vfs.VfsUtil;
|
import org.jetbrains.jet.plugin.JdkAndMockLibraryProjectDescriptor;
|
||||||
import com.intellij.testFramework.fixtures.impl.CodeInsightTestFixtureImpl;
|
|
||||||
import org.jetbrains.jet.plugin.PluginTestCaseBase;
|
import org.jetbrains.jet.plugin.PluginTestCaseBase;
|
||||||
import org.jetbrains.jet.testing.ConfigLibraryUtil;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
|
|
||||||
public final class OverrideImplementWithLibTest extends AbstractOverrideImplementTest {
|
public final class OverrideImplementWithLibTest extends AbstractOverrideImplementTest {
|
||||||
|
|
||||||
private static final String TEST_PATH = PluginTestCaseBase.getTestDataPathBase() + "/codeInsight/overrideImplement/withLib";
|
private static final String TEST_PATH = PluginTestCaseBase.getTestDataPathBase() + "/codeInsight/overrideImplement/withLib";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -35,24 +30,13 @@ public final class OverrideImplementWithLibTest extends AbstractOverrideImplemen
|
|||||||
myFixture.setTestDataPath(TEST_PATH);
|
myFixture.setTestDataPath(TEST_PATH);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void doTestWithLib() {
|
@NotNull
|
||||||
File dependency = new File(TEST_PATH + "/" + getTestName(true) + ".jar");
|
@Override
|
||||||
assert dependency.exists();
|
protected LightProjectDescriptor getProjectDescriptor() {
|
||||||
NewLibraryEditor editor = new NewLibraryEditor();
|
return new JdkAndMockLibraryProjectDescriptor(TEST_PATH + "/" + getTestName(true) + "Src", false);
|
||||||
editor.setName("dependency");
|
|
||||||
editor.addRoot(VfsUtil.getUrlForLibraryRoot(dependency), OrderRootType.CLASSES);
|
|
||||||
|
|
||||||
try {
|
|
||||||
ConfigLibraryUtil.configureLibrary(myModule, getProjectDescriptor().getSdk(), editor);
|
|
||||||
CodeInsightTestFixtureImpl.ensureIndexesUpToDate(getProject());
|
|
||||||
doOverrideFileTest();
|
|
||||||
}
|
|
||||||
finally {
|
|
||||||
ConfigLibraryUtil.unConfigureLibrary(myModule, getProjectDescriptor().getSdk(), editor.getName());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testFakeOverride() throws Exception {
|
public void testFakeOverride() {
|
||||||
doTestWithLib();
|
doOverrideFileTest();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user