[Tests] Introduce runTest with transformer to old testing framework

This commit is contained in:
Evgeniy.Zhelenskiy
2021-12-05 04:39:30 +03:00
parent c27b647ce8
commit af73034235
6 changed files with 19 additions and 29 deletions
@@ -55,11 +55,12 @@ abstract class BasicWasmBoxTest(
TODO("TestWithCoroutinesPackageReplacement are not supported")
}
fun doTest(filePath: String) {
fun doTest(filePath: String) = doTestWithTransformer(filePath) { it }
fun doTestWithTransformer(filePath: String, transformer: java.util.function.Function<String, String>) {
val file = File(filePath)
val outputDir = getOutputDir(file)
val fileContent = KtTestUtil.doLoadFile(file)
val fileContent = transformer.apply(KtTestUtil.doLoadFile(file))
TestFileFactoryImpl().use { testFactory ->
val inputFiles: MutableList<TestFile> = TestFiles.createTestFiles(file.name, fileContent, testFactory, true)
@@ -12423,7 +12423,7 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest
}
private void runTest(String testDataFilePath, java.util.function.Function<String, String> transformer) throws Exception {
KotlinTestUtils.runTest0(this::doTest, TargetBackend.WASM, testDataFilePath, transformer);
KotlinTestUtils.runTest0(path -> doTestWithTransformer(path, transformer), TargetBackend.WASM, testDataFilePath);
}
public void testAllFilesPresentInInlineClasses() throws Exception {