Fix compileJavaAgainstKotlin tests
- Use another API to get file name out of a javac diagnostic (.getSource().getName()'s behavior changed in JDK 8) - Delete .txt files for those tests which check that javac reported a compilation error; the order and content of declarations in those files is undefined
This commit is contained in:
committed by
Dmitry Jemerov
parent
4edfd0d960
commit
3c96099f7c
+5
-3
@@ -65,12 +65,13 @@ public abstract class AbstractCompileJavaAgainstKotlinTest extends TestCaseWithT
|
||||
Assert.assertTrue(ktFilePath.endsWith(".kt"));
|
||||
File ktFile = new File(ktFilePath);
|
||||
File javaFile = new File(ktFilePath.replaceFirst("\\.kt$", ".java"));
|
||||
File expectedFile = new File(ktFilePath.replaceFirst("\\.kt$", ".txt"));
|
||||
File javaErrorFile = new File(ktFilePath.replaceFirst("\\.kt$", ".javaerr.txt"));
|
||||
|
||||
File out = new File(tmpdir, "out");
|
||||
compileKotlinWithJava(Collections.singletonList(javaFile), Collections.singletonList(ktFile),
|
||||
out, getTestRootDisposable(), javaErrorFile);
|
||||
boolean compiledSuccessfully =
|
||||
compileKotlinWithJava(Collections.singletonList(javaFile), Collections.singletonList(ktFile),
|
||||
out, getTestRootDisposable(), javaErrorFile);
|
||||
if (!compiledSuccessfully) return;
|
||||
|
||||
KotlinCoreEnvironment environment = KotlinCoreEnvironment.createForTests(
|
||||
getTestRootDisposable(),
|
||||
@@ -82,6 +83,7 @@ public abstract class AbstractCompileJavaAgainstKotlinTest extends TestCaseWithT
|
||||
PackageViewDescriptor packageView = analysisResult.getModuleDescriptor().getPackage(LoadDescriptorUtil.TEST_PACKAGE_FQNAME);
|
||||
assertFalse("Nothing found in package " + LoadDescriptorUtil.TEST_PACKAGE_FQNAME, packageView.isEmpty());
|
||||
|
||||
File expectedFile = new File(ktFilePath.replaceFirst("\\.kt$", ".txt"));
|
||||
validateAndCompareDescriptorWithFile(packageView, CONFIGURATION, expectedFile);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user