JS backend: fix "is Boolean" check.

This commit is contained in:
Zalim Bashorov
2014-12-08 17:34:54 +03:00
parent 2ccc027ba5
commit e378bde43e
4 changed files with 42 additions and 0 deletions
@@ -0,0 +1,32 @@
package foo
enum class Type {
NUMBER
STRING
BOOLEAN
OBJECT
}
fun test(a: Any, actualType: Type) {
assertEquals(actualType == Type.NUMBER, a is Int, "$a is Int")
assertEquals(actualType == Type.NUMBER, a is Number, "$a is Number")
assertEquals(actualType == Type.NUMBER, a is Double, "$a is Double")
assertEquals(actualType == Type.BOOLEAN, a is Boolean, "$a is Boolean")
assertEquals(actualType == Type.STRING, a is String, "$a is String")
}
fun box(): String {
test(1, Type.NUMBER)
test(12.3, Type.NUMBER)
test(12.3f, Type.NUMBER)
test("text", Type.STRING)
test(true, Type.BOOLEAN)
test(false, Type.BOOLEAN)
test(object {}, Type.OBJECT)
return "OK"
}