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")
|
||||
}
|
||||
|
||||
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")
|
||||
fun genTopLevelNonImportedExtFun() {
|
||||
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;
|
||||
|
||||
import com.intellij.openapi.roots.OrderRootType;
|
||||
import com.intellij.openapi.roots.ui.configuration.libraryEditor.NewLibraryEditor;
|
||||
import com.intellij.openapi.vfs.VfsUtil;
|
||||
import com.intellij.testFramework.fixtures.impl.CodeInsightTestFixtureImpl;
|
||||
import com.intellij.testFramework.LightProjectDescriptor;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.plugin.JdkAndMockLibraryProjectDescriptor;
|
||||
import org.jetbrains.jet.plugin.PluginTestCaseBase;
|
||||
import org.jetbrains.jet.testing.ConfigLibraryUtil;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public final class OverrideImplementWithLibTest extends AbstractOverrideImplementTest {
|
||||
|
||||
private static final String TEST_PATH = PluginTestCaseBase.getTestDataPathBase() + "/codeInsight/overrideImplement/withLib";
|
||||
|
||||
@Override
|
||||
@@ -35,24 +30,13 @@ public final class OverrideImplementWithLibTest extends AbstractOverrideImplemen
|
||||
myFixture.setTestDataPath(TEST_PATH);
|
||||
}
|
||||
|
||||
public void doTestWithLib() {
|
||||
File dependency = new File(TEST_PATH + "/" + getTestName(true) + ".jar");
|
||||
assert dependency.exists();
|
||||
NewLibraryEditor editor = new NewLibraryEditor();
|
||||
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());
|
||||
}
|
||||
@NotNull
|
||||
@Override
|
||||
protected LightProjectDescriptor getProjectDescriptor() {
|
||||
return new JdkAndMockLibraryProjectDescriptor(TEST_PATH + "/" + getTestName(true) + "Src", false);
|
||||
}
|
||||
|
||||
public void testFakeOverride() throws Exception {
|
||||
doTestWithLib();
|
||||
public void testFakeOverride() {
|
||||
doOverrideFileTest();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user