Add the onEach extension function to the Array #KT-28290

This commit is contained in:
Abduqodiri Qurbonzoda
2020-04-01 00:34:52 +03:00
parent 8531c1e9a5
commit 508d0edd6d
5 changed files with 164 additions and 2 deletions
@@ -986,6 +986,14 @@ class UnsignedArraysTest {
)
}
@Test
fun onEach() {
assertEquals(listOf<UInt>(1, 2, 3), mutableListOf<UInt>().apply { uintArrayOf(1, 2, 3).onEach { add(it) } })
assertEquals(listOf<UByte>(1, 2, 3), mutableListOf<UByte>().apply { ubyteArrayOf(1, 2, 3).onEach { add(it) } })
assertEquals(listOf<UShort>(1, 2, 3), mutableListOf<UShort>().apply { ushortArrayOf(1, 2, 3).onEach { add(it) } })
assertEquals(listOf<ULong>(1, 2, 3), mutableListOf<ULong>().apply { ulongArrayOf(1, 2, 3).onEach { add(it) } })
}
@Test
fun drop() {
expect(listOf(1.toUByte())) { ubyteArrayOf(1).drop(0) }