Add WITH_RUNTIME and WITH_REFLECT directives to box tests

Currently all tests in boxWithStdlib/ run with both runtime and reflection
included; eventually they'll be merged into box/ using these directives
This commit is contained in:
Alexander Udalov
2016-03-03 15:40:33 +03:00
parent f47cc5ce2f
commit daab3db062
69 changed files with 162 additions and 95 deletions
@@ -51,6 +51,9 @@ import static org.jetbrains.kotlin.test.KotlinTestUtils.compilerConfigurationFor
import static org.jetbrains.kotlin.test.KotlinTestUtils.getAnnotationsJar;
public abstract class AbstractBlackBoxCodegenTest extends CodegenTestCase {
private boolean addRuntime = false;
private boolean addReflect = false;
@Override
protected void doMultiFileTest(@NotNull File wholeFile, @NotNull List<TestFile> files, @Nullable File javaFilesDir) throws Exception {
TestJdkKind jdkKind = TestJdkKind.MOCK_JDK;
@@ -59,18 +62,26 @@ public abstract class AbstractBlackBoxCodegenTest extends CodegenTestCase {
if (InTextDirectivesUtils.isDirectiveDefined(file.content, "FULL_JDK")) {
jdkKind = TestJdkKind.FULL_JDK;
}
if (InTextDirectivesUtils.isDirectiveDefined(file.content, "NO_KOTLIN_REFLECT")) {
configurationKind = ConfigurationKind.NO_KOTLIN_REFLECT;
if (InTextDirectivesUtils.isDirectiveDefined(file.content, "WITH_RUNTIME")) {
addRuntime = true;
}
if (InTextDirectivesUtils.isDirectiveDefined(file.content, "WITH_REFLECT")) {
addReflect = true;
}
javacOptions.addAll(InTextDirectivesUtils.findListWithPrefixes(file.content, "// JAVAC_OPTIONS:"));
}
configurationKind =
addReflect ? ConfigurationKind.ALL :
addRuntime ? ConfigurationKind.NO_KOTLIN_REFLECT :
ConfigurationKind.JDK_ONLY;
compileAndRun(files, javaFilesDir, jdkKind, javacOptions);
}
protected void doTestWithStdlib(@NotNull String filename) throws Exception {
configurationKind = ConfigurationKind.ALL;
addReflect = true;
doTest(filename);
}