[JS IR] Add tests with export all file and export nested class

[JS IR] Skip dce driven for nested classes export

^KT-44469 fixed
This commit is contained in:
Ilya Goncharov
2021-01-21 13:03:56 +03:00
parent 1b68f35f7c
commit 977781fa49
5 changed files with 77 additions and 0 deletions
@@ -1617,6 +1617,16 @@ public class IrBoxJsES6TestGenerated extends AbstractIrBoxJsES6Test {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("js/js.translator/testData/box/export"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.JS_IR_ES6, true);
}
@TestMetadata("exportAllFile.kt")
public void testExportAllFile() throws Exception {
runTest("js/js.translator/testData/box/export/exportAllFile.kt");
}
@TestMetadata("exportNestedClass.kt")
public void testExportNestedClass() throws Exception {
runTest("js/js.translator/testData/box/export/exportNestedClass.kt");
}
@TestMetadata("nonIndetifierModuleName.kt")
public void testNonIndetifierModuleName() throws Exception {
runTest("js/js.translator/testData/box/export/nonIndetifierModuleName.kt");
@@ -1617,6 +1617,16 @@ public class IrBoxJsTestGenerated extends AbstractIrBoxJsTest {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("js/js.translator/testData/box/export"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.JS_IR, true);
}
@TestMetadata("exportAllFile.kt")
public void testExportAllFile() throws Exception {
runTest("js/js.translator/testData/box/export/exportAllFile.kt");
}
@TestMetadata("exportNestedClass.kt")
public void testExportNestedClass() throws Exception {
runTest("js/js.translator/testData/box/export/exportNestedClass.kt");
}
@TestMetadata("nonIndetifierModuleName.kt")
public void testNonIndetifierModuleName() throws Exception {
runTest("js/js.translator/testData/box/export/nonIndetifierModuleName.kt");
@@ -1622,6 +1622,16 @@ public class BoxJsTestGenerated extends AbstractBoxJsTest {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("js/js.translator/testData/box/export"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.JS, true);
}
@TestMetadata("exportAllFile.kt")
public void testExportAllFile() throws Exception {
runTest("js/js.translator/testData/box/export/exportAllFile.kt");
}
@TestMetadata("exportNestedClass.kt")
public void testExportNestedClass() throws Exception {
runTest("js/js.translator/testData/box/export/exportNestedClass.kt");
}
@TestMetadata("nonIndetifierModuleName.kt")
public void testNonIndetifierModuleName() throws Exception {
runTest("js/js.translator/testData/box/export/nonIndetifierModuleName.kt");
+22
View File
@@ -0,0 +1,22 @@
// IGNORE_BACKEND: JS
// RUN_PLAIN_BOX_FUNCTION
// INFER_MAIN_MODULE
// MODULE: export-all-file
// FILE: lib.kt
@file:JsExport
abstract class A {
abstract fun foo(k: String): String
}
class B : A() {
override fun foo(k: String): String {
return "O" + k
}
}
// FILE: test.js
function box() {
return new this["export-all-file"].B().foo("K");
}
@@ -0,0 +1,25 @@
// IGNORE_BACKEND: JS
// RUN_PLAIN_BOX_FUNCTION
// INFER_MAIN_MODULE
// SKIP_DCE_DRIVEN
// MODULE: export-nested-class
// FILE: lib.kt
abstract class A {
abstract fun foo(k: String): String
}
@JsExport
class B {
class Foo : A() {
override fun foo(k: String): String {
return "O" + k
}
}
}
// FILE: test.js
function box() {
return new this["export-nested-class"].B.Foo().foo("K");
}