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
@@ -1,2 +0,0 @@
fun box(): String =
listOf("a").map { "OK" }.get(0)
@@ -1,3 +1,5 @@
// FULL_JDK
import java.nio.CharBuffer
fun box(): String {
@@ -1,3 +1,5 @@
// FULL_JDK
import sun.nio.cs.ext.Big5
import sun.net.spi.nameservice.dns.DNSNameService
import javax.crypto.Cipher
@@ -11,4 +13,4 @@ fun box(): String {
val f : SunJCE? = null // sunjce_provider.jar
val j : ByteBuffered? = null // rt.jar
return "OK"
}
}
@@ -1,3 +1,5 @@
// FULL_JDK
@file:JvmName("XYZ")
import java.lang.reflect.Modifier
@@ -1,4 +1,4 @@
import java.lang.Runtime
// FULL_JDK
fun box() : String {
val processors = Runtime.getRuntime()!!.availableProcessors()
@@ -1,3 +1,5 @@
// FULL_JDK
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.locks.ReentrantLock;
@@ -1,3 +1,5 @@
// FULL_JDK
import java.lang.reflect.Modifier
import kotlin.reflect.KProperty
@@ -1,3 +1,5 @@
// FULL_JDK
import java.util.LinkedList
fun ok1(): Boolean {
+3 -1
View File
@@ -1,3 +1,5 @@
// FULL_JDK
import java.net.*
fun String.decodeURI(encoding : String) : String? =
@@ -10,4 +12,4 @@ fun String.decodeURI(encoding : String) : String? =
fun box() : String {
return if("hhh".decodeURI("") == null) "OK" else "fail"
}
}
@@ -1,3 +1,5 @@
// FULL_JDK
import java.lang.reflect.Modifier
public class A {
@@ -19,10 +21,10 @@ public class A {
return if (cond.isEmpty()) "OK" else cond.joinToString()
}
return "EXCEPTION WAS NOT CATCHED"
return "EXCEPTION WAS NOT CAUGHT"
}
}
fun box(): String {
return A().test()
}
}
@@ -1,6 +1,6 @@
package foo
// FULL_JDK
import kotlin.jvm.*
package foo
object ObjWithNative {
external fun foo(x: Int = 1): Double
@@ -37,4 +37,4 @@ fun box(): String {
if (e.message != "foo.DefaultKt.topLevel(I)D") return "Fail 3: " + e.message
}
return "OK"
}
}
@@ -1,3 +1,5 @@
// FULL_JDK
class C {
companion object {
val defaultGetter: Int = 1
@@ -46,4 +48,4 @@ fun box(): String {
?: check({C().defaultSetter = 1}, "C.setDefaultSetter(I)V")
?: "OK"
}
}
@@ -1,4 +1,4 @@
import kotlin.jvm.*
// FULL_JDK
class C {
companion object {
@@ -20,4 +20,4 @@ fun box(): String {
}
return "OK"
}
}
@@ -1,3 +1,5 @@
// FULL_JDK
package foo
import kotlin.jvm.*
@@ -14,4 +16,4 @@ fun box(): String {
catch (e: java.lang.UnsatisfiedLinkError) {
return "OK"
}
}
}
@@ -1,6 +1,6 @@
package foo
// FULL_JDK
import kotlin.jvm.*
package foo
class WithNative {
companion object {
@@ -30,4 +30,4 @@ fun box(): String {
if (e.message != "foo.ObjWithNative.bar(JLjava/lang/String;)D") return "Fail 2: " + e.message
}
return "OK"
}
}
@@ -1,6 +1,6 @@
package foo
// FULL_JDK
import kotlin.jvm.*
package foo
external fun bar(l: Long, s: String): Double
@@ -16,4 +16,4 @@ fun box(): String {
}
return "OK"
}
}
@@ -1,3 +1,5 @@
// FULL_JDK
import java.util.*
fun box(): String {
@@ -1,3 +1,5 @@
// FULL_JDK
package collections
import kotlin.test.assertEquals
@@ -1,3 +1,5 @@
// FULL_JDK
package testeval
import java.util.*
@@ -1,3 +1,5 @@
// FULL_JDK
package pack
import java.util.ArrayList
@@ -1,3 +1,5 @@
// FULL_JDK
import org.w3c.dom.Element
import org.xml.sax.InputSource
import javax.xml.parsers.DocumentBuilderFactory
@@ -14,4 +16,4 @@ fun box() : String {
val doc = builder.parse(source)!!;
val myElement = MyElement(doc.getDocumentElement()!!)
return myElement.getTagName()!!
}
}
@@ -1,4 +1,4 @@
import kotlin.*
// FULL_JDK
fun box() : String {
val vector = java.util.Vector<Int>()
@@ -1,3 +1,5 @@
// FULL_JDK
package mask
import java.io.*
@@ -1,3 +1,5 @@
// FULL_JDK
package mask
import java.io.*
@@ -1,3 +1,5 @@
// FULL_JDK
package mask
import java.io.*
@@ -1,3 +1,5 @@
// FULL_JDK
import kotlin.test.assertEquals
import java.lang.reflect.ParameterizedType
import java.lang.reflect.Type
@@ -1,3 +1,5 @@
// FULL_JDK
import java.io.*
import java.util.*
@@ -1,3 +1,5 @@
// FULL_JDK
fun testProperLineNumber(): String {
var exceptionCount = 0;
try {
@@ -9,7 +11,7 @@ fun testProperLineNumber(): String {
catch(e: AssertionError) {
val entry = (e as java.lang.Throwable).getStackTrace()!!.get(1)
val actual = "${entry.getFileName()}:${entry.getLineNumber()}"
if ("chainCalls.kt:6" != actual) {
if ("chainCalls.kt:8" != actual) {
return "fail 1: ${actual}"
}
exceptionCount++
@@ -23,7 +25,7 @@ fun testProperLineNumber(): String {
catch(e: AssertionError) {
val entry = e.stackTrace!![1]
val actual = "${entry.getFileName()}:${entry.getLineNumber()}"
if ("chainCalls.kt:21" != actual) {
if ("chainCalls.kt:23" != actual) {
return "fail 2: ${actual}"
}
exceptionCount++
@@ -36,7 +38,7 @@ fun testProperLineNumber(): String {
catch(e: AssertionError) {
val entry = e.stackTrace!![1]
val actual = "${entry.getFileName()}:${entry.getLineNumber()}"
if ("chainCalls.kt:34" != actual) {
if ("chainCalls.kt:36" != actual) {
return "fail 3: ${actual}"
}
exceptionCount++
@@ -48,7 +50,7 @@ fun testProperLineNumber(): String {
catch(e: AssertionError) {
val entry = e.stackTrace!![1]
val actual = "${entry.getFileName()}:${entry.getLineNumber()}"
if ("chainCalls.kt:46" != actual) {
if ("chainCalls.kt:48" != actual) {
return "fail 4: ${actual}"
}
exceptionCount++
@@ -79,4 +81,4 @@ fun String.fail(): String {
fun call(): String {
return "xxx"
}
}
@@ -1,3 +1,5 @@
// FULL_JDK
fun testProperLineNumber(): String {
var exceptionCount = 0;
try {
@@ -7,7 +9,7 @@ fun testProperLineNumber(): String {
catch(e: AssertionError) {
val entry = (e as java.lang.Throwable).getStackTrace()!!.get(1)
val actual = "${entry.getFileName()}:${entry.getLineNumber()}"
if ("infixCalls.kt:4" != actual) {
if ("infixCalls.kt:6" != actual) {
return "fail 1: ${actual}"
}
exceptionCount++
@@ -20,7 +22,7 @@ fun testProperLineNumber(): String {
catch(e: AssertionError) {
val entry = e.stackTrace!![1]
val actual = "${entry.getFileName()}:${entry.getLineNumber()}"
if ("infixCalls.kt:17" != actual) {
if ("infixCalls.kt:19" != actual) {
return "fail 1: ${actual}"
}
exceptionCount++
@@ -32,7 +34,7 @@ fun testProperLineNumber(): String {
catch(e: AssertionError) {
val entry = e.stackTrace!![1]
val actual = "${entry.getFileName()}:${entry.getLineNumber()}"
if ("infixCalls.kt:30" != actual) {
if ("infixCalls.kt:32" != actual) {
return "fail 1: ${actual}"
}
exceptionCount++
@@ -59,4 +61,4 @@ infix fun String.fail(p: String): String {
fun call(): String {
return "xxx"
}
}
@@ -1,3 +1,5 @@
// FULL_JDK
fun testProperLineNumberAfterInline(): String {
var exceptionCount = 0;
try {
@@ -7,7 +9,7 @@ fun testProperLineNumberAfterInline(): String {
catch(e: AssertionError) {
val entry = (e as java.lang.Throwable).getStackTrace()!!.get(1)
val actual = "${entry.getFileName()}:${entry.getLineNumber()}"
if ("simpleCallWithParams.kt:4" != actual) {
if ("simpleCallWithParams.kt:6" != actual) {
return "fail 1: ${actual}"
}
exceptionCount++
@@ -20,7 +22,7 @@ fun testProperLineNumberAfterInline(): String {
catch(e: AssertionError) {
val entry = e.stackTrace!![1]
val actual = "${entry.getFileName()}:${entry.getLineNumber()}"
if ("simpleCallWithParams.kt:17" != actual) {
if ("simpleCallWithParams.kt:19" != actual) {
return "fail 2: ${actual}"
}
exceptionCount++
@@ -38,7 +40,7 @@ fun testProperLineForOtherParameters(): String {
catch(e: AssertionError) {
val entry = e.stackTrace!![1]
val actual = "${entry.getFileName()}:${entry.getLineNumber()}"
if ("simpleCallWithParams.kt:35" != actual) {
if ("simpleCallWithParams.kt:37" != actual) {
return "fail 3: ${actual}"
}
exceptionCount++
@@ -52,7 +54,7 @@ fun testProperLineForOtherParameters(): String {
catch(e: AssertionError) {
val entry = e.stackTrace!![1]
val actual = "${entry.getFileName()}:${entry.getLineNumber()}"
if ("simpleCallWithParams.kt:49" != actual) {
if ("simpleCallWithParams.kt:51" != actual) {
return "fail 4: ${actual}"
}
exceptionCount++
@@ -64,7 +66,7 @@ fun testProperLineForOtherParameters(): String {
catch(e: AssertionError) {
val entry = e.stackTrace!![1]
val actual = "${entry.getFileName()}:${entry.getLineNumber()}"
if ("simpleCallWithParams.kt:62" != actual) {
if ("simpleCallWithParams.kt:64" != actual) {
return "fail 5: ${actual}"
}
exceptionCount++
@@ -76,7 +78,7 @@ fun testProperLineForOtherParameters(): String {
catch(e: AssertionError) {
val entry = e.stackTrace!![1]
val actual = "${entry.getFileName()}:${entry.getLineNumber()}"
if ("simpleCallWithParams.kt:74" != actual) {
if ("simpleCallWithParams.kt:76" != actual) {
return "fail 6: ${actual}"
}
exceptionCount++
@@ -103,4 +105,4 @@ inline fun test(): String {
fun fail(): String {
throw AssertionError("fail")
}
}
@@ -1,3 +1,5 @@
// FULL_JDK
fun box(): String {
var obj0 = "0" as java.lang.Object
var obj1 = "1" as java.lang.Object
@@ -19,4 +21,4 @@ fun assertThatThreadDoesNotOwnMonitor(obj: java.lang.Object) {
catch (e: IllegalMonitorStateException) {
// OK
}
}
}
@@ -1,3 +1,5 @@
// FULL_JDK
fun box(): String {
val obj = "" as java.lang.Object
@@ -24,4 +26,4 @@ fun assertThatThreadDoesNotOwnMonitor(obj: java.lang.Object) {
catch (e: IllegalMonitorStateException) {
// OK
}
}
}
@@ -1,3 +1,5 @@
// FULL_JDK
import java.util.concurrent.CountDownLatch
import java.util.concurrent.TimeUnit
import java.util.concurrent.Executors
@@ -174,5 +176,3 @@ fun box(): String {
}
return "OK"
}
@@ -1,3 +1,5 @@
// FULL_JDK
import java.util.concurrent.*
import java.util.concurrent.atomic.*
@@ -30,4 +32,4 @@ fun box() : String {
}
cdl.await()
return if(mtref.get() == 100) "OK" else mtref.get().toString()
}
}
@@ -1,3 +1,5 @@
// FULL_JDK
fun box(): String {
val obj = "" as java.lang.Object
try {
@@ -13,4 +15,4 @@ fun box(): String {
}
return "OK"
}
}
@@ -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");
}
@@ -35,21 +35,6 @@ public class BlackBoxWithStdlibCodegenTestGenerated extends AbstractBlackBoxCode
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxWithStdlib"), Pattern.compile("^(.+)\\.kt$"), true);
}
@TestMetadata("compiler/testData/codegen/boxWithStdlib/againstMultifileStdlib")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class AgainstMultifileStdlib extends AbstractBlackBoxCodegenTest {
public void testAllFilesPresentInAgainstMultifileStdlib() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxWithStdlib/againstMultifileStdlib"), Pattern.compile("^(.+)\\.kt$"), true);
}
@TestMetadata("useStdlib.kt")
public void testUseStdlib() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithStdlib/againstMultifileStdlib/useStdlib.kt");
doTestWithStdlib(fileName);
}
}
@TestMetadata("compiler/testData/codegen/boxWithStdlib/annotations")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
@@ -1693,18 +1678,6 @@ public class BlackBoxWithStdlibCodegenTestGenerated extends AbstractBlackBoxCode
doTestWithStdlib(fileName);
}
@TestMetadata("genericBackingFieldSignature.kt")
public void testGenericBackingFieldSignature() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithStdlib/fullJdk/genericBackingFieldSignature.kt");
doTestWithStdlib(fileName);
}
@TestMetadata("genericMethodSignature.kt")
public void testGenericMethodSignature() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithStdlib/fullJdk/genericMethodSignature.kt");
doTestWithStdlib(fileName);
}
@TestMetadata("ifInWhile.kt")
public void testIfInWhile() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithStdlib/fullJdk/ifInWhile.kt");
@@ -1729,12 +1702,6 @@ public class BlackBoxWithStdlibCodegenTestGenerated extends AbstractBlackBoxCode
doTestWithStdlib(fileName);
}
@TestMetadata("kt2509.kt")
public void testKt2509() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithStdlib/fullJdk/kt2509.kt");
doTestWithStdlib(fileName);
}
@TestMetadata("kt434.kt")
public void testKt434() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithStdlib/fullJdk/kt434.kt");
@@ -3825,6 +3792,18 @@ public class BlackBoxWithStdlibCodegenTestGenerated extends AbstractBlackBoxCode
doTestWithStdlib(fileName);
}
@TestMetadata("genericBackingFieldSignature.kt")
public void testGenericBackingFieldSignature() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithStdlib/reflection/genericSignature/genericBackingFieldSignature.kt");
doTestWithStdlib(fileName);
}
@TestMetadata("genericMethodSignature.kt")
public void testGenericMethodSignature() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithStdlib/reflection/genericSignature/genericMethodSignature.kt");
doTestWithStdlib(fileName);
}
@TestMetadata("kt5112.kt")
public void testKt5112() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithStdlib/reflection/genericSignature/kt5112.kt");
@@ -4537,6 +4516,12 @@ public class BlackBoxWithStdlibCodegenTestGenerated extends AbstractBlackBoxCode
doTestWithStdlib(fileName);
}
@TestMetadata("kt2509.kt")
public void testKt2509() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithStdlib/regressions/kt2509.kt");
doTestWithStdlib(fileName);
}
@TestMetadata("kt2593.kt")
public void testKt2593() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithStdlib/regressions/kt2593.kt");