tests: Update external tests (1.1.2-dev-393)

This commit is contained in:
Ilya Matveev
2017-03-13 12:38:08 +03:00
committed by ilmat192
parent ac56fccb15
commit bc074e6d39
3178 changed files with 22396 additions and 696 deletions
@@ -0,0 +1,13 @@
// TODO: muted automatically, investigate should it be ran for JS or not
// IGNORE_BACKEND: JS, NATIVE
// WITH_RUNTIME
fun box(): String {
var x = 42
val k = (x++)::class.java
if (k != Int::class.java) return "Fail 1: $k"
if (x != 43) return "Fail 2: $x (side effect should have taken place)"
return "OK"
}
@@ -0,0 +1,18 @@
// IGNORE_BACKEND: NATIVE
// WITH_RUNTIME
import kotlin.test.assertEquals
fun box(): String {
assertEquals(true::class, Boolean::class)
assertEquals(42.toByte()::class, Byte::class)
assertEquals('z'::class, Char::class)
assertEquals(3.14::class, Double::class)
assertEquals(2.72f::class, Float::class)
assertEquals(42::class, Int::class)
assertEquals(42L::class, Long::class)
assertEquals(42.toShort()::class, Short::class)
return "OK"
}
@@ -0,0 +1,17 @@
// TODO: muted automatically, investigate should it be ran for JS or not
// IGNORE_BACKEND: JS, NATIVE
fun box(): String {
var x = 42
val k1 = (x++)::class
if (k1 != Int::class) return "Fail 1: $k1"
if (x != 43) return "Fail 2: $x"
val k2 = { x *= 2; x }()::class
// Note that k2 is the class of the wrapper type java.lang.Integer
if (k2 != Integer::class) return "Fail 3: $k2"
if (x != 86) return "Fail 4: $x"
return "OK"
}
@@ -0,0 +1,7 @@
// IGNORE_BACKEND: NATIVE
fun box(): String {
val x: CharSequence = ""
val klass = x::class
return if (klass == String::class) "OK" else "Fail: $klass"
}
@@ -0,0 +1,12 @@
// IGNORE_BACKEND: NATIVE
// KT-16291 Smart cast doesn't work when getting class of instance
class Foo(val s: String) {
override fun equals(other: Any?): Boolean {
return other != null && other::class == this::class && s == (other as Foo).s
}
}
fun box(): String {
return if (Foo("a") == Foo("a")) "OK" else "Fail"
}