Move blackBoxFile() testData to box/ directory

Delete all test methods (and empty test classes), since they'll be
auto-generated
This commit is contained in:
Alexander Udalov
2013-01-25 16:13:45 +04:00
committed by Alexander Udalov
parent ecbb2f10ef
commit 41a416da60
438 changed files with 156 additions and 2005 deletions
@@ -0,0 +1,23 @@
//KT-1572 Frontend doesn't mark all vars included in closure as refs.
class A(val t : Int) {}
fun testKt1572() : Boolean {
var a = A(0)
var b = A(3)
val changer = {a = b}
b = A(10) // this change has no effect on changer
changer()
return (a.t == 10)
}
fun testPrimitives() : Boolean {
var a = 0
var b = 3
val changer = {a = b}
b = 10
changer()
return (a == 10)
}
fun box() = if (testKt1572() && testPrimitives()) "OK" else "fail"
@@ -0,0 +1,10 @@
class A() {
fun foo() {
System.out?.println(1)
}
}
fun box() : String {
val a : A = A()
return "OK"
}
@@ -0,0 +1,32 @@
fun foo() {
val l = java.util.ArrayList<Int>(2)
l.add(1)
for (el in l) {}
//verify error "Expecting to find integer on stack"
val iterator = l.iterator()
//another verify error "Mismatched stack types"
while (iterator?.hasNext() ?: false) {
val i = iterator?.next()
}
//the same
if (iterator != null) {
while (iterator.hasNext()) {
val i = iterator?.next()
}
}
//this way it works
if (iterator != null) {
while (iterator.hasNext()) {
iterator.next() //because of the bug KT-244 i can't write "val i = iterator.next()"
}
}
}
fun box() : String {
return "OK"
}
@@ -0,0 +1,38 @@
fun t1() : Boolean {
val s1 : String? = "sff"
val s2 : String? = null
return s1?.length == 3 && s2?.length == null
}
fun t2() : Boolean {
val c1: C? = C(1)
val c2: C? = null
return c1?.x == 1 && c2?.x == null
}
fun t3() {
val d: D = D("s")
val x = d?.s
if (!(d?.s == "s")) throw AssertionError()
}
fun t4() {
val e: E? = E()
if (!(e?.bar() == e)) throw AssertionError()
val x = e?.foo()
}
fun box() : String {
if(!t1 ()) return "fail"
if(!t2 ()) return "fail"
t3()
t4()
return "OK"
}
class C(val x: Int)
class D(val s: String)
class E() {
fun foo() = 1
fun bar() = this
}