Added some tests for JS implementation of HashMap#values() (#KT-3035)

This commit is contained in:
Zalim Bashorov
2013-03-05 16:19:44 +04:00
parent 02c8989b2f
commit dd7d584478
+22
View File
@@ -6,6 +6,8 @@ import java.util.*
import org.junit.Test as test
class MapJsTest {
val KEYS = array("zero", "one", "two", "three")
val VALUES = array(0, 1, 2, 3)
test fun getOrElse() {
val data = HashMap<String, Int>()
@@ -34,6 +36,26 @@ class MapJsTest {
assertEquals(data.size, 0)
}
// #KT-3035
test fun emptyHashMapValues() {
val emptyMap = HashMap<String, Int>()
assertTrue(emptyMap.values().isEmpty())
}
test fun hashMapValues() {
val map = createTestHashMap()
//todo: fixme after sort() will be fixed for JS
assertEquals(VALUES, map.values())
}
fun createTestHashMap(): HashMap<String, Int> {
val map = HashMap<String, Int>()
for (i in KEYS.indices) {
map.put(KEYS[i], VALUES[i])
}
return map
}
/*
TODO fix bug with .set() on Map...