Files
kotlin-fork/backend.native/tests/external/stdlib/collections/MapTest/populateTo.kt
T
Ilya Matveev 85827b4880 tests: Copy stdlib tests from Kotlin/JVM
This patch copies Kotlin/JVM stdlib tests (libraries/stdlib/test)
excepting ones with explicit java dependencies. It also transforms
the tests to use them as box-tests.
2017-04-07 17:21:11 +07:00

23 lines
689 B
Kotlin

import kotlin.test.*
fun box() {
val pairs = arrayOf("a" to 1, "b" to 2)
val expected = mapOf(*pairs)
val linkedMap: LinkedHashMap<String, Int> = pairs.toMap(linkedMapOf())
assertEquals(expected, linkedMap)
val hashMap: HashMap<String, Int> = pairs.asIterable().toMap(hashMapOf())
assertEquals(expected, hashMap)
val mutableMap: MutableMap<String, Int> = pairs.asSequence().toMap(mutableMapOf())
assertEquals(expected, mutableMap)
val mutableMap2 = mutableMap.toMap(mutableMapOf())
assertEquals(expected, mutableMap2)
val mutableMap3 = mutableMap.toMap(hashMapOf<CharSequence, Any>())
assertEquals<Map<*, *>>(expected, mutableMap3)
}