[TEST] Drop machinery about experimental coroutines from compiler tests

This commit is contained in:
Dmitriy Novozhilov
2020-12-01 17:46:41 +03:00
committed by TeamCityServer
parent 8c4b7ad1e1
commit aacf934b49
19 changed files with 31 additions and 122 deletions
@@ -68,11 +68,7 @@ public abstract class AbstractBlackBoxCodegenTest extends CodegenTestCase {
private void doBytecodeListingTest(@NotNull File wholeFile) throws Exception {
if (!InTextDirectivesUtils.isDirectiveDefined(FileUtil.loadFile(wholeFile), "CHECK_BYTECODE_LISTING")) return;
String suffix =
(coroutinesPackage.equals(StandardNames.COROUTINES_PACKAGE_FQ_NAME_EXPERIMENTAL.asString()) || coroutinesPackage.isEmpty())
&& InTextDirectivesUtils.isDirectiveDefined(FileUtil.loadFile(wholeFile), "COMMON_COROUTINES_TEST")
? "_1_2" :
getBackend().isIR() ? "_ir" : "";
String suffix = getBackend().isIR() ? "_ir" : "";
File expectedFile = new File(wholeFile.getParent(), FilesKt.getNameWithoutExtension(wholeFile) + suffix + ".txt");
String text =
@@ -101,7 +97,7 @@ public abstract class AbstractBlackBoxCodegenTest extends CodegenTestCase {
}
);
assertEqualsToFile(expectedFile, text, s -> s.replace("COROUTINES_PACKAGE", coroutinesPackage));
assertEqualsToFile(expectedFile, text);
}
protected void blackBox(boolean reportProblems, boolean unexpectedBehaviour) {
@@ -31,8 +31,7 @@ abstract class AbstractBytecodeListingTest : CodegenTestCase() {
)
val prefixes = when {
backend.isIR -> listOf("_ir", "_1_3", "")
coroutinesPackage == StandardNames.COROUTINES_PACKAGE_FQ_NAME_RELEASE.asString() -> listOf("_1_3", "")
backend.isIR -> listOf("_ir", "")
else -> listOf("")
}
@@ -19,9 +19,7 @@ abstract class AbstractDumpDeclarationsTest : CodegenTestCase() {
dumpToFile = KotlinTestUtils.tmpDirForTest(this).resolve("$name.json")
compile(files)
classFileFactory.generationState.destroy()
KotlinTestUtils.assertEqualsToFile(expectedResult, dumpToFile.readText()) {
it.replace("COROUTINES_PACKAGE", coroutinesPackage)
}
KotlinTestUtils.assertEqualsToFile(expectedResult, dumpToFile.readText())
}
override fun updateConfiguration(configuration: CompilerConfiguration) {
@@ -607,32 +607,21 @@ public abstract class CodegenTestCase extends KotlinBaseTest<KotlinBaseTest.Test
File file = new File(filePath);
String expectedText = KotlinTestUtils.doLoadFile(file);
if (!coroutinesPackage.isEmpty()) {
expectedText = expectedText.replace("COROUTINES_PACKAGE", coroutinesPackage);
}
List<TestFile> testFiles = createTestFilesFromFile(file, expectedText);
doMultiFileTest(file, testFiles);
}
@Override
protected void doTestWithCoroutinesPackageReplacement(@NotNull String filePath, @NotNull String packageName) throws Exception {
this.coroutinesPackage = packageName;
doTest(filePath);
}
@Override
@NotNull
protected List<TestFile> createTestFilesFromFile(@NotNull File file, @NotNull String expectedText) {
return createTestFilesFromFile(file, expectedText, coroutinesPackage, parseDirectivesPerFiles(), getBackend());
return createTestFilesFromFile(file, expectedText, parseDirectivesPerFiles(), getBackend());
}
@NotNull
public static List<TestFile> createTestFilesFromFile(
@NotNull File file,
@NotNull String expectedText,
@NotNull String coroutinesPackage,
boolean parseDirectivesPerFiles,
@NotNull TargetBackend backend
) {
@@ -643,7 +632,7 @@ public abstract class CodegenTestCase extends KotlinBaseTest<KotlinBaseTest.Test
public TestFile create(@NotNull String fileName, @NotNull String text, @NotNull Directives directives) {
return new TestFile(fileName, text, directives);
}
}, false, coroutinesPackage, parseDirectivesPerFiles);
}, false, parseDirectivesPerFiles);
if (InTextDirectivesUtils.isDirectiveDefined(expectedText, "WITH_HELPERS")) {
testFiles.add(new TestFile("CodegenTestHelpers.kt", TestHelperGeneratorKt.createTextForCodegenTestHelpers(backend)));
}