JS stdlib: added LinkedHashMap abd LinkedHashSet.

This commit is contained in:
Zalim Bashorov
2014-06-18 22:26:42 +04:00
parent a2584dc6d7
commit 6f5c88c21f
4 changed files with 106 additions and 0 deletions
+5
View File
@@ -16,6 +16,11 @@ class PrimitiveMapJsTest : MapJsTest() {
override fun emptyMutableMap(): MutableMap<String, Int> = HashMap()
}
class LinkedHashMapTest : MapJsTest() {
override fun <T : kotlin.Comparable<T>> Collection<T>.toNormalizedList(): List<T> = this.toList()
override fun emptyMutableMap(): MutableMap<String, Int> = LinkedHashMap()
}
abstract class MapJsTest {
//TODO: replace `array(...).toList()` to `listOf(...)`
val KEYS = array("zero", "one", "two", "three").toList()
+5
View File
@@ -3,6 +3,7 @@ package test.collections
import kotlin.test.*
import org.junit.Test
import java.util.HashSet
import java.util.LinkedHashSet
class ComplexSetJsTest : SetJsTest() {
// hashSetOf returns ComlpexHashSet because it is Generic
@@ -13,6 +14,10 @@ class PrimitiveSetJsTest : SetJsTest() {
override fun createEmptyMutableSet(): MutableSet<String> = HashSet<String>()
}
class LinkedHashSetTest : SetJsTest() {
override fun createEmptyMutableSet(): MutableSet<String> = LinkedHashSet<String>()
}
abstract class SetJsTest {
val data: Set<String> = createTestMutableSet()
val empty: Set<String> = createEmptyMutableSet()