Allow custom expected result for fast class reading tests

This commit is contained in:
Denis Zharkov
2017-06-23 15:10:02 +03:00
parent bc564af2fc
commit c8a2de0243
4 changed files with 103 additions and 1 deletions
@@ -85,6 +85,11 @@ public abstract class AbstractLoadJavaTest extends TestCaseWithTmpdir {
checkJavaPackage(expectedFile, binaryPackageAndContext.first, binaryPackageAndContext.second, COMPARATOR_CONFIGURATION);
}
@NotNull
protected File getExpectedFile(@NotNull String expectedFileName) {
return new File(expectedFileName);
}
protected void doTestCompiledJavaIncludeObjectMethods(@NotNull String javaFileName) throws Exception {
doTestCompiledJava(javaFileName, RECURSIVE.renderDeclarationsFromOtherModules(true));
}
@@ -243,7 +248,7 @@ public abstract class AbstractLoadJavaTest extends TestCaseWithTmpdir {
srcFiles, compiledDir, ConfigurationKind.ALL
);
checkJavaPackage(getTxtFile(javaFileName), javaPackageAndContext.first, javaPackageAndContext.second, configuration);
checkJavaPackage(getExpectedFile(javaFileName.replaceFirst("\\.java$", ".txt")), javaPackageAndContext.first, javaPackageAndContext.second, configuration);
}
@NotNull
@@ -16,6 +16,15 @@
package org.jetbrains.kotlin.jvm.compiler
import org.jetbrains.kotlin.test.KotlinTestUtils
import java.io.File
abstract class AbstractLoadJavaWithFastClassReadingTest : AbstractLoadJavaTest() {
override fun useFastClassFilesReading() = true
override fun getExpectedFile(expectedFileName: String): File {
val differentResultFile = KotlinTestUtils.replaceExtension(File(expectedFileName), "fast.txt")
if (differentResultFile.exists()) return differentResultFile
return super.getExpectedFile(expectedFileName)
}
}