[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
@@ -48,6 +48,7 @@ import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
import static org.jetbrains.kotlin.cli.common.output.OutputUtilsKt.writeAllTo;
@@ -515,9 +516,13 @@ public abstract class CodegenTestCase extends KotlinBaseTest<KotlinBaseTest.Test
@Override
protected void doTest(@NotNull String filePath) throws Exception {
doTestWithTransformer(filePath, s -> s);
}
protected void doTestWithTransformer(@NotNull String filePath, @NotNull Function<String, String> sourceTransformer) throws Exception {
File file = new File(filePath);
String expectedText = KtTestUtil.doLoadFile(file);
String expectedText = sourceTransformer.apply(KtTestUtil.doLoadFile(file));
List<TestFile> testFiles = createTestFilesFromFile(file, expectedText);
doMultiFileTest(file, testFiles);