Support variadic Objective-C methods
This commit is contained in:
committed by
SvyatoslavScherbina
parent
79e36a31cf
commit
e437339d9a
@@ -21,6 +21,7 @@ fun run() {
|
||||
testExceptions()
|
||||
testBlocks()
|
||||
testCustomRetain()
|
||||
testVarargs()
|
||||
|
||||
assertEquals(2, ForwardDeclaredEnum.TWO.value)
|
||||
|
||||
@@ -256,6 +257,32 @@ fun testCustomRetain() {
|
||||
assertFalse(unexpectedDeallocation)
|
||||
}
|
||||
|
||||
fun testVarargs() {
|
||||
assertEquals(
|
||||
"a b -1",
|
||||
TestVarargs.testVarargsWithFormat(
|
||||
"%@ %s %d",
|
||||
"a" as NSString, "b".cstr, (-1).toByte()
|
||||
).formatted
|
||||
)
|
||||
|
||||
assertEquals(
|
||||
"2 3 9223372036854775807",
|
||||
TestVarargs(
|
||||
"%d %d %lld",
|
||||
2.toShort(), 3, Long.MAX_VALUE
|
||||
).formatted
|
||||
)
|
||||
|
||||
assertEquals(
|
||||
"0.1 0.2 1 0",
|
||||
TestVarargs.create(
|
||||
"%.1f %.1lf %d %d",
|
||||
0.1.toFloat(), 0.2, true, false
|
||||
).formatted
|
||||
)
|
||||
}
|
||||
|
||||
private class MyException : Throwable()
|
||||
|
||||
fun nsArrayOf(vararg elements: Any): NSArray = NSMutableArray().apply {
|
||||
|
||||
Reference in New Issue
Block a user