feat(Inner Classes): generate typescript type definitions and JS for Inner Classes.

This commit is contained in:
Artem Kobzar
2021-10-28 17:33:41 +00:00
committed by Space
parent 744191099c
commit 7f7aa9a921
13 changed files with 315 additions and 12 deletions
+19 -2
View File
@@ -170,6 +170,20 @@ val unzipV8 by task<Copy> {
into(unpackedDir)
}
val testDataDir = project(":js:js.translator").projectDir.resolve("testData")
val installTsDependencies by task<NpmTask> {
workingDir.set(testDataDir)
args.set(listOf("install"))
}
val generateTypeScriptTests by task<NpmTask> {
dependsOn(installTsDependencies)
workingDir.set(testDataDir)
args.set(listOf("run", "generateTypeScriptTests"))
}
fun Test.setupV8() {
dependsOn(unzipV8)
val v8Path = unzipV8.get().destinationDir
@@ -190,6 +204,11 @@ fun Test.setUpJsBoxTests(jsEnabled: Boolean, jsIrEnabled: Boolean) {
inputs.files(rootDir.resolve("js/js.engines/src/org/jetbrains/kotlin/js/engine/repl.js"))
dependsOn(":dist")
if (!project.hasProperty("teamcity")) {
dependsOn(generateTypeScriptTests)
}
if (jsEnabled) {
dependsOn(testJsRuntime)
inputs.files(testJsRuntime)
@@ -241,8 +260,6 @@ fun Test.setUpBoxTests() {
}
}
val testDataDir = project(":js:js.translator").projectDir.resolve("testData")
projectTest(parallel = true, jUnitMode = JUnitMode.Mix) {
setUpJsBoxTests(jsEnabled = true, jsIrEnabled = true)
systemProperty("kotlin.js.ir.pir", "false")
@@ -30,6 +30,24 @@ public class IrJsTypeScriptExportES6TestGenerated extends AbstractIrJsTypeScript
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("js/js.translator/testData/typescript-export"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.JS_IR_ES6, true);
}
@TestMetadata("js/js.translator/testData/typescript-export/classes")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Classes extends AbstractIrJsTypeScriptExportES6Test {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR_ES6, testDataFilePath);
}
public void testAllFilesPresentInClasses() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("js/js.translator/testData/typescript-export/classes"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.JS_IR_ES6, true);
}
@TestMetadata("inner-class.kt")
public void testInner_class() throws Exception {
runTest("js/js.translator/testData/typescript-export/classes/inner-class.kt");
}
}
@TestMetadata("js/js.translator/testData/typescript-export/constructors")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
@@ -30,6 +30,24 @@ public class IrJsTypeScriptExportTestGenerated extends AbstractIrJsTypeScriptExp
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("js/js.translator/testData/typescript-export"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.JS_IR, true);
}
@TestMetadata("js/js.translator/testData/typescript-export/classes")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Classes extends AbstractIrJsTypeScriptExportTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath);
}
public void testAllFilesPresentInClasses() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("js/js.translator/testData/typescript-export/classes"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.JS_IR, true);
}
@TestMetadata("inner-class.kt")
public void testInner_class() throws Exception {
runTest("js/js.translator/testData/typescript-export/classes/inner-class.kt");
}
}
@TestMetadata("js/js.translator/testData/typescript-export/constructors")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)