JS: add tests for reflection against external classes

This commit is contained in:
Alexey Andreev
2017-03-01 20:11:27 +03:00
parent 723c9be5a0
commit a6ca2906d8
3 changed files with 23 additions and 0 deletions
@@ -6818,6 +6818,12 @@ public class BoxJsTestGenerated extends AbstractBoxJsTest {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/box/reflection"), Pattern.compile("^([^_](.+))\\.kt$"), TargetBackend.JS, true);
}
@TestMetadata("external.kt")
public void testExternal() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/reflection/external.kt");
doTest(fileName);
}
@TestMetadata("jsClass.kt")
public void testJsClass() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/reflection/jsClass.kt");
+4
View File
@@ -0,0 +1,4 @@
function A() {
}
var O = {};
+13
View File
@@ -0,0 +1,13 @@
external class A
external object O
fun box(): String {
assertEquals(null, A::class.simpleName, "simpleName of external class must be null")
assertEquals(js("A"), A::class.js, "Can't get reference to external class")
assertEquals(null, O::class.simpleName, "simpleName of external object must be null")
assertEquals(js("O"), O::class.js, "Can't get reference to external object via instance")
return "OK"
}