Fix various tests and test data
Since we now distinguish between binaries and java source roots
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
$TESTDATA_DIR$/wrongKotlinSignature.kt
|
||||
-cp
|
||||
$TESTDATA_DIR$/wrongKotlinSignatureLib
|
||||
-d
|
||||
$TEMP_DIR$
|
||||
|
||||
+2
-1
@@ -42,6 +42,7 @@ import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import static org.jetbrains.kotlin.cli.jvm.config.ConfigPackage.addJavaSourceRoot;
|
||||
import static org.jetbrains.kotlin.cli.jvm.config.ConfigPackage.addJvmClasspathRoot;
|
||||
import static org.jetbrains.kotlin.codegen.CodegenTestUtil.compileJava;
|
||||
import static org.jetbrains.kotlin.load.kotlin.PackageClassUtils.getPackageClassFqName;
|
||||
@@ -144,7 +145,7 @@ public abstract class AbstractBlackBoxCodegenTest extends CodegenTestCase {
|
||||
CompilerConfiguration configuration = JetTestUtils.compilerConfigurationForTests(
|
||||
ConfigurationKind.ALL, TestJdkKind.MOCK_JDK, JetTestUtils.getAnnotationsJar()
|
||||
);
|
||||
addJvmClasspathRoot(configuration, dirFile);
|
||||
addJavaSourceRoot(configuration, dirFile);
|
||||
myEnvironment = KotlinCoreEnvironment.createForTests(getTestRootDisposable(), configuration, EnvironmentConfigFiles.JVM_CONFIG_FILES);
|
||||
loadFiles(ArrayUtil.toStringArray(ktFilePaths));
|
||||
classFileFactory =
|
||||
|
||||
@@ -111,7 +111,7 @@ public abstract class AbstractLoadJavaTest extends TestCaseWithTmpdir {
|
||||
Assert.assertEquals("test", packageFromSource.getName().asString());
|
||||
|
||||
PackageViewDescriptor packageFromBinary = LoadDescriptorUtil.loadTestPackageAndBindingContextFromJavaRoot(
|
||||
tmpdir, getTestRootDisposable(), TestJdkKind.MOCK_JDK, configurationKind
|
||||
tmpdir, getTestRootDisposable(), TestJdkKind.MOCK_JDK, configurationKind, true
|
||||
).first;
|
||||
|
||||
for (DeclarationDescriptor descriptor : packageFromBinary.getMemberScope().getAllDescriptors()) {
|
||||
@@ -140,10 +140,11 @@ public abstract class AbstractLoadJavaTest extends TestCaseWithTmpdir {
|
||||
});
|
||||
|
||||
CompilerConfiguration configuration = JetTestUtils.compilerConfigurationForTests(
|
||||
ConfigurationKind.JDK_ONLY, TestJdkKind.MOCK_JDK, tmpdir);
|
||||
ConfigurationKind.JDK_ONLY, TestJdkKind.MOCK_JDK);
|
||||
addKotlinSourceRoot(configuration, sourcesDir.getAbsolutePath());
|
||||
addJavaSourceRoot(configuration, new File("compiler/testData/loadJava/include"));
|
||||
|
||||
addJavaSourceRoot(configuration, tmpdir);
|
||||
|
||||
KotlinCoreEnvironment environment =
|
||||
KotlinCoreEnvironment.createForTests(getTestRootDisposable(), configuration, EnvironmentConfigFiles.JVM_CONFIG_FILES);
|
||||
|
||||
@@ -211,7 +212,7 @@ public abstract class AbstractLoadJavaTest extends TestCaseWithTmpdir {
|
||||
FileUtil.copy(originalJavaFile, new File(testPackageDir, originalJavaFile.getName()));
|
||||
|
||||
Pair<PackageViewDescriptor, BindingContext> javaPackageAndContext = loadTestPackageAndBindingContextFromJavaRoot(
|
||||
tmpdir, getTestRootDisposable(), TestJdkKind.MOCK_JDK, ConfigurationKind.JDK_ONLY
|
||||
tmpdir, getTestRootDisposable(), TestJdkKind.MOCK_JDK, ConfigurationKind.JDK_ONLY, false
|
||||
);
|
||||
|
||||
checkJavaPackage(expectedFile, javaPackageAndContext.first, javaPackageAndContext.second,
|
||||
@@ -258,7 +259,7 @@ public abstract class AbstractLoadJavaTest extends TestCaseWithTmpdir {
|
||||
@NotNull ConfigurationKind configurationKind
|
||||
) throws IOException {
|
||||
compileJavaWithAnnotationsJar(javaFiles, outDir);
|
||||
return loadTestPackageAndBindingContextFromJavaRoot(outDir, myTestRootDisposable, TestJdkKind.MOCK_JDK, configurationKind);
|
||||
return loadTestPackageAndBindingContextFromJavaRoot(outDir, myTestRootDisposable, TestJdkKind.MOCK_JDK, configurationKind, true);
|
||||
}
|
||||
|
||||
private static void checkJavaPackage(
|
||||
|
||||
@@ -46,10 +46,7 @@ import org.jetbrains.kotlin.test.TestJdkKind;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
|
||||
import static org.jetbrains.kotlin.test.JetTestUtils.createEnvironmentWithMockJdkAndIdeaAnnotations;
|
||||
|
||||
@@ -81,14 +78,25 @@ public final class LoadDescriptorUtil {
|
||||
@NotNull File javaRoot,
|
||||
@NotNull Disposable disposable,
|
||||
@NotNull TestJdkKind testJdkKind,
|
||||
@NotNull ConfigurationKind configurationKind
|
||||
@NotNull ConfigurationKind configurationKind,
|
||||
boolean isBinaryRoot
|
||||
) {
|
||||
List<File> javaBinaryRoots = new ArrayList<File>();
|
||||
javaBinaryRoots.add(JetTestUtils.getAnnotationsJar());
|
||||
|
||||
List<File> javaSourceRoots = new ArrayList<File>();
|
||||
javaSourceRoots.add(new File("compiler/testData/loadJava/include"));
|
||||
if (isBinaryRoot) {
|
||||
javaBinaryRoots.add(javaRoot);
|
||||
}
|
||||
else {
|
||||
javaSourceRoots.add(javaRoot);
|
||||
}
|
||||
CompilerConfiguration configuration = JetTestUtils.compilerConfigurationForTests(
|
||||
configurationKind,
|
||||
testJdkKind,
|
||||
JetTestUtils.getAnnotationsJar(),
|
||||
javaRoot,
|
||||
new File("compiler/testData/loadJava/include")
|
||||
javaBinaryRoots,
|
||||
javaSourceRoots
|
||||
);
|
||||
KotlinCoreEnvironment environment =
|
||||
KotlinCoreEnvironment.createForTests(disposable, configuration, EnvironmentConfigFiles.JVM_CONFIG_FILES);
|
||||
|
||||
+1
-1
@@ -90,7 +90,7 @@ public abstract class AbstractJvmRuntimeDescriptorLoaderTest : TestCaseWithTmpdi
|
||||
val actual = createReflectedPackageView(classLoader)
|
||||
|
||||
val expected = LoadDescriptorUtil.loadTestPackageAndBindingContextFromJavaRoot(
|
||||
tmpdir, getTestRootDisposable(), jdkKind, ConfigurationKind.ALL
|
||||
tmpdir, getTestRootDisposable(), jdkKind, ConfigurationKind.ALL, true
|
||||
).first
|
||||
|
||||
val comparatorConfiguration = Configuration(
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<sources path="s1"/>
|
||||
<sources path="s2"/>
|
||||
<!-- Java source roots -->
|
||||
<classpath path="java"/>
|
||||
<javaSourceRoots path="java"/>
|
||||
<!-- Classpath -->
|
||||
<classpath path="cp1"/>
|
||||
<classpath path="cp2"/>
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
<module name="name" outputDir="output">
|
||||
<sources path="s1"/>
|
||||
<sources path="s2"/>
|
||||
<!-- Java source roots -->
|
||||
<!-- Classpath -->
|
||||
<!-- Output directory, commented out -->
|
||||
<!--
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
<module name="name" outputDir="output">
|
||||
<sources path="s1"/>
|
||||
<sources path="s2"/>
|
||||
<!-- Java source roots -->
|
||||
<!-- Classpath -->
|
||||
<!-- Output directory, commented out -->
|
||||
<!--
|
||||
@@ -17,6 +18,7 @@
|
||||
<module name="name2" outputDir="output2">
|
||||
<sources path="s12"/>
|
||||
<sources path="s22"/>
|
||||
<!-- Java source roots -->
|
||||
<!-- Classpath -->
|
||||
<!-- Output directory, commented out -->
|
||||
<!--
|
||||
|
||||
Reference in New Issue
Block a user