Gross stdlib cleanup (part 1). (#1918)
This commit is contained in:
@@ -1481,7 +1481,7 @@ task if_else(type: RunKonanTest) {
|
||||
}
|
||||
|
||||
task immutable_binary_blob_in_lambda(type: RunKonanTest) {
|
||||
source = "lower/immutable_binary_blob_in_lambda.kt"
|
||||
source = "lower/immutable_blob_in_lambda.kt"
|
||||
goldValue = "123\n"
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import platform.posix.printf
|
||||
|
||||
val golden = immutableBinaryBlobOf(0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x21, 0x00).asCPointer(0)
|
||||
val golden = immutableBlobOf(0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x21, 0x00).asCPointer(0)
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
printf("%s\n", golden)
|
||||
|
||||
@@ -2,8 +2,8 @@ import kotlinx.cinterop.*
|
||||
|
||||
import platform.zlib.*
|
||||
|
||||
val source = immutableBinaryBlobOf(0xF3, 0x48, 0xCD, 0xC9, 0xC9, 0x57, 0x04, 0x00).asCPointer()
|
||||
val golden = immutableBinaryBlobOf(0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x21, 0x00).asCPointer()
|
||||
val source = immutableBlobOf(0xF3, 0x48, 0xCD, 0xC9, 0xC9, 0x57, 0x04, 0x00).asCPointer()
|
||||
val golden = immutableBlobOf(0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x21, 0x00).asCPointer()
|
||||
|
||||
fun main(args: Array<String>) = memScoped {
|
||||
val buffer = ByteArray(32)
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
package lower.immutable_binary_blob_in_lambda
|
||||
|
||||
import kotlin.test.*
|
||||
|
||||
@Test
|
||||
fun runTest() = run {
|
||||
val golden = immutableBinaryBlobOf(123)
|
||||
println(golden[0])
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package lower.immutable_blob_in_lambda
|
||||
|
||||
import kotlin.test.*
|
||||
|
||||
@Test
|
||||
fun runTest() = run {
|
||||
val golden = immutableBlobOf(123)
|
||||
println(golden[0])
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
import kotlinx.cinterop.*
|
||||
|
||||
import kotlin.native.CName
|
||||
|
||||
// Top level functions.
|
||||
fun hello() {
|
||||
println("Hello, dynamic!")
|
||||
@@ -13,15 +15,15 @@ open class Base {
|
||||
|
||||
open fun fooParam(arg0: String, arg1: Int) = println("Base.fooParam: $arg0 $arg1")
|
||||
|
||||
@kotlin.native.internal.CName(fullName = "", shortName = "strangeName") fun странноеИмя() = 111
|
||||
@CName(fullName = "", shortName = "strangeName") fun странноеИмя() = 111
|
||||
|
||||
}
|
||||
|
||||
// Top level functions.
|
||||
@kotlin.native.internal.CName(fullName = "topLevelFunctionFromC", shortName = "topLevelFunctionFromCShort")
|
||||
@CName(fullName = "topLevelFunctionFromC", shortName = "topLevelFunctionFromCShort")
|
||||
fun topLevelFunction(x1: Int, x2: Int) = x1 - x2
|
||||
|
||||
@kotlin.native.internal.CName("topLevelFunctionVoidFromC")
|
||||
@CName("topLevelFunctionVoidFromC")
|
||||
fun topLevelFunctionVoid(x1: Int, pointer: COpaquePointer?) {
|
||||
assert(x1 == 42)
|
||||
assert(pointer == null)
|
||||
|
||||
@@ -5,7 +5,7 @@ import kotlin.test.*
|
||||
import kotlin.native.*
|
||||
|
||||
@Test fun runTest() {
|
||||
val data = immutableBinaryBlobOf(0x1, 0x2, 0x3, 0x7, 0x8, 0x9, 0x80, 0xff)
|
||||
val data = immutableBlobOf(0x1, 0x2, 0x3, 0x7, 0x8, 0x9, 0x80, 0xff)
|
||||
for (b in data) {
|
||||
print("$b ")
|
||||
}
|
||||
|
||||
@@ -10,5 +10,10 @@ import kotlin.test.*
|
||||
expect(0xdef0.toInt()) { array.charAt(5).toInt() }
|
||||
expect(0x9abc.toShort()) { array.shortAt(7) }
|
||||
expect(0x1234_5678) { array.intAt(9) }
|
||||
expect(0xdef0_0000u) { array.uintAt(3) }
|
||||
expect(0xf0_00u) { array.ushortAt(4) }
|
||||
expect(0xf0u) { array.ubyteAt(5) }
|
||||
expect(0x1234_5678_9abcuL) { array.ulongAt(7) }
|
||||
|
||||
println("OK")
|
||||
}
|
||||
Reference in New Issue
Block a user