Make BlackBox tests for Java 9 generated
This commit is contained in:
+1
-5
@@ -7,8 +7,4 @@ fun box(): String {
|
|||||||
val s = a + "1" + "2" + 3 + 4L + b + 5.0 + 6F + '7' + true + false + 3147483647u + p
|
val s = a + "1" + "2" + 3 + 4L + b + 5.0 + 6F + '7' + true + false + 3147483647u + p
|
||||||
|
|
||||||
return if (s != "_1234_5.06.07truefalse31474836473147483648") "fail $s" else "OK"
|
return if (s != "_1234_5.06.07truefalse31474836473147483648") "fail $s" else "OK"
|
||||||
}
|
}
|
||||||
|
|
||||||
fun main() {
|
|
||||||
box().let { if (it != "OK") throw AssertionError(it) }
|
|
||||||
}
|
|
||||||
+1
-5
@@ -15,8 +15,4 @@ fun box(): String {
|
|||||||
|
|
||||||
return if (result.length != 200)
|
return if (result.length != 200)
|
||||||
"fail: ${result.length}" else "OK"
|
"fail: ${result.length}" else "OK"
|
||||||
}
|
}
|
||||||
|
|
||||||
fun main() {
|
|
||||||
box().let { if (it != "OK") throw AssertionError(it) }
|
|
||||||
}
|
|
||||||
+1
-5
@@ -16,8 +16,4 @@ fun box(): String {
|
|||||||
|
|
||||||
return if (result.length != 201)
|
return if (result.length != 201)
|
||||||
"fail: ${result.length}" else "OK"
|
"fail: ${result.length}" else "OK"
|
||||||
}
|
}
|
||||||
|
|
||||||
fun main() {
|
|
||||||
box().let { if (it != "OK") throw AssertionError(it) }
|
|
||||||
}
|
|
||||||
@@ -15,8 +15,4 @@ fun box(): String {
|
|||||||
|
|
||||||
return if (result.length != 200)
|
return if (result.length != 200)
|
||||||
"fail: ${result.length}" else "OK"
|
"fail: ${result.length}" else "OK"
|
||||||
}
|
}
|
||||||
|
|
||||||
fun main() {
|
|
||||||
box().let { if (it != "OK") throw AssertionError(it) }
|
|
||||||
}
|
|
||||||
@@ -16,8 +16,4 @@ fun box(): String {
|
|||||||
|
|
||||||
return if (result.length != 201)
|
return if (result.length != 201)
|
||||||
"fail: ${result.length}" else "OK"
|
"fail: ${result.length}" else "OK"
|
||||||
}
|
}
|
||||||
|
|
||||||
fun main() {
|
|
||||||
box().let { if (it != "OK") throw AssertionError(it) }
|
|
||||||
}
|
|
||||||
@@ -24,8 +24,4 @@ fun box(): String {
|
|||||||
if (test5 != "2nullnull") return "fail 5: $test5"
|
if (test5 != "2nullnull") return "fail 5: $test5"
|
||||||
|
|
||||||
return "OK"
|
return "OK"
|
||||||
}
|
|
||||||
|
|
||||||
fun main() {
|
|
||||||
box().let { if (it != "OK") throw AssertionError(it) }
|
|
||||||
}
|
}
|
||||||
@@ -18,8 +18,4 @@ fun box(): String {
|
|||||||
|
|
||||||
val result2 = test { it + "_" }
|
val result2 = test { it + "_" }
|
||||||
return if (result2 != "12_3456_789_10") "fail 2: $result2" else "OK"
|
return if (result2 != "12_3456_789_10") "fail 2: $result2" else "OK"
|
||||||
}
|
|
||||||
|
|
||||||
fun main() {
|
|
||||||
box().let { if (it != "OK") throw AssertionError(it) }
|
|
||||||
}
|
}
|
||||||
+1
-5
@@ -31,8 +31,4 @@ fun box(): String {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return if (handle.getVolatile(array, index) == newValue) "OK" else "Fail"
|
return if (handle.getVolatile(array, index) == newValue) "OK" else "Fail"
|
||||||
}
|
}
|
||||||
|
|
||||||
fun main() {
|
|
||||||
box().let { if (it != "OK") throw AssertionError(it) }
|
|
||||||
}
|
|
||||||
+16
@@ -0,0 +1,16 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||||
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.jetbrains.kotlin.codegen
|
||||||
|
|
||||||
|
import org.jetbrains.kotlin.test.KotlinTestUtils
|
||||||
|
import org.jetbrains.kotlin.test.TestJdkKind
|
||||||
|
import java.io.File
|
||||||
|
|
||||||
|
abstract class AbstractJdk9BlackBoxCodegenTest : AbstractCustomJDKBlackBoxCodegenTest() {
|
||||||
|
override fun getTestJdkKind(): TestJdkKind = TestJdkKind.FULL_JDK_9
|
||||||
|
override fun getJdkHome(): File = KotlinTestUtils.getJdk9Home()
|
||||||
|
override fun getPrefix(): String = "java9/box"
|
||||||
|
}
|
||||||
@@ -1,89 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
|
||||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.jetbrains.kotlin.codegen
|
|
||||||
|
|
||||||
import org.jetbrains.kotlin.cli.common.output.writeAll
|
|
||||||
import org.jetbrains.kotlin.codegen.forTestCompile.ForTestCompileRuntime
|
|
||||||
import org.jetbrains.kotlin.load.kotlin.PackagePartClassUtils
|
|
||||||
import org.jetbrains.kotlin.test.ConfigurationKind
|
|
||||||
import org.jetbrains.kotlin.test.KotlinTestUtils
|
|
||||||
import org.jetbrains.kotlin.test.TestJdkKind
|
|
||||||
import java.io.File
|
|
||||||
import java.util.concurrent.TimeUnit
|
|
||||||
|
|
||||||
// TODO: merge into main codegen box tests somehow
|
|
||||||
class Java9CodegenTest : AbstractBlackBoxCodegenTest() {
|
|
||||||
override fun setUp() {
|
|
||||||
super.setUp()
|
|
||||||
val fileName = KotlinTestUtils.getTestDataPathBase() + "/codegen/" + prefix + "/" + getTestName(true) + ".kt"
|
|
||||||
val testFile = TestFile(fileName, File(fileName).readText())
|
|
||||||
createEnvironmentWithMockJdkAndIdeaAnnotations(ConfigurationKind.NO_KOTLIN_REFLECT, listOf(testFile), TestJdkKind.FULL_JDK_9)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getPrefix(): String = "java9/box"
|
|
||||||
|
|
||||||
override fun blackBox(reportFailures: Boolean) {
|
|
||||||
val tmpdir = KotlinTestUtils.tmpDirForTest(this)
|
|
||||||
generateClassesInFile().writeAll(tmpdir, null)
|
|
||||||
|
|
||||||
val jdk9Home = KotlinTestUtils.getJdk9Home()
|
|
||||||
val javaExe = File(jdk9Home, "bin/java.exe").takeIf(File::exists)
|
|
||||||
?: File(jdk9Home, "bin/java").takeIf(File::exists)
|
|
||||||
?: error("Can't find 'java' executable in $jdk9Home")
|
|
||||||
|
|
||||||
val command = arrayOf(
|
|
||||||
javaExe.absolutePath,
|
|
||||||
"-ea",
|
|
||||||
"-classpath",
|
|
||||||
listOf(tmpdir, ForTestCompileRuntime.runtimeJarForTests()).joinToString(File.pathSeparator, transform = File::getAbsolutePath),
|
|
||||||
PackagePartClassUtils.getFilePartShortName(getTestName(false))
|
|
||||||
)
|
|
||||||
|
|
||||||
val process = ProcessBuilder(*command).inheritIO().start()
|
|
||||||
process.waitFor(1, TimeUnit.MINUTES)
|
|
||||||
assertEquals(0, process.exitValue())
|
|
||||||
}
|
|
||||||
|
|
||||||
fun testVarHandle() {
|
|
||||||
loadFile()
|
|
||||||
blackBox(true)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun testConcatDynamic() {
|
|
||||||
loadFile()
|
|
||||||
blackBox(true)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun testConcatDynamic200() {
|
|
||||||
loadFile()
|
|
||||||
blackBox(true)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun testConcatDynamic201() {
|
|
||||||
loadFile()
|
|
||||||
blackBox(true)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun testConcatDynamicIndy200() {
|
|
||||||
loadFile()
|
|
||||||
blackBox(true)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun testConcatDynamicIndy201() {
|
|
||||||
loadFile()
|
|
||||||
blackBox(true)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun testConcatDynamicWithInline() {
|
|
||||||
loadFile()
|
|
||||||
blackBox(true)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun testConcatDynamicInlineClasses() {
|
|
||||||
loadFile()
|
|
||||||
blackBox(true)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+70
@@ -0,0 +1,70 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||||
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.jetbrains.kotlin.codegen;
|
||||||
|
|
||||||
|
import com.intellij.testFramework.TestDataPath;
|
||||||
|
import org.jetbrains.kotlin.test.JUnit3RunnerWithInners;
|
||||||
|
import org.jetbrains.kotlin.test.KotlinTestUtils;
|
||||||
|
import org.jetbrains.kotlin.test.TestMetadata;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */
|
||||||
|
@SuppressWarnings("all")
|
||||||
|
@TestMetadata("compiler/testData/codegen/java9/box")
|
||||||
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
@RunWith(JUnit3RunnerWithInners.class)
|
||||||
|
public class Jdk9BlackBoxCodegenTestGenerated extends AbstractJdk9BlackBoxCodegenTest {
|
||||||
|
private void runTest(String testDataFilePath) throws Exception {
|
||||||
|
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testAllFilesPresentInBox() throws Exception {
|
||||||
|
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/java9/box"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("concatDynamic.kt")
|
||||||
|
public void testConcatDynamic() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/java9/box/concatDynamic.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("concatDynamic200.kt")
|
||||||
|
public void testConcatDynamic200() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/java9/box/concatDynamic200.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("concatDynamic201.kt")
|
||||||
|
public void testConcatDynamic201() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/java9/box/concatDynamic201.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("concatDynamicIndy200.kt")
|
||||||
|
public void testConcatDynamicIndy200() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/java9/box/concatDynamicIndy200.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("concatDynamicIndy201.kt")
|
||||||
|
public void testConcatDynamicIndy201() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/java9/box/concatDynamicIndy201.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("concatDynamicInlineClasses.kt")
|
||||||
|
public void testConcatDynamicInlineClasses() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/java9/box/concatDynamicInlineClasses.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("concatDynamicWithInline.kt")
|
||||||
|
public void testConcatDynamicWithInline() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/java9/box/concatDynamicWithInline.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("varHandle.kt")
|
||||||
|
public void testVarHandle() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/java9/box/varHandle.kt");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -215,6 +215,10 @@ fun main(args: Array<String>) {
|
|||||||
model("codegen/java15/box")
|
model("codegen/java15/box")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
testClass<AbstractJdk9BlackBoxCodegenTest> {
|
||||||
|
model("codegen/java9/box")
|
||||||
|
}
|
||||||
|
|
||||||
testClass<AbstractScriptCodegenTest> {
|
testClass<AbstractScriptCodegenTest> {
|
||||||
model("codegen/script", extension = "kts")
|
model("codegen/script", extension = "kts")
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user