Improve multi-file test framework in CodegenTestCase
Instead of inheriting from KotlinMultiFileTestWithJava, invoke KotlinTestUtils.createTestFiles directly. This helps to avoid constructing unnecessary environment (createEnvironment() was called in setUp, but codegen tests ignored the created environment because it's not possible to do generically in codegen tests; the environment kind depends on the source file usually)
This commit is contained in:
@@ -45,16 +45,15 @@ import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.jetbrains.kotlin.codegen.CodegenTestUtil.compileJava;
|
||||
|
||||
public abstract class AbstractBlackBoxCodegenTest extends CodegenTestCase {
|
||||
@Override
|
||||
protected void doMultiFileTest(File file, Map<String, ModuleAndDependencies> modules, List<TestFile> files) throws Exception {
|
||||
protected void doMultiFileTest(@NotNull File wholeFile, @NotNull List<TestFile> files, @Nullable File javaFilesDir) throws Exception {
|
||||
if (files.size() == 1) {
|
||||
createEnvironmentWithMockJdkAndIdeaAnnotations(ConfigurationKind.JDK_ONLY);
|
||||
blackBoxFileByFullPath(file.getPath());
|
||||
blackBoxFileByFullPath(wholeFile.getPath());
|
||||
}
|
||||
else {
|
||||
doTestMultiFile(files);
|
||||
|
||||
Reference in New Issue
Block a user