Drop single-file mode of black box codegen tests

Add regression test for #KT-5190
This commit is contained in:
Alexander Udalov
2016-03-01 19:24:31 +03:00
parent 2de7f38427
commit 933be1e035
3 changed files with 29 additions and 20 deletions
@@ -89,6 +89,12 @@ public class BlackBoxWithJava8CodegenTestGenerated extends AbstractBlackBoxCodeg
doTest(fileName);
}
@TestMetadata("useStream.kt")
public void testUseStream() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/java8/box/useStream.kt");
doTest(fileName);
}
@TestMetadata("compiler/testData/codegen/java8/box/reflection")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
+13
View File
@@ -0,0 +1,13 @@
// KT-5190 Java 8 Stream.collect couldn't be called
// FULL_JDK
import java.util.stream.Collectors
import java.util.stream.Stream
fun box(): String {
val mutableListOf = mutableListOf("OK", "B", "C")
return test((mutableListOf as java.util.Collection<String>).stream()) as String
}
fun test(a: Stream<String>) = a.collect(Collectors.toList()).first()
@@ -55,13 +55,17 @@ import static org.jetbrains.kotlin.test.KotlinTestUtils.getAnnotationsJar;
public abstract class AbstractBlackBoxCodegenTest extends CodegenTestCase {
@Override
protected void doMultiFileTest(@NotNull File wholeFile, @NotNull List<TestFile> files, @Nullable File javaFilesDir) throws Exception {
if (files.size() == 1) {
createEnvironmentWithMockJdkAndIdeaAnnotations(ConfigurationKind.JDK_ONLY);
blackBoxFileByFullPath(wholeFile.getPath());
}
else {
doTestMultiFile(files, javaFilesDir);
TestJdkKind jdkKind = TestJdkKind.MOCK_JDK;
List<String> javacOptions = new ArrayList<String>(0);
for (TestFile file : files) {
if (isFullJdkDirectiveDefined(file.content)) {
jdkKind = TestJdkKind.FULL_JDK;
break;
}
javacOptions.addAll(InTextDirectivesUtils.findListWithPrefixes(file.content, "// JAVAC_OPTIONS:"));
}
compileAndRun(files, javaFilesDir, jdkKind, javacOptions);
}
protected void doTestWithStdlib(@NotNull String filename) {
@@ -76,20 +80,6 @@ public abstract class AbstractBlackBoxCodegenTest extends CodegenTestCase {
blackBoxFileByFullPath(filename);
}
private void doTestMultiFile(@NotNull List<TestFile> files, @Nullable File javaSourceDir) {
TestJdkKind jdkKind = TestJdkKind.MOCK_JDK;
List<String> javacOptions = new ArrayList<String>(0);
for (TestFile file : files) {
if (isFullJdkDirectiveDefined(file.content)) {
jdkKind = TestJdkKind.FULL_JDK;
break;
}
javacOptions.addAll(InTextDirectivesUtils.findListWithPrefixes(file.content, "// JAVAC_OPTIONS:"));
}
compileAndRun(files, javaSourceDir, jdkKind, javacOptions);
}
protected void compileAndRun(
@NotNull List<TestFile> files,
@Nullable File javaSourceDir,