JS: move RTTI tests to proper location

This commit is contained in:
Alexey Andreev
2016-09-28 15:44:07 +03:00
parent c1e13cc788
commit 9797a1c35c
16 changed files with 74 additions and 77 deletions
+37
View File
@@ -0,0 +1,37 @@
package foo
interface A
interface B : A
interface C : A
interface D : B, C
interface E : C
open class CB : B
class CB2 : CB()
class CD : D
fun testPhrase(o: Any): String {
var s = ""
s += if (o is A) "Y" else "N"
s += if (o is B) "Y" else "N"
s += if (o is C) "Y" else "N"
s += if (o is D) "Y" else "N"
s += if (o is E) "Y" else "N"
return s
}
fun box(): String {
val b = CB()
val b2 = CB2()
val d = CD()
val e = object : E {
}
if (testPhrase(b) != "YYNNN") return "bad b, it: ${testPhrase(b)}"
if (testPhrase(b2) != "YYNNN") return "bad b2, it: ${testPhrase(b2)}"
if (testPhrase(d) != "YYYYN") return "bad d, it: ${testPhrase(d)}"
if (testPhrase(e) != "YNYNY") return "bad e, it: ${testPhrase(e)}"
return "OK"
}