KT-2752: add test to ensure that JsName affects classes

This commit is contained in:
Alexey Andreev
2016-06-23 17:31:16 +03:00
parent b888d9e7d9
commit fb7f221158
3 changed files with 39 additions and 6 deletions
@@ -4795,6 +4795,12 @@ public class BoxJsTestGenerated extends AbstractBoxJsTest {
doTest(fileName);
}
@TestMetadata("classes.kt")
public void testClasses() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/jsName/classes.kt");
doTest(fileName);
}
@TestMetadata("overriddenMethod.kt")
public void testOverriddenMethod() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/jsName/overriddenMethod.kt");
@@ -131,18 +131,18 @@ public class BridgeTestGenerated extends AbstractBridgeTest {
doTest(fileName);
}
@TestMetadata("kt12416.kt")
public void testKt12416() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/bridges/kt12416.kt");
doTest(fileName);
}
@TestMetadata("jsNative.kt")
public void testJsNative() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/bridges/jsNative.kt");
doTest(fileName);
}
@TestMetadata("kt12416.kt")
public void testKt12416() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/bridges/kt12416.kt");
doTest(fileName);
}
@TestMetadata("kt1939.kt")
public void testKt1939() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/bridges/kt1939.kt");
+27
View File
@@ -0,0 +1,27 @@
package foo
@JsName("AA") object A {
@JsName("foo") fun foo() = "A.foo"
}
@JsName("BB") class B {
@JsName("foo") fun foo() = "B.foo"
}
fun testA() = js("""
var a = Kotlin.modules.JS_TESTS.foo.AA;
return a.foo();
""")
fun testB() = js("""
var b = new Kotlin.modules.JS_TESTS.foo.BB();
return b.foo();
""")
fun box(): String {
assertEquals("A.foo", testA())
assertEquals("B.foo", testB())
return "OK"
}