Null-terminate Collection.toArray destination only in JVM
In other platforms the elements following the collection elements should not be changed. As a part of efforts to stabilize Native stdlib.
This commit is contained in:
committed by
Space Team
parent
60455daa9d
commit
6fdfd4e8dd
@@ -1311,7 +1311,12 @@ class CollectionTest {
|
||||
assertTrue("toArray1" in coll.invocations || "toArray2" in coll.invocations)
|
||||
|
||||
val arr2: Array<String> = coll.toArray(Array(coll.size + 1) { "" })
|
||||
assertEquals(data + listOf(null), arr2.asList())
|
||||
testOnlyOn(TestPlatform.Jvm) {
|
||||
assertEquals(data + listOf(null), arr2.asList())
|
||||
}
|
||||
testExceptOn(TestPlatform.Jvm) {
|
||||
assertEquals(data + listOf(""), arr2.asList())
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user