Adjust testData to *Map transformation
This commit is contained in:
committed by
Mikhail Glukhikh
parent
6fa8083a70
commit
d71b0144d5
+6
-6
@@ -1,12 +1,12 @@
|
||||
class MyMap<K, V>: Map<K, V> {
|
||||
override val size: Int get() = 0
|
||||
override val isEmpty: Boolean get() = true
|
||||
override fun containsKey(key: Any?): Boolean = false
|
||||
override fun containsValue(value: Any?): Boolean = false
|
||||
override fun get(key: Any?): V? = null
|
||||
override fun keySet(): Set<K> = throw UnsupportedOperationException()
|
||||
override fun values(): Collection<V> = throw UnsupportedOperationException()
|
||||
override fun entrySet(): Set<Map.Entry<K, V>> = throw UnsupportedOperationException()
|
||||
override fun containsKey(key: K): Boolean = false
|
||||
override fun containsValue(value: V): Boolean = false
|
||||
override fun get(key: K): V? = null
|
||||
override val keys: Set<K> get() = throw UnsupportedOperationException()
|
||||
override val values: Collection<V> get() = throw UnsupportedOperationException()
|
||||
override val entries: Set<Map.Entry<K, V>> get() = throw UnsupportedOperationException()
|
||||
}
|
||||
|
||||
fun expectUoe(block: () -> Unit) {
|
||||
|
||||
+7
-7
@@ -1,15 +1,15 @@
|
||||
class MyMap<K, V>: Map<K, V> {
|
||||
override val size: Int get() = 0
|
||||
override val isEmpty: Boolean get() = true
|
||||
override fun containsKey(key: Any?): Boolean = false
|
||||
override fun containsValue(value: Any?): Boolean = false
|
||||
override fun get(key: Any?): V? = null
|
||||
override fun keySet(): Set<K> = throw UnsupportedOperationException()
|
||||
override fun values(): Collection<V> = throw UnsupportedOperationException()
|
||||
override fun entrySet(): Set<Map.Entry<K, V>> = throw UnsupportedOperationException()
|
||||
override fun containsKey(key: K): Boolean = false
|
||||
override fun containsValue(value: V): Boolean = false
|
||||
override fun get(key: K): V? = null
|
||||
override val keys: Set<K> get() = throw UnsupportedOperationException()
|
||||
override val values: Collection<V> get() = throw UnsupportedOperationException()
|
||||
override val entries: Set<Map.Entry<K, V>> get() = throw UnsupportedOperationException()
|
||||
|
||||
public fun put(key: K, value: V): V? = null
|
||||
public fun remove(key: Any?): V? = null
|
||||
public fun remove(key: K): V? = null
|
||||
public fun putAll(m: Map<out K, V>) {}
|
||||
public fun clear() {}
|
||||
}
|
||||
|
||||
+4
-4
@@ -2,7 +2,7 @@ import java.util.AbstractMap
|
||||
import java.util.Collections
|
||||
|
||||
class A : AbstractMap<Int, String>() {
|
||||
override fun entrySet(): MutableSet<MutableMap.MutableEntry<Int, String>> = Collections.emptySet()
|
||||
override val entries: MutableSet<MutableMap.MutableEntry<Int, String>> get() = Collections.emptySet()
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
@@ -14,9 +14,9 @@ fun box(): String {
|
||||
a.putAll(b)
|
||||
a.clear()
|
||||
|
||||
a.keySet()
|
||||
a.values()
|
||||
a.entrySet()
|
||||
a.keys
|
||||
a.values
|
||||
a.entries
|
||||
|
||||
return "OK"
|
||||
}
|
||||
|
||||
+3
-3
@@ -12,9 +12,9 @@ fun box(): String {
|
||||
a.putAll(b)
|
||||
a.clear()
|
||||
|
||||
a.keySet()
|
||||
a.values()
|
||||
a.entrySet()
|
||||
a.keys
|
||||
a.values
|
||||
a.entries
|
||||
|
||||
return "OK"
|
||||
}
|
||||
|
||||
@@ -5,27 +5,27 @@ class A : Map<String, String> {
|
||||
throw UnsupportedOperationException()
|
||||
}
|
||||
|
||||
override fun containsKey(key: Any?): Boolean {
|
||||
override fun containsKey(key: String): Boolean {
|
||||
throw UnsupportedOperationException()
|
||||
}
|
||||
|
||||
override fun containsValue(value: Any?): Boolean {
|
||||
override fun containsValue(value: String): Boolean {
|
||||
throw UnsupportedOperationException()
|
||||
}
|
||||
|
||||
override fun get(key: Any?): String? {
|
||||
override fun get(key: String): String? {
|
||||
throw UnsupportedOperationException()
|
||||
}
|
||||
|
||||
override fun keySet(): Set<String> {
|
||||
override val keys: Set<String> get() {
|
||||
throw UnsupportedOperationException()
|
||||
}
|
||||
|
||||
override fun values(): Collection<String> {
|
||||
override val values: Collection<String> get() {
|
||||
throw UnsupportedOperationException()
|
||||
}
|
||||
|
||||
override fun entrySet(): Set<Map.Entry<String, String>> {
|
||||
override val entries: Set<Map.Entry<String, String>> get() {
|
||||
throw UnsupportedOperationException()
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -39,8 +39,8 @@ fun box(): String {
|
||||
A.bar = baz + a.foo
|
||||
baz + A.bar
|
||||
|
||||
if (metadatas.keySet().size != 3)
|
||||
return "Fail: only three instances of PropertyMetadata should have been created\n${metadatas.keySet()}"
|
||||
if (metadatas.keys.size != 3)
|
||||
return "Fail: only three instances of PropertyMetadata should have been created\n${metadatas.keys}"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user