JS/RTTI: Added cast to Array test
This commit is contained in:
committed by
Alexey Andreev
parent
c99fd179e1
commit
a9d5c74ff7
@@ -41,6 +41,12 @@ public class CastTestGenerated extends AbstractCastTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("castToArray.kt")
|
||||
public void testCastToArray() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("js/js.translator/testData/expression/cast/cases/castToArray.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("castToFunction.kt")
|
||||
public void testCastToFunction() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("js/js.translator/testData/expression/cast/cases/castToFunction.kt");
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package foo
|
||||
|
||||
fun box(): String {
|
||||
val ints: Any? = arrayOf(1, 2)
|
||||
val strings: Any? = arrayOf("a", "b")
|
||||
val nil: Any? = null
|
||||
val obj: Any? = object{}
|
||||
|
||||
success("ints") { ints as Array<*> }
|
||||
success("strings") { strings as Array<*> }
|
||||
failsClassCast("null") { nil as Array<*> }
|
||||
failsClassCast("obj") { obj as Array<*> }
|
||||
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user