Ignored/fixed some tests for Kotlin/Native

This commit is contained in:
Igor Chevdar
2017-06-21 11:56:22 +03:00
committed by jetbrains
parent 7b52300287
commit d7e4350d42
23 changed files with 115 additions and 30 deletions
@@ -31,8 +31,8 @@ class ValByMapExtensionsTest {
}
class VarByMapExtensionsTest {
// IGNORE_BACKEND: NATIVE
val map = hashMapOf<String, Any?>("a" to "all", "b" to null, "c" to 1, "xProperty" to 1.0)
val map2: MutableMap<String, CharSequence> = hashMapOf("a2" to "all")
@@ -66,3 +66,38 @@ class VarByMapExtensionsTest {
assertEquals(null, d)
}
}
class VarByMapExtensionsTest_ForNative {
val map = hashMapOf<String, Any?>("a" to "all", "b" to null, "c" to 1, "xProperty" to 1.0)
val map2: MutableMap<String, CharSequence> = hashMapOf("a2" to "all")
var a: String by map
var b: Any? by map
var c: Int by map
var d: String? by map
var a2: String by map2.withDefault { "empty" }
//var x: Int by map2 // prohibited by type system
@Test fun doTest() {
assertEquals("all", a)
assertEquals(null, b)
assertEquals(1, c)
c = 2
assertEquals(2, c)
assertEquals(2, map["c"])
assertEquals("all", a2)
map2.remove("a2")
assertEquals("empty", a2)
map["c"] = "string"
// fails { c } // does not fail in JS due to KT-8135
map["a"] = null
//a Fails in Native, KT-8135 is already fixed in Native. // fails { a } // does not fail due to KT-8135
assertFailsWith<NoSuchElementException> { d }
map["d"] = null
assertEquals(null, d)
}
}