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
+1
View File
@@ -27,6 +27,7 @@ dependencies {
def testOutputRoot = rootProject.file("test.output").absolutePath
def externalTestsDir = project.file("external")
externalTestsDir.mkdirs()
allprojects {
// Root directories for test output (logs, compiled files, statistics etc). Only single path must be in each set.
@@ -1,6 +0,0 @@
// Enable when callable references to builtin members is supported
// IGNORE_BACKEND: JS, NATIVE
fun box(): String {
val f = "KOTLIN"::get
return "${f(1)}${f(0)}"
}
@@ -1,6 +0,0 @@
// TODO: muted automatically, investigate should it be ran for JS or not
// IGNORE_BACKEND: JS, NATIVE
class A
fun box() = if ((A::equals)(A(), A())) "Fail" else "OK"
@@ -1,8 +0,0 @@
// TODO: muted automatically, investigate should it be ran for JS or not
// IGNORE_BACKEND: JS, NATIVE
fun box(): String {
fun OK() {}
return ::OK.name
}
@@ -1,47 +0,0 @@
// IGNORE_BACKEND: NATIVE
// WITH_RUNTIME
// WITH_COROUTINES
import kotlin.coroutines.*
// Does not work in JVM backend, probably due to bug. It's not clear which behaviour is right.
// TODO: fix the bug and enable for JVM backend
// TARGET_BACKEND: JS
class Controller {
var result = ""
suspend fun <T> suspendAndLog(value: T): T = CoroutineIntrinsics.suspendCoroutineOrReturn { c ->
result += "suspend($value);"
c.resume(value)
CoroutineIntrinsics.SUSPENDED
}
}
fun builder(c: suspend Controller.() -> String): String {
val controller = Controller()
c.startCoroutine(controller, handleResultContinuation {
controller.result += "return($it);"
})
return controller.result
}
fun <T> id(value: T) = value
fun box(): String {
val value = builder {
try {
if (id(23) == 23) {
return@builder suspendAndLog("OK")
}
}
finally {
result += "finally;"
}
result += "afterFinally;"
"shouldNotReach"
}
if (value != "suspend(OK);finally;return(OK);") return "fail: $value"
return "OK"
}
@@ -1,7 +0,0 @@
// TODO: muted automatically, investigate should it be ran for JS or not
// IGNORE_BACKEND: JS, NATIVE
// WITH_RUNTIME
fun box(): String =
listOf('O', 'K').fold("", String::plus)
@@ -1,7 +0,0 @@
// TODO: muted automatically, investigate should it be ran for JS or not
// IGNORE_BACKEND: JS, NATIVE
// WITH_RUNTIME
fun box(): String =
charArrayOf('O', 'K').fold("", String::plus)
@@ -1,10 +0,0 @@
// TODO: muted automatically, investigate should it be ran for JS or not
// IGNORE_BACKEND: JS, NATIVE
// WITH_REFLECT
fun doStuff(fn: String.() -> String) = "ok".fn()
fun box(): String {
return doStuff(String::toUpperCase)
}
@@ -1,7 +0,0 @@
// TODO: muted automatically, investigate should it be ran for JS or not
// IGNORE_BACKEND: JS, NATIVE
fun box(): String {
String()
return String() + "OK" + String()
}
@@ -1,6 +1,3 @@
// TODO: muted automatically, investigate should it be ran for JS or not
// IGNORE_BACKEND: JS, NATIVE
fun test(a: String, b: String): String {
return a + b;
@@ -1,6 +1,3 @@
// TODO: muted automatically, investigate should it be ran for JS or not
// IGNORE_BACKEND: JS, NATIVE
fun box(): String {
var invokeOrder = "";
val expectedResult = "0_1_9"
@@ -0,0 +1,30 @@
fun box(): String {
var invokeOrder = "";
val expectedResult = "1_0_1_9"
val expectedInvokeOrder = "1_0_9"
var l = 1L
var i = 0
val captured = 9L
var result = 1.0.test(b = {invokeOrder += "1_"; l}(), a = {invokeOrder+="0_"; i}(), c = {invokeOrder += "$captured"; "$captured"})
if (invokeOrder != expectedInvokeOrder || result != expectedResult) return "fail 1: $invokeOrder != $expectedInvokeOrder or $result != $expectedResult"
invokeOrder = "";
result = 1.0.test(b = {invokeOrder += "1_"; l}(), c = {invokeOrder += "${captured}"; "${captured}"}, a = {invokeOrder+="0_"; i}())
if (invokeOrder != expectedInvokeOrder || result != expectedResult) return "fail 2: $invokeOrder != $expectedInvokeOrder or $result != $expectedResult"
invokeOrder = "";
result = 1.0.test(c = {invokeOrder += "${captured}"; "${captured}"}, b = {invokeOrder += "1_"; l}(), a = {invokeOrder+="0_"; i}())
if (invokeOrder != expectedInvokeOrder || result != expectedResult) return "fail 3: $invokeOrder != $expectedInvokeOrder or $result != $expectedResult"
invokeOrder = "";
result = 1.0.test(a = {invokeOrder+="0_"; i}(), c = {invokeOrder += "${captured}"; "${captured}"}, b = {invokeOrder += "1_"; l}())
if (invokeOrder != "0_1_9" || result != expectedResult) return "fail 4: $invokeOrder != 0_1_9 or $result != $expectedResult"
return "OK"
}
fun Double.test(a: Int, b: Long, c: () -> String): String {
return { "${this.toInt()}_${a}_${b}_${c()}"} ()
}
@@ -1,16 +1,13 @@
// TODO: muted automatically, investigate should it be ran for JS or not
// IGNORE_BACKEND: JS, NATIVE
var invokeOrder: String = ""
fun test(x: Double = { invokeOrder += "x"; 1.0 }(), a: String, y: Long = { invokeOrder += "y"; 1 }(), b: String): String {
return "" + x + a + b + y;
return "" + x.toInt() + a + b + y;
}
fun box(): String {
val funResult = test(b = { invokeOrder += "K"; "K" }(), a = { invokeOrder += "O"; "O" }())
if (invokeOrder != "KOxy" || funResult != "1.0OK1") return "fail: $invokeOrder != KOxy or $funResult != 1.0OK1"
if (invokeOrder != "KOxy" || funResult != "1OK1") return "fail: $invokeOrder != KOxy or $funResult != 1OK1"
return "OK"
}
@@ -0,0 +1,30 @@
fun box(): String {
var invokeOrder = "";
val expectedResult = "1_0_1_L"
val expectedInvokeOrder = "1_0_L"
var l = 1L
var i = 0
var result = 1.0.test(b = {invokeOrder += "1_"; l}(), a = {invokeOrder+="0_"; i}(), c = {invokeOrder += "L"; "L"})
if (invokeOrder != expectedInvokeOrder || result != expectedResult) return "fail 1: $invokeOrder != $expectedInvokeOrder or $result != $expectedResult"
invokeOrder = "";
result = 1.0.test(b = {invokeOrder += "1_"; l}(), c = {invokeOrder += "L"; "L"}, a = {invokeOrder+="0_"; i}())
if (invokeOrder != expectedInvokeOrder || result != expectedResult) return "fail 2: $invokeOrder != $expectedInvokeOrder or $result != $expectedResult"
invokeOrder = "";
result = 1.0.test(c = {invokeOrder += "L"; "L"}, b = {invokeOrder += "1_"; l}(), a = {invokeOrder+="0_"; i}())
if (invokeOrder != expectedInvokeOrder || result != expectedResult) return "fail 3: $invokeOrder != $expectedInvokeOrder or $result != $expectedResult"
invokeOrder = "";
result = 1.0.test(a = {invokeOrder+="0_"; i}(), c = {invokeOrder += "L"; "L"}, b = {invokeOrder += "1_"; l}())
if (invokeOrder != "0_1_L" || result != expectedResult) return "fail 4: $invokeOrder != 0_1_L or $result != $expectedResult"
return "OK"
}
fun Double.test(a: Int, b: Long, c: () -> String): String {
return "${this.toInt()}_${a}_${b}_${c()}"
}
@@ -1,19 +1,16 @@
// TODO: muted automatically, investigate should it be ran for JS or not
// IGNORE_BACKEND: JS, NATIVE
fun box(): String {
return Z().test()
}
class Z {
fun Double.test(a: Int, b: Long, c: () -> String): String {
return "${this}_${a}_${b}_${c()}"
return "${this.toInt()}_${a}_${b}_${c()}"
}
fun test(): String {
var invokeOrder = "";
val expectedResult = "1.0_0_1_L"
val expectedResult = "1_0_1_L"
val expectedInvokeOrder = "1_0_L"
var l = 1L
var i = 0
@@ -1,6 +1,3 @@
// TODO: muted automatically, investigate should it be ran for JS or not
// IGNORE_BACKEND: JS, NATIVE
fun box(): String {
var res = "";
var call = test(b = {res += "K"; "K"}(), a = {res+="O"; "O"}(), c = {res += "L"; "L"})
@@ -1,6 +1,3 @@
// TODO: muted automatically, investigate should it be ran for JS or not
// IGNORE_BACKEND: JS, NATIVE
fun box(): String {
var res = "";
var call = Z("Z").test(b = {res += "K"; "K"}(), a = {res+="O"; "O"}(), c = {res += "L"; "L"})
@@ -23,4 +23,4 @@ fun box(): String {
assertEquals("2", sa[2])
return "OK"
}
}
@@ -1,5 +1,5 @@
// TODO: muted automatically, investigate should it be ran for JS or not
// IGNORE_BACKEND: JS, NATIVE
// IGNORE_BACKEND: JS
//test [], get and iterator calls
fun test(createIntNotLong: Boolean): String {
@@ -1,5 +1,5 @@
// TODO: muted automatically, investigate should it be ran for JS or not
// IGNORE_BACKEND: JS, NATIVE
// IGNORE_BACKEND: JS
fun foo(x: Cloneable) = x
@@ -1,5 +1,5 @@
// TODO: muted automatically, investigate should it be ran for JS or not
// IGNORE_BACKEND: JS, NATIVE
// IGNORE_BACKEND: JS
// WITH_RUNTIME
@@ -1,5 +1,5 @@
// TODO: muted automatically, investigate should it be ran for JS or not
// IGNORE_BACKEND: JS, NATIVE
// IGNORE_BACKEND: JS
// WITH_RUNTIME
@@ -0,0 +1,14 @@
// WITH_RUNTIME
abstract class Table<T>(
val content: Array<Array<T>>
)
fun box(): String {
val x = object : Table<String>(
Array(1, {
x-> Array(1, {y -> "OK"})
})
) {}
return x.content[0][0]
}
@@ -1,5 +1,5 @@
// TODO: muted automatically, investigate should it be ran for JS or not
// IGNORE_BACKEND: JS, NATIVE
// IGNORE_BACKEND: JS
fun box(): String {
val a = ByteArray(5)
@@ -1,5 +1,5 @@
// TODO: muted automatically, investigate should it be ran for JS or not
// IGNORE_BACKEND: JS, NATIVE
// IGNORE_BACKEND: JS
fun box(): String {
val a = LongArray(5)
@@ -1,4 +1,6 @@
//KT-2997 Automatically cast error (Array)
// IGNORE_BACKEND: JS
// Unmute when JS implements primitive arrays via TypeArray
fun foo(a: Any): Int {
if (a is IntArray) {
@@ -5,7 +5,7 @@ operator fun String.get(vararg value: Any) : String {
operator fun Int.get(vararg value: Any) : Int {
return if (value[0] == 44 && value[1] == "example") 1 else 0
}
fun foo(args: Array<String>) {
fun main(args: Array<String>) {
12 [44, "example"]
}
@@ -1,5 +1,5 @@
// TODO: muted automatically, investigate should it be ran for JS or not
// IGNORE_BACKEND: JS, NATIVE
// IGNORE_BACKEND: JS
fun iarr(vararg a : Int) = a
fun <T> array(vararg a : T) = a
@@ -1,6 +1,3 @@
// TODO: muted automatically, investigate should it be ran for JS or not
// IGNORE_BACKEND: JS, NATIVE
fun test(b: Boolean): String {
val a = if (b) IntArray(5) else LongArray(5)
if (a is IntArray) {
@@ -1,5 +1,5 @@
// TODO: muted automatically, investigate should it be ran for JS or not
// IGNORE_BACKEND: JS, NATIVE
// IGNORE_BACKEND: JS
// WITH_RUNTIME

Some files were not shown because too many files have changed in this diff Show More