Drop single-file mode of black box codegen tests
Add regression test for #KT-5190
This commit is contained in:
+6
@@ -89,6 +89,12 @@ public class BlackBoxWithJava8CodegenTestGenerated extends AbstractBlackBoxCodeg
|
|||||||
doTest(fileName);
|
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")
|
@TestMetadata("compiler/testData/codegen/java8/box/reflection")
|
||||||
@TestDataPath("$PROJECT_ROOT")
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
@RunWith(JUnit3RunnerWithInners.class)
|
@RunWith(JUnit3RunnerWithInners.class)
|
||||||
|
|||||||
@@ -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 {
|
public abstract class AbstractBlackBoxCodegenTest extends CodegenTestCase {
|
||||||
@Override
|
@Override
|
||||||
protected void doMultiFileTest(@NotNull File wholeFile, @NotNull List<TestFile> files, @Nullable File javaFilesDir) throws Exception {
|
protected void doMultiFileTest(@NotNull File wholeFile, @NotNull List<TestFile> files, @Nullable File javaFilesDir) throws Exception {
|
||||||
if (files.size() == 1) {
|
TestJdkKind jdkKind = TestJdkKind.MOCK_JDK;
|
||||||
createEnvironmentWithMockJdkAndIdeaAnnotations(ConfigurationKind.JDK_ONLY);
|
List<String> javacOptions = new ArrayList<String>(0);
|
||||||
blackBoxFileByFullPath(wholeFile.getPath());
|
for (TestFile file : files) {
|
||||||
}
|
if (isFullJdkDirectiveDefined(file.content)) {
|
||||||
else {
|
jdkKind = TestJdkKind.FULL_JDK;
|
||||||
doTestMultiFile(files, javaFilesDir);
|
break;
|
||||||
|
}
|
||||||
|
javacOptions.addAll(InTextDirectivesUtils.findListWithPrefixes(file.content, "// JAVAC_OPTIONS:"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
compileAndRun(files, javaFilesDir, jdkKind, javacOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void doTestWithStdlib(@NotNull String filename) {
|
protected void doTestWithStdlib(@NotNull String filename) {
|
||||||
@@ -76,20 +80,6 @@ public abstract class AbstractBlackBoxCodegenTest extends CodegenTestCase {
|
|||||||
blackBoxFileByFullPath(filename);
|
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(
|
protected void compileAndRun(
|
||||||
@NotNull List<TestFile> files,
|
@NotNull List<TestFile> files,
|
||||||
@Nullable File javaSourceDir,
|
@Nullable File javaSourceDir,
|
||||||
|
|||||||
Reference in New Issue
Block a user