Introduce T.addTo(MutableCollection<T>), mapNotNull and mapIndexedNotNull extensions.
#KT-4410 Fixed
This commit is contained in:
@@ -244,6 +244,16 @@ abstract class IterableTests<T : Iterable<String>>(val data: T, val empty: T) {
|
||||
assertEquals(listOf("f", "ba"), indexed)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun mapNotNull() {
|
||||
assertEquals(listOf('o'), data.mapNotNull { it.firstOrNull { c -> c in "oui" } })
|
||||
}
|
||||
|
||||
@Test
|
||||
fun mapIndexedNotNull() {
|
||||
assertEquals(listOf('b'), data.mapIndexedNotNull { index, s -> s.getOrNull(index - 1) })
|
||||
}
|
||||
|
||||
@Test
|
||||
fun max() {
|
||||
expect("foo") { data.max() }
|
||||
|
||||
Reference in New Issue
Block a user