Adapt CompileKotlinAgainstKotlin test to black box format
Rename/remove some obsolete test cases
This commit is contained in:
+3
-2
@@ -14,10 +14,11 @@ interface Tr {
|
||||
|
||||
class C : a.Tr
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
fun box(): String {
|
||||
val method = C::class.java.getDeclaredMethod("foo")
|
||||
val annotations = method.getDeclaredAnnotations().joinToString("\n")
|
||||
if (annotations != "@a.Ann()") {
|
||||
throw AssertionError(annotations)
|
||||
return "Fail: $annotations"
|
||||
}
|
||||
return "OK"
|
||||
}
|
||||
+6
-5
@@ -12,10 +12,11 @@ var varOK: String = "Hmmm?"
|
||||
|
||||
import a.*
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
if (foo() != "OK") throw AssertionError("Fail function")
|
||||
if (constOK != "OK") throw AssertionError("Fail const")
|
||||
if (valOK != "OK") throw AssertionError("Fail val")
|
||||
fun box(): String {
|
||||
if (foo() != "OK") return "Fail function"
|
||||
if (constOK != "OK") return "Fail const"
|
||||
if (valOK != "OK") return "Fail val"
|
||||
varOK = "OK"
|
||||
if (varOK != "OK") throw AssertionError("Fail var")
|
||||
if (varOK != "OK") return "Fail var"
|
||||
return varOK
|
||||
}
|
||||
|
||||
@@ -3,13 +3,16 @@
|
||||
package a
|
||||
|
||||
object CartRoutes {
|
||||
class RemoveOrderItem()
|
||||
class RemoveOrderItem {
|
||||
val result = "OK"
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: B.kt
|
||||
|
||||
import a.CartRoutes
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
fun box(): String {
|
||||
val r = CartRoutes.RemoveOrderItem()
|
||||
return r.result
|
||||
}
|
||||
|
||||
+2
-2
@@ -14,6 +14,6 @@ public enum class EnumClass {
|
||||
|
||||
import library.EnumClass
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
if (EnumClass.entry() != EnumClass.ENTRY) throw AssertionError()
|
||||
fun box(): String {
|
||||
return if (EnumClass.entry() != EnumClass.ENTRY) "Fail" else "OK"
|
||||
}
|
||||
+3
-3
@@ -9,7 +9,7 @@ class A {
|
||||
|
||||
// FILE: B.kt
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
if (A.foo() != 42) throw Exception()
|
||||
if (A.bar != "OK") throw Exception()
|
||||
fun box(): String {
|
||||
if (A.foo() != 42) return "Fail foo"
|
||||
return A.bar
|
||||
}
|
||||
+2
-2
@@ -12,7 +12,7 @@ const val OK: String = "OK"
|
||||
|
||||
import a.OK
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
fun box(): String {
|
||||
val okRef = ::OK
|
||||
|
||||
// TODO: see KT-10892
|
||||
@@ -23,5 +23,5 @@ fun main(args: Array<String>) {
|
||||
// }
|
||||
|
||||
val result = okRef.get()
|
||||
if (result != "OK") throw AssertionError("Fail: $result")
|
||||
return result
|
||||
}
|
||||
|
||||
@@ -6,8 +6,9 @@ class A(vararg s: String) {
|
||||
|
||||
// FILE: B.kt
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
A()
|
||||
A("a")
|
||||
A("a", "b")
|
||||
fun box(): String {
|
||||
A()
|
||||
A("a")
|
||||
A("a", "b")
|
||||
return "OK"
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ class A(val a: Int = 1)
|
||||
|
||||
// FILE: B.kt
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
fun box(): String {
|
||||
aaa.A()
|
||||
return "OK"
|
||||
}
|
||||
|
||||
@@ -12,9 +12,7 @@ class A {
|
||||
|
||||
// FILE: B.kt
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
fun box(): String {
|
||||
val str = aaa.A.B.O().s
|
||||
if (str != "OK") {
|
||||
throw Exception()
|
||||
}
|
||||
return str
|
||||
}
|
||||
|
||||
+3
-2
@@ -11,6 +11,7 @@ enum class E {
|
||||
|
||||
import aaa.E
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
if (E.TRIVIAL_ENTRY == E.SUBCLASS) throw AssertionError()
|
||||
fun box(): String {
|
||||
if (E.TRIVIAL_ENTRY == E.SUBCLASS) return "Fail"
|
||||
return "OK"
|
||||
}
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
// FILE: A.kt
|
||||
|
||||
package some
|
||||
|
||||
public object SOME_OBJECT {
|
||||
|
||||
}
|
||||
|
||||
// FILE: B.kt
|
||||
|
||||
//This a test for blinking bug from KT-3124
|
||||
|
||||
import some.SOME_OBJECT
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
val a = SOME_OBJECT
|
||||
}
|
||||
@@ -23,10 +23,11 @@ import constants.*
|
||||
@AnnotationClass("$b $s $i $l $f $d $bb $c $str")
|
||||
class DummyClass()
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
fun box(): String {
|
||||
val klass = DummyClass::class.java
|
||||
val annotationClass = AnnotationClass::class.java
|
||||
val annotation = klass.getAnnotation(annotationClass)!!
|
||||
val value = annotation.value
|
||||
require(value == "100 20000 2000000 2000000000000 3.14 3.14 true \u03c0 :)", { "Annotation value: $value" })
|
||||
return "OK"
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ fun Outer.testExt() {
|
||||
Inner("test")
|
||||
}
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
fun box(): String {
|
||||
Outer().testExt()
|
||||
return "OK"
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ open class C : B() {
|
||||
}
|
||||
}
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
fun box(): String {
|
||||
C().test()
|
||||
return "OK"
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ open class C : B() {
|
||||
}
|
||||
}
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
fun box(): String {
|
||||
C().test()
|
||||
return "OK"
|
||||
}
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
// FILE: A.kt
|
||||
|
||||
class A {
|
||||
val OK: String = "OK"
|
||||
@JvmName("OK") get
|
||||
}
|
||||
|
||||
// FILE: B.kt
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
if (A().OK != "OK") throw java.lang.AssertionError()
|
||||
}
|
||||
+10
-3
@@ -11,13 +11,20 @@ var v: Int = 1
|
||||
@JvmName("vset")
|
||||
set
|
||||
|
||||
fun consumeInt(x: Int) {}
|
||||
|
||||
class A {
|
||||
val OK: String = "OK"
|
||||
@JvmName("OK") get
|
||||
}
|
||||
|
||||
// FILE: B.kt
|
||||
|
||||
import lib.*
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
fun box(): String {
|
||||
foo()
|
||||
|
||||
v = 1
|
||||
println(v)
|
||||
consumeInt(v)
|
||||
return A().OK
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
// FILE: A.kt
|
||||
|
||||
package aaa
|
||||
|
||||
import kotlin.jvm.*
|
||||
|
||||
public object TestObject {
|
||||
@JvmStatic
|
||||
public val test: String = "OK"
|
||||
}
|
||||
|
||||
// FILE: B.kt
|
||||
|
||||
fun box(): String {
|
||||
return aaa.TestObject.test
|
||||
}
|
||||
+2
-1
@@ -45,8 +45,9 @@ annotation class Ann(
|
||||
val str: String
|
||||
)
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
fun box(): String {
|
||||
// Trigger annotation loading
|
||||
(MyClass1() as java.lang.Object).getClass().getAnnotations()
|
||||
(MyClass2() as java.lang.Object).getClass().getAnnotations()
|
||||
return "OK"
|
||||
}
|
||||
|
||||
Vendored
+2
-3
@@ -9,7 +9,6 @@ inline fun K(body: () -> String): String =
|
||||
|
||||
// FILE: B.kt
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
val ok = K { "O" }
|
||||
if (ok != "OK") throw java.lang.AssertionError("Expected: OK, actual: $ok")
|
||||
fun box(): String {
|
||||
return K { "O" }
|
||||
}
|
||||
|
||||
@@ -4,15 +4,12 @@ package aaa
|
||||
|
||||
class A {
|
||||
class O {
|
||||
val s = "OK"
|
||||
val s = "OK"
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: B.kt
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
val str = aaa.A.O().s
|
||||
if (str != "OK") {
|
||||
throw Exception()
|
||||
}
|
||||
fun box(): String {
|
||||
return aaa.A.O().s
|
||||
}
|
||||
|
||||
@@ -4,15 +4,16 @@ package aaa
|
||||
|
||||
class A {
|
||||
enum class E {
|
||||
A
|
||||
A
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: B.kt
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
fun box(): String {
|
||||
val str = aaa.A.E.A
|
||||
if (str.toString() != "A") {
|
||||
throw Exception()
|
||||
return "Fail $str"
|
||||
}
|
||||
return "OK"
|
||||
}
|
||||
|
||||
@@ -4,15 +4,12 @@ package aaa
|
||||
|
||||
class A {
|
||||
object O {
|
||||
val s = "OK"
|
||||
val s = "OK"
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: B.kt
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
val str = aaa.A.O.s
|
||||
if (str != "OK") {
|
||||
throw Exception()
|
||||
}
|
||||
fun box(): String {
|
||||
return aaa.A.O.s
|
||||
}
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
// FILE: A.kt
|
||||
|
||||
package aaa
|
||||
|
||||
import kotlin.jvm.*
|
||||
|
||||
public object TestObject {
|
||||
|
||||
@JvmStatic
|
||||
public val test: String = "test"
|
||||
|
||||
}
|
||||
|
||||
// FILE: B.kt
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
val h = aaa.TestObject.test
|
||||
if (h != "test") {
|
||||
throw Exception()
|
||||
}
|
||||
}
|
||||
@@ -18,7 +18,7 @@ import test.*
|
||||
class Inv<T>
|
||||
fun <T> inv(t: T): Inv<T> = Inv<T>()
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
fun box(): String {
|
||||
printStream().checkError()
|
||||
val p: Inv<PrintStream> = inv(printStream())
|
||||
val p1: Inv<PrintStream?> = inv(printStream())
|
||||
@@ -31,4 +31,6 @@ fun main(args: Array<String>) {
|
||||
a[0] = 1
|
||||
val a1: Inv<Array<Int>> = inv(a)
|
||||
val a2: Inv<Array<out Int>?> = inv(a)
|
||||
|
||||
return "OK"
|
||||
}
|
||||
|
||||
@@ -11,15 +11,17 @@ public val String.extension: Long
|
||||
|
||||
import a.*
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
fun box(): String {
|
||||
val f = ::topLevel
|
||||
val x1 = f.get()
|
||||
if (x1 != 42) throw AssertionError("Fail x1: $x1")
|
||||
if (x1 != 42) return "Fail x1: $x1"
|
||||
f.set(239)
|
||||
val x2 = f.get()
|
||||
if (x2 != 239) throw AssertionError("Fail x2: $x2")
|
||||
if (x2 != 239) return "Fail x2: $x2"
|
||||
|
||||
val g = String::extension
|
||||
val y1 = g.get("abcde")
|
||||
if (y1 != 5L) throw AssertionError("Fail y1: $y1")
|
||||
if (y1 != 5L) return "Fail y1: $y1"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
|
||||
@@ -14,10 +14,11 @@ interface Super {
|
||||
|
||||
import a.*
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
fun box(): String {
|
||||
val declaredMethod = Super::class.java.getDeclaredMethod("foo", Rec::class.java)
|
||||
val genericString = declaredMethod.toGenericString()
|
||||
if (genericString != "public abstract a.Rec<?, ?> a.Super.foo(a.Rec<?, ?>)") throw AssertionError(genericString)
|
||||
if (genericString != "public abstract a.Rec<?, ?> a.Super.foo(a.Rec<?, ?>)") return "Fail: $genericString"
|
||||
return "OK"
|
||||
}
|
||||
|
||||
fun test(s: Super, p: Rec<*, *>) {
|
||||
|
||||
@@ -22,16 +22,17 @@ class B2 : A {
|
||||
constructor(x1: Int): super(x1.toLong()) {}
|
||||
}
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
fun box(): String {
|
||||
val b1 = B1()
|
||||
if (b1.prop != "123#abc") throw AssertionError("fail1: ${b1.prop}")
|
||||
if (b1.prop != "123#abc") return "fail1: ${b1.prop}"
|
||||
val b2 = B1(456)
|
||||
if (b2.prop != "123#abc") throw AssertionError("fail2: ${b2.prop}")
|
||||
|
||||
if (b2.prop != "123#abc") return "fail2: ${b2.prop}"
|
||||
val b3 = B2("cde")
|
||||
if (b3.prop != "cde#abc") throw AssertionError("fail3: ${b3.prop}")
|
||||
if (b3.prop != "cde#abc") return "fail3: ${b3.prop}"
|
||||
val b4 = B2()
|
||||
if (b4.prop != "empty#abc") throw AssertionError("fail4: ${b4.prop}")
|
||||
if (b4.prop != "empty#abc") return "fail4: ${b4.prop}"
|
||||
val b5 = B2(789)
|
||||
if (b5.prop != "789") throw AssertionError("fail5: ${b5.prop}")
|
||||
if (b5.prop != "789") return "fail5: ${b5.prop}"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
|
||||
+2
-1
@@ -6,9 +6,10 @@ fun hello() = 17
|
||||
|
||||
// FILE: B.kt
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
fun box(): String {
|
||||
val h = aaa.hello()
|
||||
if (h != 17) {
|
||||
throw Exception()
|
||||
}
|
||||
return "OK"
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ interface ClassA {
|
||||
|
||||
import pkg.ClassA
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
fun box(): String {
|
||||
val obj = ClassA.DEFAULT
|
||||
obj.toString()
|
||||
return obj.toString()
|
||||
}
|
||||
|
||||
@@ -15,7 +15,8 @@ enum class E {
|
||||
|
||||
import aaa.E.*
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
if (TRIVIAL_ENTRY == SUBCLASS) throw AssertionError()
|
||||
if (Nested().fortyTwo() != 42) throw AssertionError()
|
||||
fun box(): String {
|
||||
if (TRIVIAL_ENTRY == SUBCLASS) return "Fail 1"
|
||||
if (Nested().fortyTwo() != 42) return "Fail 2"
|
||||
return "OK"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user