Add FULL_JDK to tests in codegen/boxWithStdlib/fullJdk/

Drop the old scheme which relied on the directory name
This commit is contained in:
Alexander Udalov
2016-03-03 14:25:35 +03:00
parent dc085c45b7
commit d011fa8dc6
40 changed files with 119 additions and 89 deletions
@@ -72,8 +72,12 @@ public abstract class AbstractBlackBoxCodegenTest extends CodegenTestCase {
FilesKt.readText(new File(filename), Charsets.UTF_8), "NO_KOTLIN_REFLECT"
) ? ConfigurationKind.NO_KOTLIN_REFLECT : ConfigurationKind.ALL;
TestJdkKind jdkKind = isFullJdkDirectiveDefined(FilesKt.readText(new File(filename), Charsets.UTF_8))
? TestJdkKind.FULL_JDK
: TestJdkKind.MOCK_JDK;
myEnvironment = KotlinTestUtils.createEnvironmentWithJdkAndNullabilityAnnotationsFromIdea(
getTestRootDisposable(), configurationKind, getTestJdkKind(filename)
getTestRootDisposable(), configurationKind, jdkKind
);
blackBoxFileByFullPath(filename);
@@ -137,17 +141,6 @@ public abstract class AbstractBlackBoxCodegenTest extends CodegenTestCase {
return javaFilePaths;
}
// NOTE: tests under fullJdk/ are run with FULL_JDK instead of MOCK_JDK
@NotNull
private static TestJdkKind getTestJdkKind(@NotNull String sourcePath) {
if (sourcePath.contains("compiler/testData/codegen/boxWithStdlib/fullJdk")) {
return TestJdkKind.FULL_JDK;
}
String content = FilesKt.readText(new File(sourcePath), Charsets.UTF_8);
return isFullJdkDirectiveDefined(content) ? TestJdkKind.FULL_JDK : TestJdkKind.MOCK_JDK;
}
private static boolean isFullJdkDirectiveDefined(@NotNull String content) {
return InTextDirectivesUtils.isDirectiveDefined(content, "FULL_JDK");
}