[K/JS] test: add @file:JsExport tests for each @JsExport test + auto-generate TypeScript export tests.
This commit is contained in:
+6
@@ -719,6 +719,12 @@ private fun shouldDeclarationBeExportedImplicitlyOrExplicitly(declaration: IrDec
|
||||
}
|
||||
|
||||
private fun shouldDeclarationBeExported(declaration: IrDeclarationWithName, context: JsIrBackendContext): Boolean {
|
||||
// Formally, user have no ability to annotate EnumEntry as exported, without Enum Class
|
||||
// But, when we add @file:JsExport, the annotation appears on the all of enum entries
|
||||
// what make a wrong behaviour on non-exported members inside Enum Entry (check exportEnumClass and exportFileWithEnumClass tests)
|
||||
if (declaration is IrClass && declaration.kind == ClassKind.ENUM_ENTRY)
|
||||
return false
|
||||
|
||||
if (context.additionalExportedDeclarationNames.contains(declaration.fqNameWhenAvailable))
|
||||
return true
|
||||
|
||||
|
||||
Vendored
+34
@@ -0,0 +1,34 @@
|
||||
// !OPT_IN: kotlin.js.ExperimentalJsExport
|
||||
// !RENDER_DIAGNOSTICS_MESSAGES
|
||||
@file:JsExport
|
||||
|
||||
package foo
|
||||
|
||||
fun <!NON_CONSUMABLE_EXPORTED_IDENTIFIER!>delete<!>() {}
|
||||
|
||||
val <!NON_CONSUMABLE_EXPORTED_IDENTIFIER!>instanceof<!> = 4
|
||||
|
||||
class <!NON_CONSUMABLE_EXPORTED_IDENTIFIER!>eval<!>
|
||||
|
||||
@JsName(<!NON_CONSUMABLE_EXPORTED_IDENTIFIER!>"await"<!>)
|
||||
fun foo() {}
|
||||
|
||||
@JsName(<!NON_CONSUMABLE_EXPORTED_IDENTIFIER!>"this"<!>)
|
||||
val bar = 4
|
||||
|
||||
@JsName(<!NON_CONSUMABLE_EXPORTED_IDENTIFIER!>"super"<!>)
|
||||
class Baz
|
||||
|
||||
class Test {
|
||||
fun instanceof() {}
|
||||
|
||||
@JsName("eval")
|
||||
fun test() {}
|
||||
}
|
||||
|
||||
object NaN
|
||||
|
||||
enum class Nums {
|
||||
Infinity,
|
||||
undefined
|
||||
}
|
||||
Vendored
+58
@@ -0,0 +1,58 @@
|
||||
package
|
||||
|
||||
package foo {
|
||||
@kotlin.js.JsName(name = "this") public val bar: kotlin.Int = 4
|
||||
public val instanceof: kotlin.Int = 4
|
||||
public fun delete(): kotlin.Unit
|
||||
@kotlin.js.JsName(name = "await") public fun foo(): kotlin.Unit
|
||||
|
||||
@kotlin.js.JsName(name = "super") public final class Baz {
|
||||
public constructor Baz()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public object NaN {
|
||||
private constructor NaN()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final enum class Nums : kotlin.Enum<foo.Nums> {
|
||||
enum entry Infinity
|
||||
|
||||
enum entry undefined
|
||||
|
||||
private constructor Nums()
|
||||
@kotlin.internal.IntrinsicConstEvaluation public final override /*1*/ /*fake_override*/ val name: kotlin.String
|
||||
public final override /*1*/ /*fake_override*/ val ordinal: kotlin.Int
|
||||
protected final override /*1*/ /*fake_override*/ fun clone(): kotlin.Any
|
||||
public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: foo.Nums): kotlin.Int
|
||||
public final override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public final override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
|
||||
// Static members
|
||||
public final /*synthesized*/ val entries: kotlin.enums.EnumEntries<foo.Nums>
|
||||
public final /*synthesized*/ fun valueOf(/*0*/ value: kotlin.String): foo.Nums
|
||||
public final /*synthesized*/ fun values(): kotlin.Array<foo.Nums>
|
||||
}
|
||||
|
||||
public final class Test {
|
||||
public constructor Test()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public final fun instanceof(): kotlin.Unit
|
||||
@kotlin.js.JsName(name = "eval") public final fun test(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class eval {
|
||||
public constructor eval()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
// !OPT_IN: kotlin.js.ExperimentalJsExport
|
||||
// !RENDER_DIAGNOSTICS_MESSAGES
|
||||
@file:JsExport
|
||||
|
||||
package foo
|
||||
|
||||
class C(val x: String) {
|
||||
<!WRONG_EXPORTED_DECLARATION("secondary constructor without @JsName")!>constructor(x: Int)<!>: this(x.toString())
|
||||
}
|
||||
|
||||
class C2(val x: String) {
|
||||
@JsName("JsNameProvided")
|
||||
constructor(x: Int): this(x.toString())
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
package
|
||||
|
||||
package foo {
|
||||
|
||||
public final class C {
|
||||
public constructor C(/*0*/ x: kotlin.Int)
|
||||
public constructor C(/*0*/ x: kotlin.String)
|
||||
public final val x: kotlin.String
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class C2 {
|
||||
@kotlin.js.JsName(name = "JsNameProvided") public constructor C2(/*0*/ x: kotlin.Int)
|
||||
public constructor C2(/*0*/ x: kotlin.String)
|
||||
public final val x: kotlin.String
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
}
|
||||
+12
@@ -413,12 +413,24 @@ public class DiagnosticsTestWithJsStdLibGenerated extends AbstractDiagnosticsTes
|
||||
runTest("compiler/testData/diagnostics/testsWithJsStdLib/export/nonConsumableIdentifiers.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("nonConsumableIdentifiersInExportedFile.kt")
|
||||
public void testNonConsumableIdentifiersInExportedFile() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithJsStdLib/export/nonConsumableIdentifiersInExportedFile.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("secondaryConstructorWithoutJsName.kt")
|
||||
public void testSecondaryConstructorWithoutJsName() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithJsStdLib/export/secondaryConstructorWithoutJsName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("secondaryConstructorWithoutJsNameInExportedFile.kt")
|
||||
public void testSecondaryConstructorWithoutJsNameInExportedFile() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithJsStdLib/export/secondaryConstructorWithoutJsNameInExportedFile.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("unexportableTypesInSignature.kt")
|
||||
public void testUnexportableTypesInSignature() throws Exception {
|
||||
|
||||
@@ -156,6 +156,41 @@ val unzipJsShell by task<Copy> {
|
||||
val testDataDir = project(":js:js.translator").projectDir.resolve("testData")
|
||||
val typescriptTestsDir = testDataDir.resolve("typescript-export")
|
||||
|
||||
val generateJsExportOnFileTestFilesForTS by task<Copy> {
|
||||
val exportFileDirPostfix = "-in-exported-file"
|
||||
|
||||
from(typescriptTestsDir) {
|
||||
include("**/*.kt")
|
||||
include("**/*.ts")
|
||||
include("**/tsconfig.json")
|
||||
exclude("selective-export/*")
|
||||
exclude("implicit-export/*")
|
||||
exclude("inheritance/*")
|
||||
exclude("strict-implicit-export/*")
|
||||
exclude("*$exportFileDirPostfix")
|
||||
|
||||
eachFile {
|
||||
path = "${relativePath.parent}$exportFileDirPostfix/$name"
|
||||
|
||||
var isFirstLine = true
|
||||
filter {
|
||||
when {
|
||||
isFirstLine && name.endsWith(".kt") -> "/** This file is generated by {@link :js:js.test:generateJsExportOnFileTestFilesForTS} task. DO NOT MODIFY MANUALLY */\n\n$it"
|
||||
.also { isFirstLine = false }
|
||||
|
||||
it.contains("// FILE") -> "$it\n\n@file:JsExport"
|
||||
else -> it.replace("@JsExport", "")
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
into(typescriptTestsDir)
|
||||
}
|
||||
|
||||
|
||||
val installTsDependencies = task<NpmTask>("installTsDependencies") {
|
||||
workingDir.set(testDataDir)
|
||||
args.set(listOf("install"))
|
||||
@@ -314,6 +349,7 @@ testsJar {}
|
||||
|
||||
val generateTests by generator("org.jetbrains.kotlin.generators.tests.GenerateJsTestsKt") {
|
||||
dependsOn(":compiler:generateTestData")
|
||||
dependsOn(generateJsExportOnFileTestFilesForTS)
|
||||
}
|
||||
|
||||
val prepareMochaTestData by tasks.registering(Copy::class) {
|
||||
|
||||
@@ -2100,6 +2100,12 @@ public class BoxJsTestGenerated extends AbstractBoxJsTest {
|
||||
runTest("js/js.translator/testData/box/export/defaultInlineClassConstructorParam.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("defaultInlineClassConstructorParamInExportedFile.kt")
|
||||
public void testDefaultInlineClassConstructorParamInExportedFile() throws Exception {
|
||||
runTest("js/js.translator/testData/box/export/defaultInlineClassConstructorParamInExportedFile.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("exportAllFile.kt")
|
||||
public void testExportAllFile() throws Exception {
|
||||
@@ -2124,6 +2130,42 @@ public class BoxJsTestGenerated extends AbstractBoxJsTest {
|
||||
runTest("js/js.translator/testData/box/export/exportEnumClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("exportFileWithClassWithInternal.kt")
|
||||
public void testExportFileWithClassWithInternal() throws Exception {
|
||||
runTest("js/js.translator/testData/box/export/exportFileWithClassWithInternal.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("exportFileWithEnumClass.kt")
|
||||
public void testExportFileWithEnumClass() throws Exception {
|
||||
runTest("js/js.translator/testData/box/export/exportFileWithEnumClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("exportFileWithInterface.kt")
|
||||
public void testExportFileWithInterface() throws Exception {
|
||||
runTest("js/js.translator/testData/box/export/exportFileWithInterface.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("exportFileWithNestedClass.kt")
|
||||
public void testExportFileWithNestedClass() throws Exception {
|
||||
runTest("js/js.translator/testData/box/export/exportFileWithNestedClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("exportFileWithNestedObject.kt")
|
||||
public void testExportFileWithNestedObject() throws Exception {
|
||||
runTest("js/js.translator/testData/box/export/exportFileWithNestedObject.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("exportFileWithProtectedMembers.kt")
|
||||
public void testExportFileWithProtectedMembers() throws Exception {
|
||||
runTest("js/js.translator/testData/box/export/exportFileWithProtectedMembers.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("exportInnerClass.kt")
|
||||
public void testExportInnerClass() throws Exception {
|
||||
@@ -2160,12 +2202,24 @@ public class BoxJsTestGenerated extends AbstractBoxJsTest {
|
||||
runTest("js/js.translator/testData/box/export/nonIndetifierModuleName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("nonIndetifierModuleNameInExportedFile.kt")
|
||||
public void testNonIndetifierModuleNameInExportedFile() throws Exception {
|
||||
runTest("js/js.translator/testData/box/export/nonIndetifierModuleNameInExportedFile.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("overriddenChainNonExportIntermediate.kt")
|
||||
public void testOverriddenChainNonExportIntermediate() throws Exception {
|
||||
runTest("js/js.translator/testData/box/export/overriddenChainNonExportIntermediate.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("overriddenChainNonExportIntermediateInExportedFile.kt")
|
||||
public void testOverriddenChainNonExportIntermediateInExportedFile() throws Exception {
|
||||
runTest("js/js.translator/testData/box/export/overriddenChainNonExportIntermediateInExportedFile.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("overriddenExternalMethodWithSameNameMethod.kt")
|
||||
public void testOverriddenExternalMethodWithSameNameMethod() throws Exception {
|
||||
@@ -2178,6 +2232,12 @@ public class BoxJsTestGenerated extends AbstractBoxJsTest {
|
||||
runTest("js/js.translator/testData/box/export/overriddenExternalMethodWithSameStableNameMethod.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("overriddenExternalMethodWithSameStableNameMethodInExportedFile.kt")
|
||||
public void testOverriddenExternalMethodWithSameStableNameMethodInExportedFile() throws Exception {
|
||||
runTest("js/js.translator/testData/box/export/overriddenExternalMethodWithSameStableNameMethodInExportedFile.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("overridenMethod.kt")
|
||||
public void testOverridenMethod() throws Exception {
|
||||
@@ -2190,6 +2250,12 @@ public class BoxJsTestGenerated extends AbstractBoxJsTest {
|
||||
runTest("js/js.translator/testData/box/export/reservedModuleName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("reservedModuleNameInExportedFile.kt")
|
||||
public void testReservedModuleNameInExportedFile() throws Exception {
|
||||
runTest("js/js.translator/testData/box/export/reservedModuleNameInExportedFile.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("vararg.kt")
|
||||
public void testVararg() throws Exception {
|
||||
|
||||
+72
@@ -2560,12 +2560,24 @@ public class FirJsTestGenerated extends AbstractFirJsTest {
|
||||
runTest("js/js.translator/testData/box/export/bridgeSavingAfterExport.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("bridgeSavingAfterExportInExportedFile.kt")
|
||||
public void testBridgeSavingAfterExportInExportedFile() throws Exception {
|
||||
runTest("js/js.translator/testData/box/export/bridgeSavingAfterExportInExportedFile.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("defaultInlineClassConstructorParam.kt")
|
||||
public void testDefaultInlineClassConstructorParam() throws Exception {
|
||||
runTest("js/js.translator/testData/box/export/defaultInlineClassConstructorParam.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("defaultInlineClassConstructorParamInExportedFile.kt")
|
||||
public void testDefaultInlineClassConstructorParamInExportedFile() throws Exception {
|
||||
runTest("js/js.translator/testData/box/export/defaultInlineClassConstructorParamInExportedFile.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("exportAllFile.kt")
|
||||
public void testExportAllFile() throws Exception {
|
||||
@@ -2590,6 +2602,42 @@ public class FirJsTestGenerated extends AbstractFirJsTest {
|
||||
runTest("js/js.translator/testData/box/export/exportEnumClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("exportFileWithClassWithInternal.kt")
|
||||
public void testExportFileWithClassWithInternal() throws Exception {
|
||||
runTest("js/js.translator/testData/box/export/exportFileWithClassWithInternal.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("exportFileWithEnumClass.kt")
|
||||
public void testExportFileWithEnumClass() throws Exception {
|
||||
runTest("js/js.translator/testData/box/export/exportFileWithEnumClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("exportFileWithInterface.kt")
|
||||
public void testExportFileWithInterface() throws Exception {
|
||||
runTest("js/js.translator/testData/box/export/exportFileWithInterface.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("exportFileWithNestedClass.kt")
|
||||
public void testExportFileWithNestedClass() throws Exception {
|
||||
runTest("js/js.translator/testData/box/export/exportFileWithNestedClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("exportFileWithNestedObject.kt")
|
||||
public void testExportFileWithNestedObject() throws Exception {
|
||||
runTest("js/js.translator/testData/box/export/exportFileWithNestedObject.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("exportFileWithProtectedMembers.kt")
|
||||
public void testExportFileWithProtectedMembers() throws Exception {
|
||||
runTest("js/js.translator/testData/box/export/exportFileWithProtectedMembers.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("exportInnerClass.kt")
|
||||
public void testExportInnerClass() throws Exception {
|
||||
@@ -2626,12 +2674,24 @@ public class FirJsTestGenerated extends AbstractFirJsTest {
|
||||
runTest("js/js.translator/testData/box/export/nonIndetifierModuleName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("nonIndetifierModuleNameInExportedFile.kt")
|
||||
public void testNonIndetifierModuleNameInExportedFile() throws Exception {
|
||||
runTest("js/js.translator/testData/box/export/nonIndetifierModuleNameInExportedFile.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("overriddenChainNonExportIntermediate.kt")
|
||||
public void testOverriddenChainNonExportIntermediate() throws Exception {
|
||||
runTest("js/js.translator/testData/box/export/overriddenChainNonExportIntermediate.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("overriddenChainNonExportIntermediateInExportedFile.kt")
|
||||
public void testOverriddenChainNonExportIntermediateInExportedFile() throws Exception {
|
||||
runTest("js/js.translator/testData/box/export/overriddenChainNonExportIntermediateInExportedFile.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("overriddenExternalMethodWithSameNameMethod.kt")
|
||||
public void testOverriddenExternalMethodWithSameNameMethod() throws Exception {
|
||||
@@ -2644,6 +2704,12 @@ public class FirJsTestGenerated extends AbstractFirJsTest {
|
||||
runTest("js/js.translator/testData/box/export/overriddenExternalMethodWithSameStableNameMethod.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("overriddenExternalMethodWithSameStableNameMethodInExportedFile.kt")
|
||||
public void testOverriddenExternalMethodWithSameStableNameMethodInExportedFile() throws Exception {
|
||||
runTest("js/js.translator/testData/box/export/overriddenExternalMethodWithSameStableNameMethodInExportedFile.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("overriddenPropertyFromInterface.kt")
|
||||
public void testOverriddenPropertyFromInterface() throws Exception {
|
||||
@@ -2662,6 +2728,12 @@ public class FirJsTestGenerated extends AbstractFirJsTest {
|
||||
runTest("js/js.translator/testData/box/export/reservedModuleName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("reservedModuleNameInExportedFile.kt")
|
||||
public void testReservedModuleNameInExportedFile() throws Exception {
|
||||
runTest("js/js.translator/testData/box/export/reservedModuleNameInExportedFile.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("vararg.kt")
|
||||
public void testVararg() throws Exception {
|
||||
|
||||
+72
@@ -2560,12 +2560,24 @@ public class IrBoxJsTestGenerated extends AbstractIrBoxJsTest {
|
||||
runTest("js/js.translator/testData/box/export/bridgeSavingAfterExport.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("bridgeSavingAfterExportInExportedFile.kt")
|
||||
public void testBridgeSavingAfterExportInExportedFile() throws Exception {
|
||||
runTest("js/js.translator/testData/box/export/bridgeSavingAfterExportInExportedFile.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("defaultInlineClassConstructorParam.kt")
|
||||
public void testDefaultInlineClassConstructorParam() throws Exception {
|
||||
runTest("js/js.translator/testData/box/export/defaultInlineClassConstructorParam.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("defaultInlineClassConstructorParamInExportedFile.kt")
|
||||
public void testDefaultInlineClassConstructorParamInExportedFile() throws Exception {
|
||||
runTest("js/js.translator/testData/box/export/defaultInlineClassConstructorParamInExportedFile.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("exportAllFile.kt")
|
||||
public void testExportAllFile() throws Exception {
|
||||
@@ -2590,6 +2602,42 @@ public class IrBoxJsTestGenerated extends AbstractIrBoxJsTest {
|
||||
runTest("js/js.translator/testData/box/export/exportEnumClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("exportFileWithClassWithInternal.kt")
|
||||
public void testExportFileWithClassWithInternal() throws Exception {
|
||||
runTest("js/js.translator/testData/box/export/exportFileWithClassWithInternal.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("exportFileWithEnumClass.kt")
|
||||
public void testExportFileWithEnumClass() throws Exception {
|
||||
runTest("js/js.translator/testData/box/export/exportFileWithEnumClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("exportFileWithInterface.kt")
|
||||
public void testExportFileWithInterface() throws Exception {
|
||||
runTest("js/js.translator/testData/box/export/exportFileWithInterface.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("exportFileWithNestedClass.kt")
|
||||
public void testExportFileWithNestedClass() throws Exception {
|
||||
runTest("js/js.translator/testData/box/export/exportFileWithNestedClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("exportFileWithNestedObject.kt")
|
||||
public void testExportFileWithNestedObject() throws Exception {
|
||||
runTest("js/js.translator/testData/box/export/exportFileWithNestedObject.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("exportFileWithProtectedMembers.kt")
|
||||
public void testExportFileWithProtectedMembers() throws Exception {
|
||||
runTest("js/js.translator/testData/box/export/exportFileWithProtectedMembers.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("exportInnerClass.kt")
|
||||
public void testExportInnerClass() throws Exception {
|
||||
@@ -2626,12 +2674,24 @@ public class IrBoxJsTestGenerated extends AbstractIrBoxJsTest {
|
||||
runTest("js/js.translator/testData/box/export/nonIndetifierModuleName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("nonIndetifierModuleNameInExportedFile.kt")
|
||||
public void testNonIndetifierModuleNameInExportedFile() throws Exception {
|
||||
runTest("js/js.translator/testData/box/export/nonIndetifierModuleNameInExportedFile.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("overriddenChainNonExportIntermediate.kt")
|
||||
public void testOverriddenChainNonExportIntermediate() throws Exception {
|
||||
runTest("js/js.translator/testData/box/export/overriddenChainNonExportIntermediate.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("overriddenChainNonExportIntermediateInExportedFile.kt")
|
||||
public void testOverriddenChainNonExportIntermediateInExportedFile() throws Exception {
|
||||
runTest("js/js.translator/testData/box/export/overriddenChainNonExportIntermediateInExportedFile.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("overriddenExternalMethodWithSameNameMethod.kt")
|
||||
public void testOverriddenExternalMethodWithSameNameMethod() throws Exception {
|
||||
@@ -2644,6 +2704,12 @@ public class IrBoxJsTestGenerated extends AbstractIrBoxJsTest {
|
||||
runTest("js/js.translator/testData/box/export/overriddenExternalMethodWithSameStableNameMethod.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("overriddenExternalMethodWithSameStableNameMethodInExportedFile.kt")
|
||||
public void testOverriddenExternalMethodWithSameStableNameMethodInExportedFile() throws Exception {
|
||||
runTest("js/js.translator/testData/box/export/overriddenExternalMethodWithSameStableNameMethodInExportedFile.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("overriddenPropertyFromInterface.kt")
|
||||
public void testOverriddenPropertyFromInterface() throws Exception {
|
||||
@@ -2662,6 +2728,12 @@ public class IrBoxJsTestGenerated extends AbstractIrBoxJsTest {
|
||||
runTest("js/js.translator/testData/box/export/reservedModuleName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("reservedModuleNameInExportedFile.kt")
|
||||
public void testReservedModuleNameInExportedFile() throws Exception {
|
||||
runTest("js/js.translator/testData/box/export/reservedModuleNameInExportedFile.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("vararg.kt")
|
||||
public void testVararg() throws Exception {
|
||||
|
||||
Generated
+323
-7
@@ -41,6 +41,22 @@ public class IrJsTypeScriptExportTestGenerated extends AbstractIrJsTypeScriptExp
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("js/js.translator/testData/typescript-export/abstract-classes-in-exported-file")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Abstract_classes_in_exported_file {
|
||||
@Test
|
||||
@TestMetadata("abstract-classes.kt")
|
||||
public void testAbstract_classes() throws Exception {
|
||||
runTest("js/js.translator/testData/typescript-export/abstract-classes-in-exported-file/abstract-classes.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAllFilesPresentInAbstract_classes_in_exported_file() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("js/js.translator/testData/typescript-export/abstract-classes-in-exported-file"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.JS_IR, true);
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("js/js.translator/testData/typescript-export/constructors")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@@ -57,6 +73,22 @@ public class IrJsTypeScriptExportTestGenerated extends AbstractIrJsTypeScriptExp
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("js/js.translator/testData/typescript-export/constructors-in-exported-file")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Constructors_in_exported_file {
|
||||
@Test
|
||||
public void testAllFilesPresentInConstructors_in_exported_file() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("js/js.translator/testData/typescript-export/constructors-in-exported-file"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.JS_IR, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("constructors.kt")
|
||||
public void testConstructors() throws Exception {
|
||||
runTest("js/js.translator/testData/typescript-export/constructors-in-exported-file/constructors.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("js/js.translator/testData/typescript-export/data-classes")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@@ -73,6 +105,22 @@ public class IrJsTypeScriptExportTestGenerated extends AbstractIrJsTypeScriptExp
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("js/js.translator/testData/typescript-export/data-classes-in-exported-file")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Data_classes_in_exported_file {
|
||||
@Test
|
||||
public void testAllFilesPresentInData_classes_in_exported_file() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("js/js.translator/testData/typescript-export/data-classes-in-exported-file"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.JS_IR, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("data-classes.kt")
|
||||
public void testData_classes() throws Exception {
|
||||
runTest("js/js.translator/testData/typescript-export/data-classes-in-exported-file/data-classes.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("js/js.translator/testData/typescript-export/enum-classes")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@@ -89,6 +137,22 @@ public class IrJsTypeScriptExportTestGenerated extends AbstractIrJsTypeScriptExp
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("js/js.translator/testData/typescript-export/enum-classes-in-exported-file")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Enum_classes_in_exported_file {
|
||||
@Test
|
||||
public void testAllFilesPresentInEnum_classes_in_exported_file() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("js/js.translator/testData/typescript-export/enum-classes-in-exported-file"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.JS_IR, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("enum-classes.kt")
|
||||
public void testEnum_classes() throws Exception {
|
||||
runTest("js/js.translator/testData/typescript-export/enum-classes-in-exported-file/enum-classes.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("js/js.translator/testData/typescript-export/escaped-declarations")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@@ -105,6 +169,22 @@ public class IrJsTypeScriptExportTestGenerated extends AbstractIrJsTypeScriptExp
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("js/js.translator/testData/typescript-export/escaped-declarations-in-exported-file")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Escaped_declarations_in_exported_file {
|
||||
@Test
|
||||
public void testAllFilesPresentInEscaped_declarations_in_exported_file() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("js/js.translator/testData/typescript-export/escaped-declarations-in-exported-file"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.JS_IR, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("escaped-declarations.kt")
|
||||
public void testEscaped_declarations() throws Exception {
|
||||
runTest("js/js.translator/testData/typescript-export/escaped-declarations-in-exported-file/escaped-declarations.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("js/js.translator/testData/typescript-export/functions")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@@ -121,6 +201,22 @@ public class IrJsTypeScriptExportTestGenerated extends AbstractIrJsTypeScriptExp
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("js/js.translator/testData/typescript-export/functions-in-exported-file")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Functions_in_exported_file {
|
||||
@Test
|
||||
public void testAllFilesPresentInFunctions_in_exported_file() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("js/js.translator/testData/typescript-export/functions-in-exported-file"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.JS_IR, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("functions.kt")
|
||||
public void testFunctions() throws Exception {
|
||||
runTest("js/js.translator/testData/typescript-export/functions-in-exported-file/functions.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("js/js.translator/testData/typescript-export/implicit-export")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@@ -169,6 +265,22 @@ public class IrJsTypeScriptExportTestGenerated extends AbstractIrJsTypeScriptExp
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("js/js.translator/testData/typescript-export/inner-classes-in-exported-file")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Inner_classes_in_exported_file {
|
||||
@Test
|
||||
public void testAllFilesPresentInInner_classes_in_exported_file() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("js/js.translator/testData/typescript-export/inner-classes-in-exported-file"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.JS_IR, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("inner-class.kt")
|
||||
public void testInner_class() throws Exception {
|
||||
runTest("js/js.translator/testData/typescript-export/inner-classes-in-exported-file/inner-class.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("js/js.translator/testData/typescript-export/interfaces")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@@ -185,6 +297,22 @@ public class IrJsTypeScriptExportTestGenerated extends AbstractIrJsTypeScriptExp
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("js/js.translator/testData/typescript-export/interfaces-in-exported-file")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Interfaces_in_exported_file {
|
||||
@Test
|
||||
public void testAllFilesPresentInInterfaces_in_exported_file() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("js/js.translator/testData/typescript-export/interfaces-in-exported-file"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.JS_IR, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("interfaces.kt")
|
||||
public void testInterfaces() throws Exception {
|
||||
runTest("js/js.translator/testData/typescript-export/interfaces-in-exported-file/interfaces.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("js/js.translator/testData/typescript-export/js-name")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@@ -201,6 +329,22 @@ public class IrJsTypeScriptExportTestGenerated extends AbstractIrJsTypeScriptExp
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("js/js.translator/testData/typescript-export/js-name-in-exported-file")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Js_name_in_exported_file {
|
||||
@Test
|
||||
public void testAllFilesPresentInJs_name_in_exported_file() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("js/js.translator/testData/typescript-export/js-name-in-exported-file"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.JS_IR, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("js-name.kt")
|
||||
public void testJs_name() throws Exception {
|
||||
runTest("js/js.translator/testData/typescript-export/js-name-in-exported-file/js-name.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("js/js.translator/testData/typescript-export/member-properties")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@@ -217,6 +361,22 @@ public class IrJsTypeScriptExportTestGenerated extends AbstractIrJsTypeScriptExp
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("js/js.translator/testData/typescript-export/member-properties-in-exported-file")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Member_properties_in_exported_file {
|
||||
@Test
|
||||
public void testAllFilesPresentInMember_properties_in_exported_file() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("js/js.translator/testData/typescript-export/member-properties-in-exported-file"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.JS_IR, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("member-properties.kt")
|
||||
public void testMember_properties() throws Exception {
|
||||
runTest("js/js.translator/testData/typescript-export/member-properties-in-exported-file/member-properties.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("js/js.translator/testData/typescript-export/methods")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@@ -233,6 +393,22 @@ public class IrJsTypeScriptExportTestGenerated extends AbstractIrJsTypeScriptExp
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("js/js.translator/testData/typescript-export/methods-in-exported-file")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Methods_in_exported_file {
|
||||
@Test
|
||||
public void testAllFilesPresentInMethods_in_exported_file() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("js/js.translator/testData/typescript-export/methods-in-exported-file"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.JS_IR, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("methods.kt")
|
||||
public void testMethods() throws Exception {
|
||||
runTest("js/js.translator/testData/typescript-export/methods-in-exported-file/methods.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("js/js.translator/testData/typescript-export/module-systems")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@@ -261,6 +437,34 @@ public class IrJsTypeScriptExportTestGenerated extends AbstractIrJsTypeScriptExp
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("js/js.translator/testData/typescript-export/module-systems-in-exported-file")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Module_systems_in_exported_file {
|
||||
@Test
|
||||
public void testAllFilesPresentInModule_systems_in_exported_file() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("js/js.translator/testData/typescript-export/module-systems-in-exported-file"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.JS_IR, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("commonjs.kt")
|
||||
public void testCommonjs() throws Exception {
|
||||
runTest("js/js.translator/testData/typescript-export/module-systems-in-exported-file/commonjs.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("plain.kt")
|
||||
public void testPlain() throws Exception {
|
||||
runTest("js/js.translator/testData/typescript-export/module-systems-in-exported-file/plain.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("umd.kt")
|
||||
public void testUmd() throws Exception {
|
||||
runTest("js/js.translator/testData/typescript-export/module-systems-in-exported-file/umd.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("js/js.translator/testData/typescript-export/namespaces")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@@ -277,6 +481,22 @@ public class IrJsTypeScriptExportTestGenerated extends AbstractIrJsTypeScriptExp
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("js/js.translator/testData/typescript-export/namespaces-in-exported-file")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Namespaces_in_exported_file {
|
||||
@Test
|
||||
public void testAllFilesPresentInNamespaces_in_exported_file() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("js/js.translator/testData/typescript-export/namespaces-in-exported-file"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.JS_IR, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("namespaces.kt")
|
||||
public void testNamespaces() throws Exception {
|
||||
runTest("js/js.translator/testData/typescript-export/namespaces-in-exported-file/namespaces.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("js/js.translator/testData/typescript-export/objects")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@@ -293,6 +513,22 @@ public class IrJsTypeScriptExportTestGenerated extends AbstractIrJsTypeScriptExp
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("js/js.translator/testData/typescript-export/objects-in-exported-file")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Objects_in_exported_file {
|
||||
@Test
|
||||
public void testAllFilesPresentInObjects_in_exported_file() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("js/js.translator/testData/typescript-export/objects-in-exported-file"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.JS_IR, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("objects.kt")
|
||||
public void testObjects() throws Exception {
|
||||
runTest("js/js.translator/testData/typescript-export/objects-in-exported-file/objects.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("js/js.translator/testData/typescript-export/primitives")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@@ -309,6 +545,22 @@ public class IrJsTypeScriptExportTestGenerated extends AbstractIrJsTypeScriptExp
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("js/js.translator/testData/typescript-export/primitives-in-exported-file")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Primitives_in_exported_file {
|
||||
@Test
|
||||
public void testAllFilesPresentInPrimitives_in_exported_file() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("js/js.translator/testData/typescript-export/primitives-in-exported-file"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.JS_IR, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("primitives.kt")
|
||||
public void testPrimitives() throws Exception {
|
||||
runTest("js/js.translator/testData/typescript-export/primitives-in-exported-file/primitives.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("js/js.translator/testData/typescript-export/properties")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@@ -325,6 +577,22 @@ public class IrJsTypeScriptExportTestGenerated extends AbstractIrJsTypeScriptExp
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("js/js.translator/testData/typescript-export/properties-in-exported-file")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Properties_in_exported_file {
|
||||
@Test
|
||||
public void testAllFilesPresentInProperties_in_exported_file() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("js/js.translator/testData/typescript-export/properties-in-exported-file"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.JS_IR, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("properties.kt")
|
||||
public void testProperties() throws Exception {
|
||||
runTest("js/js.translator/testData/typescript-export/properties-in-exported-file/properties.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("js/js.translator/testData/typescript-export/regular-classes")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@@ -341,6 +609,22 @@ public class IrJsTypeScriptExportTestGenerated extends AbstractIrJsTypeScriptExp
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("js/js.translator/testData/typescript-export/regular-classes-in-exported-file")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Regular_classes_in_exported_file {
|
||||
@Test
|
||||
public void testAllFilesPresentInRegular_classes_in_exported_file() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("js/js.translator/testData/typescript-export/regular-classes-in-exported-file"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.JS_IR, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("regular-classes.kt")
|
||||
public void testRegular_classes() throws Exception {
|
||||
runTest("js/js.translator/testData/typescript-export/regular-classes-in-exported-file/regular-classes.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("js/js.translator/testData/typescript-export/sealed-classes")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@@ -357,6 +641,22 @@ public class IrJsTypeScriptExportTestGenerated extends AbstractIrJsTypeScriptExp
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("js/js.translator/testData/typescript-export/sealed-classes-in-exported-file")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Sealed_classes_in_exported_file {
|
||||
@Test
|
||||
public void testAllFilesPresentInSealed_classes_in_exported_file() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("js/js.translator/testData/typescript-export/sealed-classes-in-exported-file"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.JS_IR, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("sealed-classes.kt")
|
||||
public void testSealed_classes() throws Exception {
|
||||
runTest("js/js.translator/testData/typescript-export/sealed-classes-in-exported-file/sealed-classes.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("js/js.translator/testData/typescript-export/selective-export")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@@ -374,18 +674,18 @@ public class IrJsTypeScriptExportTestGenerated extends AbstractIrJsTypeScriptExp
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("js/js.translator/testData/typescript-export/strictImplicitExport")
|
||||
@TestMetadata("js/js.translator/testData/typescript-export/strict-implicit-export")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class StrictImplicitExport {
|
||||
public class Strict_implicit_export {
|
||||
@Test
|
||||
public void testAllFilesPresentInStrictImplicitExport() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("js/js.translator/testData/typescript-export/strictImplicitExport"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.JS_IR, true);
|
||||
public void testAllFilesPresentInStrict_implicit_export() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("js/js.translator/testData/typescript-export/strict-implicit-export"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.JS_IR, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("declarations.kt")
|
||||
public void testDeclarations() throws Exception {
|
||||
runTest("js/js.translator/testData/typescript-export/strictImplicitExport/declarations.kt");
|
||||
@TestMetadata("strict-implicit-export.kt")
|
||||
public void testStrict_implicit_export() throws Exception {
|
||||
runTest("js/js.translator/testData/typescript-export/strict-implicit-export/strict-implicit-export.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -404,4 +704,20 @@ public class IrJsTypeScriptExportTestGenerated extends AbstractIrJsTypeScriptExp
|
||||
runTest("js/js.translator/testData/typescript-export/visibility/visibility.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("js/js.translator/testData/typescript-export/visibility-in-exported-file")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Visibility_in_exported_file {
|
||||
@Test
|
||||
public void testAllFilesPresentInVisibility_in_exported_file() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("js/js.translator/testData/typescript-export/visibility-in-exported-file"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.JS_IR, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("visibility.kt")
|
||||
public void testVisibility() throws Exception {
|
||||
runTest("js/js.translator/testData/typescript-export/visibility-in-exported-file/visibility.kt");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
// TARGET_BACKEND: JS_IR
|
||||
// RUN_PLAIN_BOX_FUNCTION
|
||||
// INFER_MAIN_MODULE
|
||||
|
||||
// MODULE: bridge_saving_after_export
|
||||
// FILE: lib.kt
|
||||
@file:JsExport
|
||||
|
||||
open class A<T> {
|
||||
open fun foo(value: T): T = value
|
||||
}
|
||||
|
||||
class B: A<String>() {
|
||||
override fun foo(value: String): String = value
|
||||
}
|
||||
|
||||
// FILE: test.js
|
||||
function box() {
|
||||
var a = new this["bridge_saving_after_export"].A()
|
||||
var aFoo = a.foo("ok")
|
||||
if (aFoo != "ok") return "fail 1"
|
||||
|
||||
var b = new this["bridge_saving_after_export"].B()
|
||||
var bFoo = b.foo("ok")
|
||||
if (bFoo != "ok") return "fail 2"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
// IGNORE_FIR
|
||||
// KT-49225
|
||||
// RUN_PLAIN_BOX_FUNCTION
|
||||
// IGNORE_BACKEND: JS
|
||||
// SPLIT_PER_MODULE
|
||||
|
||||
// MODULE: lib
|
||||
// FILE: koo.kt
|
||||
value class Koo(val koo: String = "OK")
|
||||
|
||||
// FILE: bar.kt
|
||||
@file:JsExport
|
||||
|
||||
class Bar(val koo: Koo = Koo())
|
||||
|
||||
// MODULE: main(lib)
|
||||
// FILE: main.js
|
||||
function box() {
|
||||
return new kotlin_lib.Bar().koo;
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
// FILE: lib.kt
|
||||
@file:JsExport
|
||||
|
||||
class Foo(internal val constructorParameter: String) {
|
||||
internal val nonDefaultAccessor: String
|
||||
get() = "hello"
|
||||
|
||||
internal val defaultAccessor: String = constructorParameter + "!"
|
||||
}
|
||||
|
||||
enum class Bar(internal val constructorParameter: String) {
|
||||
A("a");
|
||||
|
||||
internal val nonDefaultAccessor: String
|
||||
get() = "hello"
|
||||
|
||||
internal val defaultAccessor: String = constructorParameter + "!"
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
fun box(): String {
|
||||
val foo = Foo("foo")
|
||||
if (foo.constructorParameter != "foo") return "fail1"
|
||||
if (foo.nonDefaultAccessor != "hello") return "fail2"
|
||||
if (foo.defaultAccessor != "foo!") return "fail3"
|
||||
|
||||
if (Bar.A.constructorParameter != "a") return "fail4"
|
||||
if (Bar.A.nonDefaultAccessor != "hello") return "fail5"
|
||||
if (Bar.A.defaultAccessor != "a!") return "fail6"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
// IGNORE_BACKEND: JS
|
||||
// RUN_PLAIN_BOX_FUNCTION
|
||||
// INFER_MAIN_MODULE
|
||||
|
||||
// MODULE: export_enum_class
|
||||
// FILE: lib.kt
|
||||
@file:JsExport
|
||||
|
||||
enum class Foo(val constructorParameter: String) {
|
||||
A("aConstructorParameter"),
|
||||
B("bConstructorParameter");
|
||||
|
||||
val foo = ordinal
|
||||
|
||||
fun bar(value: String) = value
|
||||
|
||||
fun bay() = name
|
||||
|
||||
companion object {
|
||||
val baz = "baz"
|
||||
}
|
||||
}
|
||||
|
||||
enum class Bar {
|
||||
A,
|
||||
B {
|
||||
var d = "d"
|
||||
init {
|
||||
d = "d2"
|
||||
}
|
||||
fun huh() = "huh"
|
||||
};
|
||||
|
||||
val foo = ordinal
|
||||
|
||||
fun bar(value: String) = value
|
||||
|
||||
fun bay() = name
|
||||
}
|
||||
|
||||
class OuterClass {
|
||||
enum class NestedEnum {
|
||||
A,
|
||||
B;
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: test.js
|
||||
function box() {
|
||||
if (this["export_enum_class"].Foo.A !== this["export_enum_class"].Foo.A) return "fail1"
|
||||
if (this["export_enum_class"].Foo.B !== this["export_enum_class"].Foo.B) return "fail2"
|
||||
|
||||
if (this["export_enum_class"].Foo.Companion.baz !== "baz") return "fail3"
|
||||
|
||||
if (this["export_enum_class"].Foo.A.foo !== 0) return "fail4"
|
||||
if (this["export_enum_class"].Foo.B.foo !== 1) return "fail5"
|
||||
|
||||
if (this["export_enum_class"].Foo.A.bar("A") !== "A") return "fail6"
|
||||
if (this["export_enum_class"].Foo.B.bar("B") !== "B") return "fail7"
|
||||
|
||||
if (this["export_enum_class"].Foo.A.bay() !== "A") return "fail8"
|
||||
if (this["export_enum_class"].Foo.B.bay() !== "B") return "fail9"
|
||||
|
||||
if (this["export_enum_class"].Foo.A.constructorParameter !== "aConstructorParameter") return "fail10"
|
||||
if (this["export_enum_class"].Foo.B.constructorParameter !== "bConstructorParameter") return "fail11"
|
||||
|
||||
if (this["export_enum_class"].Bar.A.foo !== 0) return "fail12"
|
||||
if (this["export_enum_class"].Bar.B.foo !== 1) return "fail13"
|
||||
|
||||
if (this["export_enum_class"].Bar.A.bar("A") !== "A") return "fail14"
|
||||
if (this["export_enum_class"].Bar.B.bar("B") !== "B") return "fail15"
|
||||
|
||||
if (this["export_enum_class"].Bar.A.bay() !== "A") return "fail15"
|
||||
if (this["export_enum_class"].Bar.B.bay() !== "B") return "fail16"
|
||||
|
||||
if (this["export_enum_class"].Bar.B.constructor.prototype.hasOwnProperty('d')) return "fail17"
|
||||
if (this["export_enum_class"].Bar.B.constructor.prototype.hasOwnProperty('huh')) return "fail18"
|
||||
|
||||
if (this["export_enum_class"].Foo.valueOf("A") !== this["export_enum_class"].Foo.A) return "fail19"
|
||||
if (this["export_enum_class"].Foo.valueOf("B") !== this["export_enum_class"].Foo.B) return "fail20"
|
||||
|
||||
if (this["export_enum_class"].Foo.values().indexOf(this["export_enum_class"].Foo.A) === -1) return "fail21"
|
||||
if (this["export_enum_class"].Foo.values().indexOf(this["export_enum_class"].Foo.B) === -1) return "fail22"
|
||||
|
||||
if (this["export_enum_class"].Foo.A.name !== "A") return "fail23"
|
||||
if (this["export_enum_class"].Foo.B.name !== "B") return "fail24"
|
||||
|
||||
if (this["export_enum_class"].Foo.A.ordinal !== 0) return "fail25"
|
||||
if (this["export_enum_class"].Foo.B.ordinal !== 1) return "fail26"
|
||||
|
||||
if (this["export_enum_class"].OuterClass.NestedEnum.A.name !== "A") return "fail27"
|
||||
if (this["export_enum_class"].OuterClass.NestedEnum.B.name !== "B") return "fail28"
|
||||
|
||||
if (this["export_enum_class"].OuterClass.NestedEnum.A.ordinal !== 0) return "fail29"
|
||||
if (this["export_enum_class"].OuterClass.NestedEnum.B.ordinal !== 1) return "fail30"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
// IGNORE_BACKEND: JS
|
||||
// RUN_PLAIN_BOX_FUNCTION
|
||||
// INFER_MAIN_MODULE
|
||||
|
||||
// MODULE: export_interface
|
||||
// FILE: not_exported.kt
|
||||
|
||||
interface ParentI {
|
||||
val str: String
|
||||
}
|
||||
|
||||
interface ExtendedI: I {
|
||||
fun bar(): Int
|
||||
}
|
||||
|
||||
open class NotExportedClass(override var value: Int) : ExtendedI {
|
||||
override var variable: Int = value
|
||||
override open fun foo(): String = "Not Exported"
|
||||
override val str: String = "test 1"
|
||||
override open fun bar(): Int = 42
|
||||
}
|
||||
|
||||
|
||||
// FILE: exportes.kt
|
||||
@file:JsExport
|
||||
|
||||
interface I : ParentI {
|
||||
val value: Int
|
||||
var variable: Int
|
||||
fun foo(): String
|
||||
}
|
||||
|
||||
class ExportedClass(override val value: Int) : ExtendedI {
|
||||
override var variable: Int = value
|
||||
override fun foo(): String = "Exported"
|
||||
override val str: String = "test 2"
|
||||
override open fun bar(): Int = 43
|
||||
}
|
||||
|
||||
class AnotherOne : NotExportedClass(42) {
|
||||
override fun foo(): String = "Another One Exported"
|
||||
}
|
||||
|
||||
fun generateNotExported(value: Int): NotExportedClass {
|
||||
return NotExportedClass(value)
|
||||
}
|
||||
|
||||
fun consume(i: I): String {
|
||||
return "Value is ${i.value}, variable is ${i.variable} and result is '${i.foo()}'"
|
||||
}
|
||||
|
||||
// FILE: test.js
|
||||
function box() {
|
||||
const { I, ExportedClass, AnotherOne, generateNotExported, consume } = this["export_interface"]
|
||||
|
||||
if (I !== undefined) return "Fail: module should not export interface in runtime"
|
||||
|
||||
const exported = new ExportedClass(1)
|
||||
const another = new AnotherOne()
|
||||
const notExported = generateNotExported (3)
|
||||
|
||||
if (exported.foo() !== "Exported") return "Fail: foo function was not generated for ExportedClass"
|
||||
if (another.foo() !== "Another One Exported") return "Fail: foo function was not generated for AnotherOne"
|
||||
if (notExported.foo() !== "Not Exported") return "Fail: foo function was not generated for NotExportedClass"
|
||||
|
||||
if (exported.value !== 1) return "Fail: value getter was not generated for ExportedClass"
|
||||
if (another.value !== 42) return "Fail: value getter was not generated for AnotherOne"
|
||||
if (notExported.value !== 3) return "Fail: value getter was not generated for NotExportedClass"
|
||||
|
||||
if (exported.variable !== 1) return "Fail: variable getter was not generated for ExportedClass"
|
||||
if (another.variable !== 42) return "Fail: variable getter was not generated for AnotherOne"
|
||||
if (notExported.variable !== 3) return "Fail: variable getter was not generated for NotExportedClass"
|
||||
|
||||
exported.variable = 101
|
||||
another.variable = 102
|
||||
notExported.variable = 103
|
||||
|
||||
if (exported.variable !== 101) return "Fail: variable setter was not generated for ExportedClass"
|
||||
if (another.variable !== 102) return "Fail: variable setter was not generated for AnotherOne"
|
||||
if (notExported.variable !== 103) return "Fail: variable setter was not generated for NotExportedClass"
|
||||
|
||||
notExported.value = 42
|
||||
if (notExported.value !== 3) return "Fail: value setter was generated for NotExportedClass, but it shouldn't"
|
||||
|
||||
if (consume(exported) !== "Value is 1, variable is 101 and result is 'Exported'") return "Fail: methods or fields of ExportedClass was mangled"
|
||||
if (consume(another) !== "Value is 42, variable is 102 and result is 'Another One Exported'") return "Fail: methods or fields of AnotherOne was mangled"
|
||||
if (consume(notExported) !== "Value is 3, variable is 103 and result is 'Not Exported'") return "Fail: methods or fields of NotExported was mangled"
|
||||
|
||||
if (notExported.str !== undefined) return "Fail: str should not exist inside NotExportedClass"
|
||||
if (exported.str !== undefined) return "Fail: str should not exist inside ExportedClass"
|
||||
|
||||
if (notExported.bar !== undefined) return "Fail: bar should not exist inside NotExportedClass"
|
||||
if (exported.bar !== undefined) return "Fail: bar should not exist inside ExportedClass"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
// EXPECTED_REACHABLE_NODES: 1252
|
||||
// IGNORE_BACKEND: JS
|
||||
// RUN_PLAIN_BOX_FUNCTION
|
||||
// INFER_MAIN_MODULE
|
||||
// SKIP_DCE_DRIVEN
|
||||
|
||||
// MODULE: export_nested_class
|
||||
// FILE: lib.kt
|
||||
@file:JsExport
|
||||
|
||||
abstract class A {
|
||||
abstract fun foo(k: String): String
|
||||
}
|
||||
|
||||
class B {
|
||||
class Foo : A() {
|
||||
override fun foo(k: String): String {
|
||||
return "O" + k
|
||||
}
|
||||
|
||||
fun bar(k: String): String {
|
||||
return foo(k)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
object MyObject {
|
||||
class A {
|
||||
fun valueA() = "OK"
|
||||
}
|
||||
class B {
|
||||
fun valueB() = "OK"
|
||||
}
|
||||
class C {
|
||||
fun valueC() = "OK"
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: test.js
|
||||
function box() {
|
||||
if (new this["export_nested_class"].B.Foo().bar("K") != "OK") return "fail 1";
|
||||
if (new this["export_nested_class"].MyObject.A().valueA() != "OK") return "fail 2";
|
||||
if (new this["export_nested_class"].MyObject.B().valueB() != "OK") return "fail 3";
|
||||
if (new this["export_nested_class"].MyObject.C().valueC() != "OK") return "fail 4";
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
// EXPECTED_REACHABLE_NODES: 1265
|
||||
// RUN_PLAIN_BOX_FUNCTION
|
||||
// INFER_MAIN_MODULE
|
||||
// SKIP_MINIFICATION
|
||||
// SKIP_DCE_DRIVEN
|
||||
// SKIP_NODE_JS
|
||||
|
||||
// See KT-43783
|
||||
|
||||
// MODULE: nestedObjectExport
|
||||
// FILE: lib.kt
|
||||
@file:JsExport
|
||||
|
||||
class Abc {
|
||||
companion object AbcCompanion {
|
||||
fun xyz(): String = "Companion object method OK"
|
||||
|
||||
val prop: String
|
||||
get() = "Companion object property OK"
|
||||
}
|
||||
}
|
||||
|
||||
class Foo {
|
||||
companion object {
|
||||
fun xyz(): String = "Companion object method OK"
|
||||
|
||||
val prop: String
|
||||
get() = "Companion object property OK"
|
||||
}
|
||||
}
|
||||
|
||||
sealed class MyEnum(val name: String) {
|
||||
object A: MyEnum("A")
|
||||
object B: MyEnum("B")
|
||||
object C: MyEnum("C")
|
||||
}
|
||||
|
||||
object MyObject {
|
||||
object A {
|
||||
fun valueA() = "OK"
|
||||
}
|
||||
object B {
|
||||
fun valueB() = "OK"
|
||||
}
|
||||
object C {
|
||||
fun valueC() = "OK"
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: test.js
|
||||
|
||||
function box() {
|
||||
const abcCompanion = nestedObjectExport.Abc.AbcCompanion;
|
||||
|
||||
if (abcCompanion.xyz() != 'Companion object method OK') return 'companion object function failure';
|
||||
if (abcCompanion.prop != 'Companion object property OK') return 'companion object property failure';
|
||||
|
||||
const justCompanion = nestedObjectExport.Foo.Companion;
|
||||
|
||||
if (justCompanion.xyz() != 'Companion object method OK') return 'companion object function failure';
|
||||
if (justCompanion.prop != 'Companion object property OK') return 'companion object property failure';
|
||||
|
||||
if (nestedObjectExport.MyEnum.A.name != 'A') return 'MyEnum.A failure';
|
||||
if (nestedObjectExport.MyEnum.B.name != 'B') return 'MyEnum.B failure';
|
||||
if (nestedObjectExport.MyEnum.C.name != 'C') return 'MyEnum.C failure';
|
||||
|
||||
if (nestedObjectExport.MyObject.A.valueA() != "OK") return 'MyObject.A failure';
|
||||
if (nestedObjectExport.MyObject.B.valueB() != "OK") return 'MyObject.B failure';
|
||||
if (nestedObjectExport.MyObject.C.valueC() != "OK") return 'MyObject.C failure';
|
||||
|
||||
return 'OK';
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
// EXPECTED_REACHABLE_NODES: 1265
|
||||
// RUN_PLAIN_BOX_FUNCTION
|
||||
// INFER_MAIN_MODULE
|
||||
// SKIP_MINIFICATION
|
||||
// SKIP_NODE_JS
|
||||
// SKIP_DCE_DRIVEN
|
||||
|
||||
// MODULE: exportProtectedMembers
|
||||
// FILE: lib.kt
|
||||
@file:JsExport
|
||||
|
||||
open class Foo protected constructor() {
|
||||
protected fun bar(): String = "protected method"
|
||||
|
||||
private var _baz: String = "baz"
|
||||
|
||||
protected var baz: String
|
||||
get() = _baz
|
||||
set(value) {
|
||||
_baz = value
|
||||
}
|
||||
|
||||
protected val bazReadOnly: String
|
||||
get() = _baz
|
||||
|
||||
protected val quux: String = "quux"
|
||||
|
||||
protected var quuz: String = "quuz"
|
||||
|
||||
protected class NestedClass {
|
||||
val prop: String = "nested class property"
|
||||
}
|
||||
protected object NestedObject {
|
||||
val prop: String = "nested object property"
|
||||
}
|
||||
|
||||
protected companion object {
|
||||
val prop: String = "companion object property"
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: test.js
|
||||
function box() {
|
||||
foo = new exportProtectedMembers.Foo();
|
||||
|
||||
if (foo.bar() != 'protected method') return 'failed to call protected method';
|
||||
if (foo.baz != 'baz') return 'failed to read `baz`';
|
||||
if (foo.bazReadOnly != 'baz') return 'failed to read `bazReadOnly`';
|
||||
foo.baz = 'beer';
|
||||
if (foo.baz != 'beer') return 'failed to write protected var';
|
||||
if (foo.bazReadOnly != 'beer') return 'unexpected value of `bazReadOnly` after modifying `baz`';
|
||||
if (foo.quux != 'quux') return 'failed to read `quux`';
|
||||
if (foo.quuz != 'quuz') return 'failed to read `quuz`';
|
||||
foo.quuz = 'ale';
|
||||
if (foo.quuz != 'ale') return 'failed to write `quuz`';
|
||||
|
||||
nestedClass = new exportProtectedMembers.Foo.NestedClass()
|
||||
if (nestedClass.prop != 'nested class property')
|
||||
return 'failed to read protected class property'
|
||||
if (exportProtectedMembers.Foo.NestedObject.prop != 'nested object property')
|
||||
return 'failed to read protected nested object property'
|
||||
if (exportProtectedMembers.Foo.Companion.prop != 'companion object property')
|
||||
return 'failed to read protected companion object property'
|
||||
|
||||
return 'OK';
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
// EXPECTED_REACHABLE_NODES: 1270
|
||||
// SKIP_MINIFICATION
|
||||
// RUN_PLAIN_BOX_FUNCTION
|
||||
// INFER_MAIN_MODULE
|
||||
// SKIP_NODE_JS
|
||||
|
||||
// MODULE: non_identifier_module_name
|
||||
// FILE: lib.kt
|
||||
@file:JsExport
|
||||
|
||||
@JsName("foo")
|
||||
public fun foo(k: String): String = "O$k"
|
||||
|
||||
// FILE: test.js
|
||||
function box() {
|
||||
return this["non_identifier_module_name"].foo("K");
|
||||
}
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
// EXPECTED_REACHABLE_NODES: 1252
|
||||
// IGNORE_BACKEND: JS
|
||||
// RUN_PLAIN_BOX_FUNCTION
|
||||
// INFER_MAIN_MODULE
|
||||
|
||||
// MODULE: overriden_chain_non_export_intermediate
|
||||
// FILE: not_exported.kt
|
||||
abstract class B : A() {
|
||||
abstract fun baz(): String
|
||||
|
||||
override fun foo(): String = "foo"
|
||||
}
|
||||
|
||||
|
||||
// FILE: exported.kt
|
||||
@file:JsExport
|
||||
|
||||
abstract class A {
|
||||
abstract fun foo(): String
|
||||
|
||||
abstract fun bar(): String
|
||||
}
|
||||
|
||||
class C : B() {
|
||||
override fun bar(): String = "bar"
|
||||
override fun baz(): String = "baz"
|
||||
|
||||
fun bay(): String = "bay"
|
||||
}
|
||||
|
||||
// FILE: test.js
|
||||
|
||||
function box() {
|
||||
return test(new this["overriden_chain_non_export_intermediate"].C());
|
||||
}
|
||||
|
||||
function test(c) {
|
||||
if (c.foo() === "foo" && c.bar() === "bar" && c.bay() == "bay") return "OK"
|
||||
|
||||
return "fail"
|
||||
}
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
// EXPECTED_REACHABLE_NODES: 1252
|
||||
// IGNORE_BACKEND: JS
|
||||
// RUN_PLAIN_BOX_FUNCTION
|
||||
// INFER_MAIN_MODULE
|
||||
|
||||
// MODULE: lib
|
||||
// FILE: not_exported.kt
|
||||
|
||||
external abstract class Foo {
|
||||
abstract fun o(): String
|
||||
}
|
||||
|
||||
abstract class Bar : Foo() {
|
||||
@JsName("oStable")
|
||||
abstract fun String.o(): String
|
||||
|
||||
override fun o(): String {
|
||||
return "O".o()
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: exported.kt
|
||||
@file:JsExport
|
||||
|
||||
class Baz : Bar() {
|
||||
override fun String.o(): String {
|
||||
return this
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: test.js
|
||||
function Foo() {}
|
||||
Foo.prototype.k = function() {
|
||||
return "K"
|
||||
}
|
||||
|
||||
function box() {
|
||||
return test(new this["lib"].Baz());
|
||||
}
|
||||
|
||||
function test(foo) {
|
||||
const oStable = foo.oStable("OK")
|
||||
if (oStable !== "OK") return "false: " + oStable
|
||||
return foo.o() + foo.k()
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
// IGNORE_BACKEND: JS
|
||||
// EXPECTED_REACHABLE_NODES: 1270
|
||||
// SKIP_MINIFICATION
|
||||
// RUN_PLAIN_BOX_FUNCTION
|
||||
// INFER_MAIN_MODULE
|
||||
|
||||
// MODULE: if
|
||||
// FILE: lib.kt
|
||||
@file:JsExport
|
||||
|
||||
@JsName("foo")
|
||||
public fun foo(k: String): String = "O$k"
|
||||
|
||||
// FILE: test.js
|
||||
function box() {
|
||||
return this["if"].foo("K");
|
||||
}
|
||||
Vendored
+19
@@ -0,0 +1,19 @@
|
||||
declare namespace JS_TESTS {
|
||||
type Nullable<T> = T | null | undefined
|
||||
namespace foo {
|
||||
abstract class TestAbstract {
|
||||
constructor(name: string);
|
||||
get name(): string;
|
||||
}
|
||||
namespace TestAbstract {
|
||||
class AA extends foo.TestAbstract {
|
||||
constructor();
|
||||
bar(): string;
|
||||
}
|
||||
class BB extends foo.TestAbstract {
|
||||
constructor();
|
||||
baz(): string;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Vendored
+24
@@ -0,0 +1,24 @@
|
||||
/** This file is generated by {@link :js:js.test:generateJsExportOnFileTestFilesForTS} task. DO NOT MODIFY MANUALLY */
|
||||
|
||||
// CHECK_TYPESCRIPT_DECLARATIONS
|
||||
// RUN_PLAIN_BOX_FUNCTION
|
||||
// SKIP_MINIFICATION
|
||||
// SKIP_NODE_JS
|
||||
// INFER_MAIN_MODULE
|
||||
// MODULE: JS_TESTS
|
||||
// FILE: abstract-classes.kt
|
||||
|
||||
@file:JsExport
|
||||
|
||||
package foo
|
||||
|
||||
// See KT-39364
|
||||
|
||||
abstract class TestAbstract(val name: String) {
|
||||
class AA : TestAbstract("AA") {
|
||||
fun bar(): String = "bar"
|
||||
}
|
||||
class BB : TestAbstract("BB") {
|
||||
fun baz(): String = "baz"
|
||||
}
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
var TestAbstract = JS_TESTS.foo.TestAbstract;
|
||||
function assert(condition) {
|
||||
if (!condition) {
|
||||
throw "Assertion failed";
|
||||
}
|
||||
}
|
||||
function box() {
|
||||
assert(new TestAbstract.AA().name == "AA");
|
||||
assert(new TestAbstract.AA().bar() == "bar");
|
||||
assert(new TestAbstract.BB().name == "BB");
|
||||
assert(new TestAbstract.BB().baz() == "baz");
|
||||
return "OK";
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
import TestAbstract = JS_TESTS.foo.TestAbstract;
|
||||
|
||||
function assert(condition: boolean) {
|
||||
if (!condition) {
|
||||
throw "Assertion failed";
|
||||
}
|
||||
}
|
||||
|
||||
function box(): string {
|
||||
assert(new TestAbstract.AA().name == "AA");
|
||||
assert(new TestAbstract.AA().bar() == "bar");
|
||||
assert(new TestAbstract.BB().name == "BB");
|
||||
assert(new TestAbstract.BB().baz() == "baz");
|
||||
|
||||
|
||||
return "OK";
|
||||
}
|
||||
Vendored
+37
@@ -0,0 +1,37 @@
|
||||
declare namespace JS_TESTS {
|
||||
type Nullable<T> = T | null | undefined
|
||||
class ClassWithDefaultCtor {
|
||||
constructor();
|
||||
get x(): string;
|
||||
}
|
||||
class ClassWithPrimaryCtor {
|
||||
constructor(x: string);
|
||||
get x(): string;
|
||||
}
|
||||
class ClassWithSecondaryCtor {
|
||||
private constructor();
|
||||
get x(): string;
|
||||
static create(y: string): ClassWithSecondaryCtor;
|
||||
}
|
||||
class ClassWithMultipleSecondaryCtors {
|
||||
private constructor();
|
||||
get x(): string;
|
||||
static createFromString(y: string): ClassWithMultipleSecondaryCtors;
|
||||
static createFromInts(y: number, z: number): ClassWithMultipleSecondaryCtors;
|
||||
}
|
||||
class OpenClassWithMixedConstructors {
|
||||
constructor(x: string);
|
||||
get x(): string;
|
||||
static createFromStrings(y: string, z: string): OpenClassWithMixedConstructors;
|
||||
static createFromInts(y: number, z: number): OpenClassWithMixedConstructors;
|
||||
}
|
||||
class DerivedClassWithSecondaryCtor extends OpenClassWithMixedConstructors {
|
||||
private constructor();
|
||||
static delegateToPrimary(y: string): DerivedClassWithSecondaryCtor;
|
||||
static delegateToCreateFromInts(y: number, z: number): DerivedClassWithSecondaryCtor;
|
||||
}
|
||||
class KotlinGreeter {
|
||||
constructor(greeting?: string);
|
||||
get greeting(): string;
|
||||
}
|
||||
}
|
||||
+76
@@ -0,0 +1,76 @@
|
||||
/** This file is generated by {@link :js:js.test:generateJsExportOnFileTestFilesForTS} task. DO NOT MODIFY MANUALLY */
|
||||
|
||||
// TARGET_BACKEND: JS_IR
|
||||
// IGNORE_BACKEND: JS_IR_ES6
|
||||
// CHECK_TYPESCRIPT_DECLARATIONS
|
||||
// RUN_PLAIN_BOX_FUNCTION
|
||||
// SKIP_MINIFICATION
|
||||
// SKIP_NODE_JS
|
||||
// INFER_MAIN_MODULE
|
||||
|
||||
// TODO fix statics export in DCE-driven mode
|
||||
// SKIP_DCE_DRIVEN
|
||||
|
||||
// MODULE: JS_TESTS
|
||||
// FILE: f1.kt
|
||||
|
||||
@file:JsExport
|
||||
|
||||
|
||||
class ClassWithDefaultCtor {
|
||||
val x = "ClassWithDefaultCtor::x"
|
||||
}
|
||||
|
||||
|
||||
class ClassWithPrimaryCtor(
|
||||
val x: String
|
||||
)
|
||||
|
||||
|
||||
class ClassWithSecondaryCtor {
|
||||
val x: String
|
||||
@JsName("create")
|
||||
constructor(y: String) {
|
||||
x = y
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class ClassWithMultipleSecondaryCtors {
|
||||
val x: String
|
||||
|
||||
@JsName("createFromString")
|
||||
constructor(y: String) {
|
||||
x = "fromString:$y"
|
||||
}
|
||||
|
||||
@JsName("createFromInts")
|
||||
constructor(y: Int, z: Int) {
|
||||
x = "fromInts:$y:$z"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
open class OpenClassWithMixedConstructors(val x: String) {
|
||||
@JsName("createFromStrings")
|
||||
constructor(y: String, z: String) : this("fromStrings:$y:$z")
|
||||
|
||||
@JsName("createFromInts")
|
||||
constructor(y: Int, z: Int) : this(y.toString(), z.toString())
|
||||
}
|
||||
|
||||
|
||||
class DerivedClassWithSecondaryCtor : OpenClassWithMixedConstructors {
|
||||
@JsName("delegateToPrimary")
|
||||
constructor(y: String) : super(y)
|
||||
|
||||
@JsName("delegateToCreateFromInts")
|
||||
constructor(y: Int, z: Int) : super(y, z)
|
||||
}
|
||||
|
||||
// FILE: f2.kt
|
||||
|
||||
@file:JsExport
|
||||
|
||||
|
||||
class KotlinGreeter(val greeting: String = "helau")
|
||||
Vendored
+38
@@ -0,0 +1,38 @@
|
||||
"use strict";
|
||||
var ClassWithDefaultCtor = JS_TESTS.ClassWithDefaultCtor, ClassWithPrimaryCtor = JS_TESTS.ClassWithPrimaryCtor, ClassWithSecondaryCtor = JS_TESTS.ClassWithSecondaryCtor, ClassWithMultipleSecondaryCtors = JS_TESTS.ClassWithMultipleSecondaryCtors, DerivedClassWithSecondaryCtor = JS_TESTS.DerivedClassWithSecondaryCtor, OpenClassWithMixedConstructors = JS_TESTS.OpenClassWithMixedConstructors, KotlinGreeter = JS_TESTS.KotlinGreeter;
|
||||
function box() {
|
||||
var o1 = new ClassWithDefaultCtor();
|
||||
if (o1.x !== "ClassWithDefaultCtor::x")
|
||||
return "Fail: ClassWithDefaultCtor";
|
||||
var o2 = new ClassWithPrimaryCtor("foo");
|
||||
if (o2.x !== "foo")
|
||||
return "Fail: ClassWithPrimaryCtor";
|
||||
var o3 = ClassWithSecondaryCtor.create("foo2");
|
||||
if (o3.x !== "foo2")
|
||||
return "Fail: ClassWithSecondaryCtor.create";
|
||||
var o4 = ClassWithMultipleSecondaryCtors.createFromString("foo3");
|
||||
if (o4.x !== "fromString:foo3")
|
||||
return "Fail: ClassWithMultipleSecondaryCtors.createFromString";
|
||||
var o5 = ClassWithMultipleSecondaryCtors.createFromInts(1, 2);
|
||||
if (o5.x !== "fromInts:1:2")
|
||||
return "Fail: ClassWithMultipleSecondaryCtors.createFromInts";
|
||||
var o6 = new OpenClassWithMixedConstructors("foo4");
|
||||
if (o6.x !== "foo4")
|
||||
return "Fail: OpenClassWithMixedConstructors";
|
||||
var o7 = OpenClassWithMixedConstructors.createFromStrings("foo", "bar");
|
||||
if (o7.x !== "fromStrings:foo:bar")
|
||||
return "Fail: OpenClassWithMixedConstructors.createFromStrings";
|
||||
var o8 = OpenClassWithMixedConstructors.createFromInts(10, -20);
|
||||
if (o8.x !== "fromStrings:10:-20")
|
||||
return "Fail: OpenClassWithMixedConstructors.createFromInts";
|
||||
var o9 = DerivedClassWithSecondaryCtor.delegateToPrimary("foo6");
|
||||
if (o9.x !== "foo6")
|
||||
return "Fail: DerivedClassWithSecondaryCtor.delegateToPrimary";
|
||||
var o10 = DerivedClassWithSecondaryCtor.delegateToCreateFromInts(-10, 20);
|
||||
if (o10.x !== "fromStrings:-10:20")
|
||||
return "Fail: DerivedClassWithSecondaryCtor.delegateToCreateFromInts";
|
||||
var kg = new KotlinGreeter("Hi");
|
||||
if (kg.greeting != "Hi")
|
||||
return "Fail: KotlinGreeter";
|
||||
return "OK";
|
||||
}
|
||||
Vendored
+52
@@ -0,0 +1,52 @@
|
||||
const {
|
||||
ClassWithDefaultCtor,
|
||||
ClassWithPrimaryCtor,
|
||||
ClassWithSecondaryCtor,
|
||||
ClassWithMultipleSecondaryCtors,
|
||||
DerivedClassWithSecondaryCtor,
|
||||
OpenClassWithMixedConstructors,
|
||||
KotlinGreeter
|
||||
} = JS_TESTS;
|
||||
|
||||
function box(): string {
|
||||
const o1 = new ClassWithDefaultCtor();
|
||||
if (o1.x !== "ClassWithDefaultCtor::x") return "Fail: ClassWithDefaultCtor";
|
||||
|
||||
|
||||
const o2 = new ClassWithPrimaryCtor("foo");
|
||||
if (o2.x !== "foo") return "Fail: ClassWithPrimaryCtor";
|
||||
|
||||
|
||||
const o3 = ClassWithSecondaryCtor.create("foo2");
|
||||
if (o3.x !== "foo2") return "Fail: ClassWithSecondaryCtor.create";
|
||||
|
||||
|
||||
const o4 = ClassWithMultipleSecondaryCtors.createFromString("foo3");
|
||||
if (o4.x !== "fromString:foo3") return "Fail: ClassWithMultipleSecondaryCtors.createFromString";
|
||||
|
||||
const o5 = ClassWithMultipleSecondaryCtors.createFromInts(1, 2);
|
||||
if (o5.x !== "fromInts:1:2") return "Fail: ClassWithMultipleSecondaryCtors.createFromInts";
|
||||
|
||||
|
||||
const o6 = new OpenClassWithMixedConstructors("foo4");
|
||||
if (o6.x !== "foo4") return "Fail: OpenClassWithMixedConstructors";
|
||||
|
||||
const o7 = OpenClassWithMixedConstructors.createFromStrings("foo", "bar");
|
||||
if (o7.x !== "fromStrings:foo:bar") return "Fail: OpenClassWithMixedConstructors.createFromStrings";
|
||||
|
||||
const o8 = OpenClassWithMixedConstructors.createFromInts(10, -20);
|
||||
if (o8.x !== "fromStrings:10:-20") return "Fail: OpenClassWithMixedConstructors.createFromInts";
|
||||
|
||||
|
||||
const o9 = DerivedClassWithSecondaryCtor.delegateToPrimary("foo6");
|
||||
if (o9.x !== "foo6") return "Fail: DerivedClassWithSecondaryCtor.delegateToPrimary";
|
||||
|
||||
const o10 = DerivedClassWithSecondaryCtor.delegateToCreateFromInts(-10, 20);
|
||||
if (o10.x !== "fromStrings:-10:20") return "Fail: DerivedClassWithSecondaryCtor.delegateToCreateFromInts";
|
||||
|
||||
|
||||
const kg = new KotlinGreeter("Hi");
|
||||
if (kg.greeting != "Hi") return "Fail: KotlinGreeter";
|
||||
|
||||
return "OK";
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"include": [ "./*" ],
|
||||
"extends": "../common.tsconfig.json"
|
||||
}
|
||||
@@ -12,16 +12,17 @@
|
||||
// MODULE: JS_TESTS
|
||||
// FILE: f1.kt
|
||||
|
||||
@file:JsExport
|
||||
|
||||
@JsExport
|
||||
class ClassWithDefaultCtor {
|
||||
val x = "ClassWithDefaultCtor::x"
|
||||
}
|
||||
|
||||
@JsExport
|
||||
class ClassWithPrimaryCtor(
|
||||
val x: String
|
||||
)
|
||||
|
||||
@JsExport
|
||||
class ClassWithSecondaryCtor {
|
||||
val x: String
|
||||
@JsName("create")
|
||||
@@ -30,6 +31,7 @@ class ClassWithSecondaryCtor {
|
||||
}
|
||||
}
|
||||
|
||||
@JsExport
|
||||
class ClassWithMultipleSecondaryCtors {
|
||||
val x: String
|
||||
|
||||
@@ -44,6 +46,7 @@ class ClassWithMultipleSecondaryCtors {
|
||||
}
|
||||
}
|
||||
|
||||
@JsExport
|
||||
open class OpenClassWithMixedConstructors(val x: String) {
|
||||
@JsName("createFromStrings")
|
||||
constructor(y: String, z: String) : this("fromStrings:$y:$z")
|
||||
@@ -52,6 +55,7 @@ open class OpenClassWithMixedConstructors(val x: String) {
|
||||
constructor(y: Int, z: Int) : this(y.toString(), z.toString())
|
||||
}
|
||||
|
||||
@JsExport
|
||||
class DerivedClassWithSecondaryCtor : OpenClassWithMixedConstructors {
|
||||
@JsName("delegateToPrimary")
|
||||
constructor(y: String) : super(y)
|
||||
|
||||
Vendored
+31
@@ -0,0 +1,31 @@
|
||||
declare namespace JS_TESTS {
|
||||
type Nullable<T> = T | null | undefined
|
||||
namespace foo {
|
||||
class TestDataClass {
|
||||
constructor(name: string);
|
||||
get name(): string;
|
||||
component1(): string;
|
||||
copy(name?: string): foo.TestDataClass;
|
||||
toString(): string;
|
||||
hashCode(): number;
|
||||
equals(other: Nullable<any>): boolean;
|
||||
}
|
||||
namespace TestDataClass {
|
||||
class Nested {
|
||||
constructor();
|
||||
get prop(): string;
|
||||
}
|
||||
}
|
||||
class KT39423 {
|
||||
constructor(a: string, b?: Nullable<number>);
|
||||
get a(): string;
|
||||
get b(): Nullable<number>;
|
||||
component1(): string;
|
||||
component2(): Nullable<number>;
|
||||
copy(a?: string, b?: Nullable<number>): foo.KT39423;
|
||||
toString(): string;
|
||||
hashCode(): number;
|
||||
equals(other: Nullable<any>): boolean;
|
||||
}
|
||||
}
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
/** This file is generated by {@link :js:js.test:generateJsExportOnFileTestFilesForTS} task. DO NOT MODIFY MANUALLY */
|
||||
|
||||
// CHECK_TYPESCRIPT_DECLARATIONS
|
||||
// RUN_PLAIN_BOX_FUNCTION
|
||||
// SKIP_MINIFICATION
|
||||
// SKIP_NODE_JS
|
||||
// INFER_MAIN_MODULE
|
||||
// MODULE: JS_TESTS
|
||||
// FILE: data-classes.kt
|
||||
|
||||
@file:JsExport
|
||||
|
||||
package foo
|
||||
|
||||
|
||||
|
||||
data class TestDataClass(val name: String) {
|
||||
class Nested {
|
||||
val prop: String = "hello"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
data class KT39423(
|
||||
val a: String,
|
||||
val b: Int? = null
|
||||
)
|
||||
Vendored
+35
@@ -0,0 +1,35 @@
|
||||
"use strict";
|
||||
var TestDataClass = JS_TESTS.foo.TestDataClass;
|
||||
var KT39423 = JS_TESTS.foo.KT39423;
|
||||
function assert(condition) {
|
||||
if (!condition) {
|
||||
throw "Assertion failed";
|
||||
}
|
||||
}
|
||||
function box() {
|
||||
assert(new TestDataClass("Test").name === "Test");
|
||||
assert(new TestDataClass("Test").component1() === "Test");
|
||||
assert(new TestDataClass("Test").copy("NewTest").name === "NewTest");
|
||||
assert(new TestDataClass("Test").toString() === "TestDataClass(name=Test)");
|
||||
assert(new TestDataClass("Test").hashCode() === new TestDataClass("Test").hashCode());
|
||||
assert(new TestDataClass("Test").hashCode() !== new TestDataClass("AnotherTest").hashCode());
|
||||
assert(new TestDataClass("Test").equals(new TestDataClass("Test")));
|
||||
assert(!new TestDataClass("Test").equals(new TestDataClass("AnotherTest")));
|
||||
assert(new TestDataClass.Nested().prop === "hello");
|
||||
assert(new KT39423("Test").a === "Test");
|
||||
assert(new KT39423("Test").b === null);
|
||||
assert(new KT39423("Test", null).a === "Test");
|
||||
assert(new KT39423("Test", null).b === null);
|
||||
assert(new KT39423("Test", 42).a === "Test");
|
||||
assert(new KT39423("Test", 42).b === 42);
|
||||
assert(new KT39423("Test", 42).component1() === "Test");
|
||||
assert(new KT39423("Test", 42).component2() === 42);
|
||||
assert(new KT39423("Test", 42).copy("NewTest").a === "NewTest");
|
||||
assert(new KT39423("Test", 42).copy("NewTest").b === 42);
|
||||
assert(new KT39423("Test", 42).copy("Test", null).a === "Test");
|
||||
assert(new KT39423("Test", 42).copy("Test", null).b === null);
|
||||
assert(new KT39423("Test").toString() === "KT39423(a=Test, b=null)");
|
||||
assert(new KT39423("Test", null).toString() === "KT39423(a=Test, b=null)");
|
||||
assert(new KT39423("Test", 42).toString() === "KT39423(a=Test, b=42)");
|
||||
return "OK";
|
||||
}
|
||||
Vendored
+45
@@ -0,0 +1,45 @@
|
||||
import TestDataClass = JS_TESTS.foo.TestDataClass;
|
||||
import KT39423 = JS_TESTS.foo.KT39423;
|
||||
|
||||
function assert(condition: boolean) {
|
||||
if (!condition) {
|
||||
throw "Assertion failed";
|
||||
}
|
||||
}
|
||||
|
||||
function box(): string {
|
||||
assert(new TestDataClass("Test").name === "Test");
|
||||
assert(new TestDataClass("Test").component1() === "Test");
|
||||
assert(new TestDataClass("Test").copy("NewTest").name === "NewTest");
|
||||
assert(new TestDataClass("Test").toString() === "TestDataClass(name=Test)");
|
||||
|
||||
assert(new TestDataClass("Test").hashCode() === new TestDataClass("Test").hashCode());
|
||||
assert(new TestDataClass("Test").hashCode() !== new TestDataClass("AnotherTest").hashCode());
|
||||
|
||||
assert(new TestDataClass("Test").equals(new TestDataClass("Test")));
|
||||
assert(!new TestDataClass("Test").equals(new TestDataClass("AnotherTest")));
|
||||
|
||||
assert(new TestDataClass.Nested().prop === "hello");
|
||||
|
||||
assert(new KT39423("Test").a === "Test")
|
||||
assert(new KT39423("Test").b === null)
|
||||
assert(new KT39423("Test", null).a === "Test")
|
||||
assert(new KT39423("Test", null).b === null)
|
||||
|
||||
assert(new KT39423("Test", 42).a === "Test")
|
||||
assert(new KT39423("Test", 42).b === 42)
|
||||
|
||||
assert(new KT39423("Test", 42).component1() === "Test")
|
||||
assert(new KT39423("Test", 42).component2() === 42)
|
||||
|
||||
assert(new KT39423("Test", 42).copy("NewTest").a === "NewTest")
|
||||
assert(new KT39423("Test", 42).copy("NewTest").b === 42)
|
||||
assert(new KT39423("Test", 42).copy("Test", null).a === "Test")
|
||||
assert(new KT39423("Test", 42).copy("Test", null).b === null)
|
||||
|
||||
assert(new KT39423("Test").toString() === "KT39423(a=Test, b=null)")
|
||||
assert(new KT39423("Test", null).toString() === "KT39423(a=Test, b=null)")
|
||||
assert(new KT39423("Test", 42).toString() === "KT39423(a=Test, b=42)")
|
||||
|
||||
return "OK";
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"include": [ "./*" ],
|
||||
"extends": "../common.tsconfig.json"
|
||||
}
|
||||
Vendored
+50
@@ -0,0 +1,50 @@
|
||||
declare namespace JS_TESTS {
|
||||
type Nullable<T> = T | null | undefined
|
||||
namespace foo {
|
||||
abstract class TestEnumClass {
|
||||
private constructor();
|
||||
get constructorParameter(): string;
|
||||
static get A(): foo.TestEnumClass & {
|
||||
get name(): "A";
|
||||
get ordinal(): 0;
|
||||
};
|
||||
static get B(): foo.TestEnumClass & {
|
||||
get name(): "B";
|
||||
get ordinal(): 1;
|
||||
};
|
||||
get foo(): number;
|
||||
bar(value: string): string;
|
||||
bay(): string;
|
||||
static values(): Array<foo.TestEnumClass>;
|
||||
static valueOf(value: string): foo.TestEnumClass;
|
||||
get name(): "A" | "B";
|
||||
get ordinal(): 0 | 1;
|
||||
}
|
||||
namespace TestEnumClass {
|
||||
class Nested {
|
||||
constructor();
|
||||
get prop(): string;
|
||||
}
|
||||
}
|
||||
class OuterClass {
|
||||
constructor();
|
||||
}
|
||||
namespace OuterClass {
|
||||
abstract class NestedEnum {
|
||||
private constructor();
|
||||
static get A(): foo.OuterClass.NestedEnum & {
|
||||
get name(): "A";
|
||||
get ordinal(): 0;
|
||||
};
|
||||
static get B(): foo.OuterClass.NestedEnum & {
|
||||
get name(): "B";
|
||||
get ordinal(): 1;
|
||||
};
|
||||
static values(): Array<foo.OuterClass.NestedEnum>;
|
||||
static valueOf(value: string): foo.OuterClass.NestedEnum;
|
||||
get name(): "A" | "B";
|
||||
get ordinal(): 0 | 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
/** This file is generated by {@link :js:js.test:generateJsExportOnFileTestFilesForTS} task. DO NOT MODIFY MANUALLY */
|
||||
|
||||
// CHECK_TYPESCRIPT_DECLARATIONS
|
||||
// RUN_PLAIN_BOX_FUNCTION
|
||||
// SKIP_MINIFICATION
|
||||
// SKIP_NODE_JS
|
||||
// INFER_MAIN_MODULE
|
||||
// MODULE: JS_TESTS
|
||||
// FILE: enum-classes.kt
|
||||
|
||||
@file:JsExport
|
||||
|
||||
package foo
|
||||
|
||||
|
||||
enum class TestEnumClass(val constructorParameter: String) {
|
||||
A("aConstructorParameter"),
|
||||
B("bConstructorParameter");
|
||||
|
||||
val foo = ordinal
|
||||
|
||||
fun bar(value: String) = value
|
||||
|
||||
fun bay() = name
|
||||
|
||||
class Nested {
|
||||
val prop: String = "hello2"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class OuterClass {
|
||||
enum class NestedEnum {
|
||||
A,
|
||||
B
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+36
@@ -0,0 +1,36 @@
|
||||
"use strict";
|
||||
var TestEnumClass = JS_TESTS.foo.TestEnumClass;
|
||||
var OuterClass = JS_TESTS.foo.OuterClass;
|
||||
function assert(condition) {
|
||||
if (!condition) {
|
||||
throw "Assertion failed";
|
||||
}
|
||||
}
|
||||
function box() {
|
||||
assert(TestEnumClass.A.foo == 0);
|
||||
assert(TestEnumClass.B.foo == 1);
|
||||
assert(TestEnumClass.A.bar("aBar") == "aBar");
|
||||
assert(TestEnumClass.B.bar("bBar") == "bBar");
|
||||
assert(TestEnumClass.A.bay() == "A");
|
||||
assert(TestEnumClass.B.bay() == "B");
|
||||
assert(TestEnumClass.A.constructorParameter == "aConstructorParameter");
|
||||
assert(TestEnumClass.B.constructorParameter == "bConstructorParameter");
|
||||
assert(TestEnumClass.valueOf("A") === TestEnumClass.A);
|
||||
assert(TestEnumClass.valueOf("B") === TestEnumClass.B);
|
||||
assert(TestEnumClass.values().indexOf(TestEnumClass.A) != -1);
|
||||
assert(TestEnumClass.values().indexOf(TestEnumClass.B) != -1);
|
||||
assert(TestEnumClass.A.name === "A");
|
||||
assert(TestEnumClass.B.name === "B");
|
||||
assert(TestEnumClass.A.ordinal === 0);
|
||||
assert(TestEnumClass.B.ordinal === 1);
|
||||
assert(new TestEnumClass.Nested().prop == "hello2");
|
||||
assert(OuterClass.NestedEnum.valueOf("A") === OuterClass.NestedEnum.A);
|
||||
assert(OuterClass.NestedEnum.valueOf("B") === OuterClass.NestedEnum.B);
|
||||
assert(OuterClass.NestedEnum.values().indexOf(OuterClass.NestedEnum.A) != -1);
|
||||
assert(OuterClass.NestedEnum.values().indexOf(OuterClass.NestedEnum.B) != -1);
|
||||
assert(OuterClass.NestedEnum.A.name === "A");
|
||||
assert(OuterClass.NestedEnum.B.name === "B");
|
||||
assert(OuterClass.NestedEnum.A.ordinal === 0);
|
||||
assert(OuterClass.NestedEnum.B.ordinal === 1);
|
||||
return "OK";
|
||||
}
|
||||
Vendored
+45
@@ -0,0 +1,45 @@
|
||||
import TestEnumClass = JS_TESTS.foo.TestEnumClass;
|
||||
import OuterClass = JS_TESTS.foo.OuterClass;
|
||||
|
||||
function assert(condition: boolean) {
|
||||
if (!condition) {
|
||||
throw "Assertion failed";
|
||||
}
|
||||
}
|
||||
|
||||
function box(): string {
|
||||
assert(TestEnumClass.A.foo == 0)
|
||||
assert(TestEnumClass.B.foo == 1)
|
||||
assert(TestEnumClass.A.bar("aBar") == "aBar")
|
||||
assert(TestEnumClass.B.bar("bBar") == "bBar")
|
||||
assert(TestEnumClass.A.bay() == "A")
|
||||
assert(TestEnumClass.B.bay() == "B")
|
||||
assert(TestEnumClass.A.constructorParameter == "aConstructorParameter")
|
||||
assert(TestEnumClass.B.constructorParameter == "bConstructorParameter")
|
||||
|
||||
assert(TestEnumClass.valueOf("A") === TestEnumClass.A)
|
||||
assert(TestEnumClass.valueOf("B") === TestEnumClass.B)
|
||||
|
||||
assert(TestEnumClass.values().indexOf(TestEnumClass.A) != -1)
|
||||
assert(TestEnumClass.values().indexOf(TestEnumClass.B) != -1)
|
||||
|
||||
assert(TestEnumClass.A.name === "A")
|
||||
assert(TestEnumClass.B.name === "B")
|
||||
assert(TestEnumClass.A.ordinal === 0)
|
||||
assert(TestEnumClass.B.ordinal === 1)
|
||||
|
||||
assert(new TestEnumClass.Nested().prop == "hello2")
|
||||
|
||||
assert(OuterClass.NestedEnum.valueOf("A") === OuterClass.NestedEnum.A)
|
||||
assert(OuterClass.NestedEnum.valueOf("B") === OuterClass.NestedEnum.B)
|
||||
|
||||
assert(OuterClass.NestedEnum.values().indexOf(OuterClass.NestedEnum.A) != -1)
|
||||
assert(OuterClass.NestedEnum.values().indexOf(OuterClass.NestedEnum.B) != -1)
|
||||
|
||||
assert(OuterClass.NestedEnum.A.name === "A")
|
||||
assert(OuterClass.NestedEnum.B.name === "B")
|
||||
assert(OuterClass.NestedEnum.A.ordinal === 0)
|
||||
assert(OuterClass.NestedEnum.B.ordinal === 1)
|
||||
|
||||
return "OK";
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"include": [ "./*" ],
|
||||
"extends": "../common.tsconfig.json"
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
declare namespace JS_TESTS {
|
||||
type Nullable<T> = T | null | undefined
|
||||
namespace foo {
|
||||
|
||||
|
||||
|
||||
function invalid_args_name_sum(first_value: number, second_value: number): number;
|
||||
|
||||
class A1 {
|
||||
constructor(first_value: number, second_value: number);
|
||||
get "first value"(): number;
|
||||
get "second.value"(): number;
|
||||
set "second.value"(value: number);
|
||||
}
|
||||
class A2 {
|
||||
constructor();
|
||||
get "invalid:name"(): number;
|
||||
set "invalid:name"(value: number);
|
||||
}
|
||||
class A3 {
|
||||
constructor();
|
||||
"invalid@name sum"(x: number, y: number): number;
|
||||
invalid_args_name_sum(first_value: number, second_value: number): number;
|
||||
}
|
||||
class A4 {
|
||||
constructor();
|
||||
static get Companion(): {
|
||||
get "@invalid+name@"(): number;
|
||||
set "@invalid+name@"(value: number);
|
||||
"^)run.something.weird^("(): string;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
+58
@@ -0,0 +1,58 @@
|
||||
/** This file is generated by {@link :js:js.test:generateJsExportOnFileTestFilesForTS} task. DO NOT MODIFY MANUALLY */
|
||||
|
||||
// CHECK_TYPESCRIPT_DECLARATIONS
|
||||
// RUN_PLAIN_BOX_FUNCTION
|
||||
// SKIP_MINIFICATION
|
||||
// SKIP_NODE_JS
|
||||
// IGNORE_BACKEND: JS
|
||||
// !LANGUAGE: +JsAllowInvalidCharsIdentifiersEscaping
|
||||
// INFER_MAIN_MODULE
|
||||
// MODULE: JS_TESTS
|
||||
// FILE: escaped-interfaces.kt
|
||||
|
||||
@file:JsExport
|
||||
|
||||
|
||||
package foo
|
||||
|
||||
|
||||
fun `invalid@name sum`(x: Int, y: Int): Int =
|
||||
x + y
|
||||
|
||||
|
||||
fun invalid_args_name_sum(`first value`: Int, `second value`: Int): Int =
|
||||
`first value` + `second value`
|
||||
|
||||
// Properties
|
||||
|
||||
|
||||
val `invalid name val`: Int = 1
|
||||
|
||||
var `invalid@name var`: Int = 1
|
||||
|
||||
// Classes
|
||||
|
||||
|
||||
class `Invalid A`
|
||||
|
||||
class A1(val `first value`: Int, var `second.value`: Int)
|
||||
|
||||
class A2 {
|
||||
var `invalid:name`: Int = 42
|
||||
}
|
||||
|
||||
class A3 {
|
||||
fun `invalid@name sum`(x: Int, y: Int): Int =
|
||||
x + y
|
||||
|
||||
fun invalid_args_name_sum(`first value`: Int, `second value`: Int): Int =
|
||||
`first value` + `second value`
|
||||
}
|
||||
|
||||
|
||||
class A4 {
|
||||
companion object {
|
||||
var `@invalid+name@` = 23
|
||||
fun `^)run.something.weird^(`(): String = ")_("
|
||||
}
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
"use strict";
|
||||
var foo = JS_TESTS.foo;
|
||||
var A1 = JS_TESTS.foo.A1;
|
||||
var A2 = JS_TESTS.foo.A2;
|
||||
var A3 = JS_TESTS.foo.A3;
|
||||
var A4 = JS_TESTS.foo.A4;
|
||||
function assert(condition) {
|
||||
if (!condition) {
|
||||
throw "Assertion failed";
|
||||
}
|
||||
}
|
||||
function box() {
|
||||
assert(foo.invalid_args_name_sum(10, 20) === 30);
|
||||
assert(foo["invalid@name sum"](10, 20) === 30);
|
||||
assert(foo["invalid name val"] === 1);
|
||||
assert(foo["invalid@name var"] === 1);
|
||||
foo["invalid@name var"] = 4;
|
||||
assert(foo["invalid@name var"] === 4);
|
||||
new foo["Invalid A"]();
|
||||
assert(new A1(10, 20)["first value"] === 10);
|
||||
assert(new A1(10, 20)["second.value"] === 20);
|
||||
assert(new A2()["invalid:name"] === 42);
|
||||
var a3 = new A3();
|
||||
assert(a3.invalid_args_name_sum(10, 20) === 30);
|
||||
assert(a3["invalid@name sum"](10, 20) === 30);
|
||||
assert(A4.Companion["@invalid+name@"] == 23);
|
||||
assert(A4.Companion["^)run.something.weird^("]() === ")_(");
|
||||
return "OK";
|
||||
}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
import foo = JS_TESTS.foo;
|
||||
import A1 = JS_TESTS.foo.A1;
|
||||
import A2 = JS_TESTS.foo.A2;
|
||||
import A3 = JS_TESTS.foo.A3;
|
||||
import A4 = JS_TESTS.foo.A4;
|
||||
|
||||
function assert(condition: boolean) {
|
||||
if (!condition) {
|
||||
throw "Assertion failed";
|
||||
}
|
||||
}
|
||||
|
||||
function box(): string {
|
||||
assert(foo.invalid_args_name_sum(10, 20) === 30);
|
||||
assert((foo as any)["invalid@name sum"](10, 20) === 30);
|
||||
|
||||
assert((foo as any)["invalid name val"] === 1);
|
||||
assert((foo as any)["invalid@name var"] === 1);
|
||||
(foo as any)["invalid@name var"] = 4
|
||||
assert((foo as any)["invalid@name var"] === 4);
|
||||
|
||||
new (foo as any)["Invalid A"]();
|
||||
|
||||
assert(new A1(10, 20)["first value"] === 10);
|
||||
assert(new A1(10, 20)["second.value"] === 20);
|
||||
|
||||
assert(new A2()["invalid:name"] === 42);
|
||||
|
||||
const a3 = new A3()
|
||||
assert(a3.invalid_args_name_sum(10, 20) === 30);
|
||||
assert(a3["invalid@name sum"](10, 20) === 30);
|
||||
|
||||
assert(A4.Companion["@invalid+name@"] == 23);
|
||||
assert(A4.Companion["^)run.something.weird^("]() === ")_(");
|
||||
|
||||
return "OK";
|
||||
}
|
||||
Vendored
+4
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"include": [ "./*" ],
|
||||
"extends": "../common.tsconfig.json"
|
||||
}
|
||||
+9
-1
@@ -8,28 +8,35 @@
|
||||
// MODULE: JS_TESTS
|
||||
// FILE: escaped-interfaces.kt
|
||||
|
||||
@file:JsExport
|
||||
|
||||
package foo
|
||||
|
||||
@JsExport
|
||||
fun `invalid@name sum`(x: Int, y: Int): Int =
|
||||
x + y
|
||||
|
||||
@JsExport
|
||||
fun invalid_args_name_sum(`first value`: Int, `second value`: Int): Int =
|
||||
`first value` + `second value`
|
||||
|
||||
// Properties
|
||||
|
||||
@JsExport
|
||||
val `invalid name val`: Int = 1
|
||||
@JsExport
|
||||
var `invalid@name var`: Int = 1
|
||||
|
||||
// Classes
|
||||
|
||||
@JsExport
|
||||
class `Invalid A`
|
||||
@JsExport
|
||||
class A1(val `first value`: Int, var `second.value`: Int)
|
||||
@JsExport
|
||||
class A2 {
|
||||
var `invalid:name`: Int = 42
|
||||
}
|
||||
@JsExport
|
||||
class A3 {
|
||||
fun `invalid@name sum`(x: Int, y: Int): Int =
|
||||
x + y
|
||||
@@ -38,6 +45,7 @@ class A3 {
|
||||
`first value` + `second value`
|
||||
}
|
||||
|
||||
@JsExport
|
||||
class A4 {
|
||||
companion object {
|
||||
var `@invalid+name@` = 23
|
||||
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
declare namespace JS_TESTS {
|
||||
type Nullable<T> = T | null | undefined
|
||||
namespace foo {
|
||||
interface SomeExternalInterface {
|
||||
}
|
||||
}
|
||||
namespace foo {
|
||||
function sum(x: number, y: number): number;
|
||||
function varargInt(x: Int32Array): number;
|
||||
function varargNullableInt(x: Array<Nullable<number>>): number;
|
||||
function varargWithOtherParameters(x: string, y: Array<string>, z: string): number;
|
||||
function varargWithComplexType(x: Array<(p0: Array<Int32Array>) => Array<Int32Array>>): number;
|
||||
function sumNullable(x: Nullable<number>, y: Nullable<number>): number;
|
||||
function defaultParameters(a: string, x?: number, y?: string): string;
|
||||
function generic1<T>(x: T): T;
|
||||
function generic2<T>(x: Nullable<T>): boolean;
|
||||
function genericWithConstraint<T extends string>(x: T): T;
|
||||
function genericWithMultipleConstraints<T extends unknown/* kotlin.Comparable<T> */ & foo.SomeExternalInterface & Error>(x: T): T;
|
||||
function generic3<A, B, C, D, E>(a: A, b: B, c: C, d: D): Nullable<E>;
|
||||
function inlineFun(x: number, callback: (p0: number) => void): void;
|
||||
}
|
||||
}
|
||||
+67
@@ -0,0 +1,67 @@
|
||||
/** This file is generated by {@link :js:js.test:generateJsExportOnFileTestFilesForTS} task. DO NOT MODIFY MANUALLY */
|
||||
|
||||
// CHECK_TYPESCRIPT_DECLARATIONS
|
||||
// RUN_PLAIN_BOX_FUNCTION
|
||||
// SKIP_MINIFICATION
|
||||
// SKIP_NODE_JS
|
||||
// INFER_MAIN_MODULE
|
||||
// MODULE: JS_TESTS
|
||||
// FILE: functions.kt
|
||||
|
||||
@file:JsExport
|
||||
|
||||
package foo
|
||||
|
||||
|
||||
external interface SomeExternalInterface
|
||||
|
||||
|
||||
fun sum(x: Int, y: Int): Int =
|
||||
x + y
|
||||
|
||||
|
||||
fun varargInt(vararg x: Int): Int =
|
||||
x.size
|
||||
|
||||
|
||||
fun varargNullableInt(vararg x: Int?): Int =
|
||||
x.size
|
||||
|
||||
|
||||
fun varargWithOtherParameters(x: String, vararg y: String, z: String): Int =
|
||||
x.length + y.size + z.length
|
||||
|
||||
|
||||
fun varargWithComplexType(vararg x: (Array<IntArray>) -> Array<IntArray>): Int =
|
||||
x.size
|
||||
|
||||
|
||||
fun sumNullable(x: Int?, y: Int?): Int =
|
||||
(x ?: 0) + (y ?: 0)
|
||||
|
||||
|
||||
fun defaultParameters(a: String, x: Int = 10, y: String = "OK"): String =
|
||||
a + x.toString() + y
|
||||
|
||||
|
||||
fun <T> generic1(x: T): T = x
|
||||
|
||||
|
||||
fun <T> generic2(x: T?): Boolean = (x == null)
|
||||
|
||||
|
||||
fun <T: String> genericWithConstraint(x: T): T = x
|
||||
|
||||
|
||||
fun <T> genericWithMultipleConstraints(x: T): T
|
||||
where T : Comparable<T>,
|
||||
T : SomeExternalInterface,
|
||||
T : Throwable = x
|
||||
|
||||
|
||||
fun <A, B, C, D, E> generic3(a: A, b: B, c: C, d: D): E? = null
|
||||
|
||||
|
||||
inline fun inlineFun(x: Int, callback: (Int) -> Unit) {
|
||||
callback(x)
|
||||
}
|
||||
+59
@@ -0,0 +1,59 @@
|
||||
"use strict";
|
||||
var __assign = (this && this.__assign) || function () {
|
||||
__assign = Object.assign || function(t) {
|
||||
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
||||
s = arguments[i];
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
||||
t[p] = s[p];
|
||||
}
|
||||
return t;
|
||||
};
|
||||
return __assign.apply(this, arguments);
|
||||
};
|
||||
var sum = JS_TESTS.foo.sum;
|
||||
var generic1 = JS_TESTS.foo.generic1;
|
||||
var generic2 = JS_TESTS.foo.generic2;
|
||||
var generic3 = JS_TESTS.foo.generic3;
|
||||
var inlineFun = JS_TESTS.foo.inlineFun;
|
||||
var varargInt = JS_TESTS.foo.varargInt;
|
||||
var sumNullable = JS_TESTS.foo.sumNullable;
|
||||
var defaultParameters = JS_TESTS.foo.defaultParameters;
|
||||
var varargNullableInt = JS_TESTS.foo.varargNullableInt;
|
||||
var varargWithOtherParameters = JS_TESTS.foo.varargWithOtherParameters;
|
||||
var varargWithComplexType = JS_TESTS.foo.varargWithComplexType;
|
||||
var genericWithConstraint = JS_TESTS.foo.genericWithConstraint;
|
||||
var genericWithMultipleConstraints = JS_TESTS.foo.genericWithMultipleConstraints;
|
||||
function assert(condition) {
|
||||
if (!condition) {
|
||||
throw "Assertion failed";
|
||||
}
|
||||
}
|
||||
function box() {
|
||||
assert(sum(10, 20) === 30);
|
||||
assert(varargInt(new Int32Array([1, 2, 3])) === 3);
|
||||
assert(varargNullableInt([10, 20, 30, null, undefined, 40]) === 6);
|
||||
assert(varargWithOtherParameters("1234", ["1", "2", "3"], "12") === 9);
|
||||
assert(varargWithComplexType([]) === 0);
|
||||
assert(varargWithComplexType([
|
||||
function (x) { return x; },
|
||||
function () { return [new Int32Array([1, 2, 3])]; },
|
||||
function () { return []; },
|
||||
]) === 3);
|
||||
assert(sumNullable(10, null) === 10);
|
||||
assert(sumNullable(undefined, 20) === 20);
|
||||
assert(sumNullable(1, 2) === 3);
|
||||
assert(defaultParameters("", 20, "OK") === "20OK");
|
||||
assert(generic1("FOO") === "FOO");
|
||||
assert(generic1({ x: 10 }).x === 10);
|
||||
assert(generic2(null));
|
||||
assert(generic2(undefined));
|
||||
assert(!generic2(10));
|
||||
assert(generic3(10, true, "__", {}) === null);
|
||||
assert(genericWithConstraint("Test") === "Test");
|
||||
var regExpMatchError = __assign(__assign({}, new Error("Test")), "test test".match(/tes/g));
|
||||
assert(genericWithMultipleConstraints(regExpMatchError) === regExpMatchError);
|
||||
var result = 0;
|
||||
inlineFun(10, function (x) { result = x; });
|
||||
assert(result === 10);
|
||||
return "OK";
|
||||
}
|
||||
+58
@@ -0,0 +1,58 @@
|
||||
import sum = JS_TESTS.foo.sum;
|
||||
import generic1 = JS_TESTS.foo.generic1;
|
||||
import generic2 = JS_TESTS.foo.generic2;
|
||||
import generic3 = JS_TESTS.foo.generic3;
|
||||
import inlineFun = JS_TESTS.foo.inlineFun;
|
||||
import varargInt = JS_TESTS.foo.varargInt;
|
||||
import sumNullable = JS_TESTS.foo.sumNullable;
|
||||
import defaultParameters = JS_TESTS.foo.defaultParameters;
|
||||
import varargNullableInt = JS_TESTS.foo.varargNullableInt;
|
||||
import varargWithOtherParameters = JS_TESTS.foo.varargWithOtherParameters;
|
||||
import varargWithComplexType = JS_TESTS.foo.varargWithComplexType;
|
||||
import genericWithConstraint = JS_TESTS.foo.genericWithConstraint;
|
||||
import genericWithMultipleConstraints = JS_TESTS.foo.genericWithMultipleConstraints;
|
||||
|
||||
function assert(condition: boolean) {
|
||||
if (!condition) {
|
||||
throw "Assertion failed";
|
||||
}
|
||||
}
|
||||
|
||||
function box(): string {
|
||||
assert(sum(10, 20) === 30);
|
||||
|
||||
assert(varargInt(new Int32Array([1, 2, 3])) === 3);
|
||||
assert(varargNullableInt([10, 20, 30, null, undefined, 40]) === 6);
|
||||
assert(varargWithOtherParameters("1234", ["1", "2", "3"], "12") === 9);
|
||||
assert(varargWithComplexType([]) === 0);
|
||||
assert(varargWithComplexType([
|
||||
x => x,
|
||||
() => [new Int32Array([1, 2, 3])],
|
||||
() => [],
|
||||
]) === 3);
|
||||
|
||||
assert(sumNullable(10, null) === 10);
|
||||
assert(sumNullable(undefined, 20) === 20);
|
||||
assert(sumNullable(1, 2) === 3);
|
||||
|
||||
assert(defaultParameters("", 20, "OK") === "20OK");
|
||||
|
||||
assert(generic1<string>("FOO") === "FOO");
|
||||
assert(generic1({x: 10}).x === 10);
|
||||
assert(generic2(null));
|
||||
assert(generic2(undefined));
|
||||
assert(!generic2(10));
|
||||
assert(generic3(10, true, "__", {}) === null);
|
||||
|
||||
assert(genericWithConstraint("Test") === "Test")
|
||||
|
||||
const regExpMatchError: any = { ...new Error("Test"), ..."test test".match(/tes/g) }
|
||||
assert(genericWithMultipleConstraints(regExpMatchError) === regExpMatchError)
|
||||
|
||||
|
||||
let result: number = 0;
|
||||
inlineFun(10, x => { result = x; });
|
||||
assert(result === 10);
|
||||
|
||||
return "OK";
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"include": [ "./*" ],
|
||||
"extends": "../common.tsconfig.json"
|
||||
}
|
||||
@@ -1,5 +1,9 @@
|
||||
declare namespace JS_TESTS {
|
||||
type Nullable<T> = T | null | undefined
|
||||
namespace foo {
|
||||
interface SomeExternalInterface {
|
||||
}
|
||||
}
|
||||
namespace foo {
|
||||
function sum(x: number, y: number): number;
|
||||
function varargInt(x: Int32Array): number;
|
||||
@@ -11,7 +15,7 @@ declare namespace JS_TESTS {
|
||||
function generic1<T>(x: T): T;
|
||||
function generic2<T>(x: Nullable<T>): boolean;
|
||||
function genericWithConstraint<T extends string>(x: T): T;
|
||||
function genericWithMultipleConstraints<T extends unknown/* kotlin.Comparable<T> */ & RegExpMatchArray & Error>(x: T): T;
|
||||
function genericWithMultipleConstraints<T extends unknown/* kotlin.Comparable<T> */ & foo.SomeExternalInterface & Error>(x: T): T;
|
||||
function generic3<A, B, C, D, E>(a: A, b: B, c: C, d: D): Nullable<E>;
|
||||
function inlineFun(x: number, callback: (p0: number) => void): void;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,8 @@
|
||||
|
||||
package foo
|
||||
|
||||
external interface RegExpMatchArray
|
||||
@JsExport
|
||||
external interface SomeExternalInterface
|
||||
|
||||
@JsExport
|
||||
fun sum(x: Int, y: Int): Int =
|
||||
@@ -50,7 +51,7 @@ fun <T: String> genericWithConstraint(x: T): T = x
|
||||
@JsExport
|
||||
fun <T> genericWithMultipleConstraints(x: T): T
|
||||
where T : Comparable<T>,
|
||||
T : RegExpMatchArray,
|
||||
T : SomeExternalInterface,
|
||||
T : Throwable = x
|
||||
|
||||
@JsExport
|
||||
|
||||
Vendored
+30
@@ -0,0 +1,30 @@
|
||||
declare namespace JS_TESTS {
|
||||
type Nullable<T> = T | null | undefined
|
||||
namespace foo {
|
||||
class TestInner {
|
||||
constructor(a: string);
|
||||
get a(): string;
|
||||
get Inner(): {
|
||||
new(a: string): TestInner.Inner;
|
||||
} & typeof TestInner.Inner;
|
||||
}
|
||||
namespace TestInner {
|
||||
class Inner {
|
||||
protected constructor($outer: foo.TestInner, a: string);
|
||||
get a(): string;
|
||||
get concat(): string;
|
||||
static fromNumber(a: number): foo.TestInner.Inner;
|
||||
get SecondLayerInner(): {
|
||||
new(a: string): TestInner.Inner.SecondLayerInner;
|
||||
} & typeof TestInner.Inner.SecondLayerInner;
|
||||
}
|
||||
namespace Inner {
|
||||
class SecondLayerInner {
|
||||
protected constructor($outer: foo.TestInner.Inner, a: string);
|
||||
get a(): string;
|
||||
get concat(): string;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
/** This file is generated by {@link :js:js.test:generateJsExportOnFileTestFilesForTS} task. DO NOT MODIFY MANUALLY */
|
||||
|
||||
// CHECK_TYPESCRIPT_DECLARATIONS
|
||||
// RUN_PLAIN_BOX_FUNCTION
|
||||
// SKIP_MINIFICATION
|
||||
// SKIP_NODE_JS
|
||||
// IGNORE_BACKEND: JS
|
||||
// INFER_MAIN_MODULE
|
||||
// MODULE: JS_TESTS
|
||||
// FILE: inner-class.kt
|
||||
|
||||
@file:JsExport
|
||||
|
||||
package foo
|
||||
|
||||
|
||||
class TestInner(val a: String) {
|
||||
inner class Inner(val a: String) {
|
||||
val concat: String = this@TestInner.a + this.a
|
||||
|
||||
@JsName("fromNumber")
|
||||
constructor(a: Int): this(a.toString())
|
||||
|
||||
@JsName("SecondLayerInner")
|
||||
inner class InnerInner(val a: String) {
|
||||
val concat: String = this@TestInner.a + this@Inner.a + this.a
|
||||
}
|
||||
}
|
||||
}
|
||||
Vendored
+24
@@ -0,0 +1,24 @@
|
||||
"use strict";
|
||||
var TestInner = JS_TESTS.foo.TestInner;
|
||||
function assert(condition) {
|
||||
if (!condition) {
|
||||
throw "Assertion failed";
|
||||
}
|
||||
}
|
||||
function box() {
|
||||
var outer = new TestInner("Hello ");
|
||||
var inner = new outer.Inner("World");
|
||||
var innerFromNumber = outer.Inner.fromNumber(1654);
|
||||
var secondInner = new inner.SecondLayerInner("!");
|
||||
assert(outer instanceof TestInner);
|
||||
assert(inner instanceof TestInner.Inner);
|
||||
assert(innerFromNumber instanceof TestInner.Inner);
|
||||
assert(secondInner instanceof TestInner.Inner.SecondLayerInner);
|
||||
assert(inner.a == "World");
|
||||
assert(inner.concat == "Hello World");
|
||||
assert(innerFromNumber.a == "1654");
|
||||
assert(innerFromNumber.concat == "Hello 1654");
|
||||
assert(secondInner.a == "!");
|
||||
assert(secondInner.concat == "Hello World!");
|
||||
return "OK";
|
||||
}
|
||||
Vendored
+30
@@ -0,0 +1,30 @@
|
||||
import TestInner = JS_TESTS.foo.TestInner;
|
||||
|
||||
function assert(condition: boolean) {
|
||||
if (!condition) {
|
||||
throw "Assertion failed";
|
||||
}
|
||||
}
|
||||
|
||||
function box(): string {
|
||||
const outer = new TestInner("Hello ")
|
||||
const inner = new outer.Inner("World")
|
||||
const innerFromNumber = outer.Inner.fromNumber(1654)
|
||||
const secondInner = new inner.SecondLayerInner("!")
|
||||
|
||||
assert(outer instanceof TestInner)
|
||||
assert(inner instanceof TestInner.Inner)
|
||||
assert(innerFromNumber instanceof TestInner.Inner)
|
||||
assert(secondInner instanceof TestInner.Inner.SecondLayerInner)
|
||||
|
||||
assert(inner.a == "World")
|
||||
assert(inner.concat == "Hello World")
|
||||
|
||||
assert(innerFromNumber.a == "1654")
|
||||
assert(innerFromNumber.concat == "Hello 1654")
|
||||
|
||||
assert(secondInner.a == "!")
|
||||
assert(secondInner.concat == "Hello World!")
|
||||
|
||||
return "OK";
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"include": [ "./*" ],
|
||||
"extends": "../common.tsconfig.json"
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
declare namespace JS_TESTS {
|
||||
type Nullable<T> = T | null | undefined
|
||||
namespace foo {
|
||||
interface TestInterface {
|
||||
readonly value: string;
|
||||
getOwnerName(): string;
|
||||
readonly __doNotUseOrImplementIt: {
|
||||
readonly "foo.TestInterface": unique symbol;
|
||||
};
|
||||
}
|
||||
interface AnotherExportedInterface {
|
||||
readonly __doNotUseOrImplementIt: {
|
||||
readonly "foo.AnotherExportedInterface": unique symbol;
|
||||
};
|
||||
}
|
||||
class TestInterfaceImpl implements foo.TestInterface {
|
||||
constructor(value: string);
|
||||
get value(): string;
|
||||
getOwnerName(): string;
|
||||
readonly __doNotUseOrImplementIt: foo.TestInterface["__doNotUseOrImplementIt"];
|
||||
}
|
||||
class ChildTestInterfaceImpl extends foo.TestInterfaceImpl implements foo.AnotherExportedInterface {
|
||||
constructor();
|
||||
readonly __doNotUseOrImplementIt: foo.TestInterfaceImpl["__doNotUseOrImplementIt"] & foo.AnotherExportedInterface["__doNotUseOrImplementIt"];
|
||||
}
|
||||
function processInterface(test: foo.TestInterface): string;
|
||||
}
|
||||
}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
/** This file is generated by {@link :js:js.test:generateJsExportOnFileTestFilesForTS} task. DO NOT MODIFY MANUALLY */
|
||||
|
||||
// CHECK_TYPESCRIPT_DECLARATIONS
|
||||
// RUN_PLAIN_BOX_FUNCTION
|
||||
// SKIP_MINIFICATION
|
||||
// SKIP_NODE_JS
|
||||
// INFER_MAIN_MODULE
|
||||
// MODULE: JS_TESTS
|
||||
// FILE: interfaces.kt
|
||||
|
||||
@file:JsExport
|
||||
|
||||
package foo
|
||||
|
||||
// Classes
|
||||
|
||||
|
||||
interface TestInterface {
|
||||
val value: String
|
||||
fun getOwnerName(): String
|
||||
}
|
||||
|
||||
|
||||
interface AnotherExportedInterface
|
||||
|
||||
|
||||
open class TestInterfaceImpl(override val value: String) : TestInterface {
|
||||
override fun getOwnerName() = "TestInterfaceImpl"
|
||||
}
|
||||
|
||||
|
||||
class ChildTestInterfaceImpl(): TestInterfaceImpl("Test"), AnotherExportedInterface
|
||||
|
||||
|
||||
fun processInterface(test: TestInterface): String {
|
||||
return "Owner ${test.getOwnerName()} has value '${test.value}'"
|
||||
}
|
||||
Vendored
+16
@@ -0,0 +1,16 @@
|
||||
"use strict";
|
||||
var TestInterfaceImpl = JS_TESTS.foo.TestInterfaceImpl;
|
||||
var ChildTestInterfaceImpl = JS_TESTS.foo.ChildTestInterfaceImpl;
|
||||
var processInterface = JS_TESTS.foo.processInterface;
|
||||
function assert(condition) {
|
||||
if (!condition) {
|
||||
throw "Assertion failed";
|
||||
}
|
||||
}
|
||||
function box() {
|
||||
assert(processInterface(new TestInterfaceImpl("bar")) === "Owner TestInterfaceImpl has value 'bar'");
|
||||
assert(processInterface(new ChildTestInterfaceImpl()) === "Owner TestInterfaceImpl has value 'Test'");
|
||||
// @ts-expect-error "Just test that this code will throw compilation error for a user"
|
||||
assert(processInterface({ value: "bar", getOwnerName: function () { return "RandomObject"; } }) === "Owner RandomObject has value 'bar'");
|
||||
return "OK";
|
||||
}
|
||||
Vendored
+19
@@ -0,0 +1,19 @@
|
||||
import TestInterfaceImpl = JS_TESTS.foo.TestInterfaceImpl;
|
||||
import ChildTestInterfaceImpl = JS_TESTS.foo.ChildTestInterfaceImpl;
|
||||
import processInterface = JS_TESTS.foo.processInterface;
|
||||
|
||||
function assert(condition: boolean) {
|
||||
if (!condition) {
|
||||
throw "Assertion failed";
|
||||
}
|
||||
}
|
||||
|
||||
function box(): string {
|
||||
assert(processInterface(new TestInterfaceImpl("bar")) === "Owner TestInterfaceImpl has value 'bar'")
|
||||
assert(processInterface(new ChildTestInterfaceImpl()) === "Owner TestInterfaceImpl has value 'Test'")
|
||||
|
||||
// @ts-expect-error "Just test that this code will throw compilation error for a user"
|
||||
assert(processInterface({ value: "bar", getOwnerName: () => "RandomObject" }) === "Owner RandomObject has value 'bar'")
|
||||
|
||||
return "OK";
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "../common.tsconfig.json"
|
||||
}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
declare namespace JS_TESTS {
|
||||
type Nullable<T> = T | null | undefined
|
||||
namespace foo {
|
||||
interface Object {
|
||||
readonly constructor: any;
|
||||
}
|
||||
}
|
||||
namespace foo {
|
||||
class JsNameTest {
|
||||
private constructor();
|
||||
get value(): number;
|
||||
runTest(): string;
|
||||
acceptObject(impl: foo.Object): string;
|
||||
static get NotCompanion(): {
|
||||
create(): foo.JsNameTest;
|
||||
createChild(value: number): foo.JsNameTest.NestedJsName;
|
||||
};
|
||||
}
|
||||
namespace JsNameTest {
|
||||
class NestedJsName {
|
||||
constructor(__value: number);
|
||||
get value(): number;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
/** This file is generated by {@link :js:js.test:generateJsExportOnFileTestFilesForTS} task. DO NOT MODIFY MANUALLY */
|
||||
|
||||
// CHECK_TYPESCRIPT_DECLARATIONS
|
||||
// RUN_PLAIN_BOX_FUNCTION
|
||||
// SKIP_MINIFICATION
|
||||
// SKIP_NODE_JS
|
||||
// INFER_MAIN_MODULE
|
||||
// MODULE: JS_TESTS
|
||||
// FILE: js-name.kt
|
||||
|
||||
@file:JsExport
|
||||
|
||||
package foo
|
||||
|
||||
|
||||
@JsName("Object")
|
||||
external interface WeirdInterface {
|
||||
val constructor: dynamic
|
||||
}
|
||||
|
||||
|
||||
@JsName("JsNameTest")
|
||||
class __JsNameTest private constructor() {
|
||||
@JsName("value")
|
||||
val __value = 4
|
||||
|
||||
@JsName("runTest")
|
||||
fun __runTest(): String {
|
||||
return "JsNameTest"
|
||||
}
|
||||
|
||||
@JsName("acceptObject")
|
||||
fun __acceptWeirdImpl(impl: WeirdInterface): String {
|
||||
return impl.constructor.name
|
||||
}
|
||||
|
||||
@JsName("NotCompanion")
|
||||
companion object {
|
||||
@JsName("create")
|
||||
fun __create(): __JsNameTest {
|
||||
return __JsNameTest()
|
||||
}
|
||||
|
||||
@JsName("createChild")
|
||||
fun __createChild(value: Int): __NestJsNameTest {
|
||||
return __NestJsNameTest(value)
|
||||
}
|
||||
}
|
||||
|
||||
@JsName("NestedJsName")
|
||||
class __NestJsNameTest(@JsName("value") val __value: Int)
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
"use strict";
|
||||
var JsNameTest = JS_TESTS.foo.JsNameTest;
|
||||
function assert(condition) {
|
||||
if (!condition) {
|
||||
throw "Assertion failed";
|
||||
}
|
||||
}
|
||||
function box() {
|
||||
var jsNameTest = JsNameTest.NotCompanion.create();
|
||||
assert(jsNameTest.value === 4);
|
||||
assert(jsNameTest.runTest() === "JsNameTest");
|
||||
assert(jsNameTest.acceptObject(Object) === "Function");
|
||||
var jsNameNestedTest = JsNameTest.NotCompanion.createChild(42);
|
||||
assert(jsNameNestedTest.value === 42);
|
||||
return "OK";
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
import JsNameTest = JS_TESTS.foo.JsNameTest;
|
||||
|
||||
function assert(condition: boolean) {
|
||||
if (!condition) {
|
||||
throw "Assertion failed";
|
||||
}
|
||||
}
|
||||
|
||||
function box(): string {
|
||||
const jsNameTest = JsNameTest.NotCompanion.create();
|
||||
|
||||
assert(jsNameTest.value === 4)
|
||||
assert(jsNameTest.runTest() === "JsNameTest")
|
||||
assert(jsNameTest.acceptObject(Object) === "Function")
|
||||
|
||||
const jsNameNestedTest = JsNameTest.NotCompanion.createChild(42);
|
||||
|
||||
assert(jsNameNestedTest.value === 42)
|
||||
|
||||
return "OK";
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "../common.tsconfig.json"
|
||||
}
|
||||
@@ -1,11 +1,16 @@
|
||||
declare namespace JS_TESTS {
|
||||
type Nullable<T> = T | null | undefined
|
||||
namespace foo {
|
||||
interface Object {
|
||||
readonly constructor: any;
|
||||
}
|
||||
}
|
||||
namespace foo {
|
||||
class JsNameTest {
|
||||
private constructor();
|
||||
get value(): number;
|
||||
runTest(): string;
|
||||
acceptObject(impl: Object): string;
|
||||
acceptObject(impl: foo.Object): string;
|
||||
static get NotCompanion(): {
|
||||
create(): foo.JsNameTest;
|
||||
createChild(value: number): foo.JsNameTest.NestedJsName;
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
package foo
|
||||
|
||||
@JsExport
|
||||
@JsName("Object")
|
||||
external interface WeirdInterface {
|
||||
val constructor: dynamic
|
||||
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
declare namespace JS_TESTS {
|
||||
type Nullable<T> = T | null | undefined
|
||||
namespace foo {
|
||||
class Test {
|
||||
constructor();
|
||||
get _val(): number;
|
||||
get _var(): number;
|
||||
set _var(value: number);
|
||||
get _valCustom(): number;
|
||||
get _valCustomWithField(): number;
|
||||
get _varCustom(): number;
|
||||
set _varCustom(value: number);
|
||||
get _varCustomWithField(): number;
|
||||
set _varCustomWithField(value: number);
|
||||
}
|
||||
}
|
||||
}
|
||||
Vendored
+34
@@ -0,0 +1,34 @@
|
||||
/** This file is generated by {@link :js:js.test:generateJsExportOnFileTestFilesForTS} task. DO NOT MODIFY MANUALLY */
|
||||
|
||||
// CHECK_TYPESCRIPT_DECLARATIONS
|
||||
// RUN_PLAIN_BOX_FUNCTION
|
||||
// SKIP_MINIFICATION
|
||||
// SKIP_NODE_JS
|
||||
// INFER_MAIN_MODULE
|
||||
// MODULE: JS_TESTS
|
||||
// FILE: member-properties.kt
|
||||
|
||||
@file:JsExport
|
||||
|
||||
package foo
|
||||
|
||||
|
||||
class Test {
|
||||
val _val: Int = 1
|
||||
|
||||
var _var: Int = 1
|
||||
|
||||
val _valCustom: Int
|
||||
get() = 1
|
||||
|
||||
val _valCustomWithField: Int = 1
|
||||
get() = field + 1
|
||||
|
||||
var _varCustom: Int
|
||||
get() = 1
|
||||
set(value) {}
|
||||
|
||||
var _varCustomWithField: Int = 1
|
||||
get() = field * 10
|
||||
set(value) { field = value * 10 }
|
||||
}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
"use strict";
|
||||
var Test = JS_TESTS.foo.Test;
|
||||
function assert(condition) {
|
||||
if (!condition) {
|
||||
throw "Assertion failed";
|
||||
}
|
||||
}
|
||||
function box() {
|
||||
var test = new Test();
|
||||
assert(test._val === 1);
|
||||
assert(test._var === 1);
|
||||
test._var = 1000;
|
||||
assert(test._var === 1000);
|
||||
assert(test._valCustom === 1);
|
||||
assert(test._valCustomWithField === 2);
|
||||
assert(test._varCustom === 1);
|
||||
test._varCustom = 20;
|
||||
assert(test._varCustom === 1);
|
||||
assert(test._varCustomWithField === 10);
|
||||
test._varCustomWithField = 10;
|
||||
assert(test._varCustomWithField === 1000);
|
||||
return "OK";
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
import Test = JS_TESTS.foo.Test;
|
||||
|
||||
function assert(condition: boolean) {
|
||||
if (!condition) {
|
||||
throw "Assertion failed";
|
||||
}
|
||||
}
|
||||
|
||||
function box(): string {
|
||||
const test = new Test()
|
||||
assert(test._val === 1);
|
||||
assert(test._var === 1);
|
||||
test._var = 1000;
|
||||
assert(test._var === 1000);
|
||||
|
||||
assert(test._valCustom === 1);
|
||||
assert(test._valCustomWithField === 2);
|
||||
assert(test._varCustom === 1);
|
||||
test._varCustom = 20;
|
||||
assert(test._varCustom === 1);
|
||||
assert(test._varCustomWithField === 10);
|
||||
test._varCustomWithField = 10;
|
||||
assert(test._varCustomWithField === 1000);
|
||||
|
||||
|
||||
return "OK";
|
||||
}
|
||||
Vendored
+4
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"include": [ "./*" ],
|
||||
"extends": "../common.tsconfig.json"
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
declare namespace JS_TESTS {
|
||||
type Nullable<T> = T | null | undefined
|
||||
namespace foo {
|
||||
interface SomeExternalInterface {
|
||||
}
|
||||
}
|
||||
namespace foo {
|
||||
class Test {
|
||||
constructor();
|
||||
sum(x: number, y: number): number;
|
||||
varargInt(x: Int32Array): number;
|
||||
varargNullableInt(x: Array<Nullable<number>>): number;
|
||||
varargWithOtherParameters(x: string, y: Array<string>, z: string): number;
|
||||
varargWithComplexType(x: Array<(p0: Array<Int32Array>) => Array<Int32Array>>): number;
|
||||
sumNullable(x: Nullable<number>, y: Nullable<number>): number;
|
||||
defaultParameters(a: string, x?: number, y?: string): string;
|
||||
generic1<T>(x: T): T;
|
||||
generic2<T>(x: Nullable<T>): boolean;
|
||||
genericWithConstraint<T extends string>(x: T): T;
|
||||
genericWithMultipleConstraints<T extends unknown/* kotlin.Comparable<T> */ & foo.SomeExternalInterface & Error>(x: T): T;
|
||||
generic3<A, B, C, D, E>(a: A, b: B, c: C, d: D): Nullable<E>;
|
||||
inlineFun(x: number, callback: (p0: number) => void): void;
|
||||
}
|
||||
}
|
||||
}
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
/** This file is generated by {@link :js:js.test:generateJsExportOnFileTestFilesForTS} task. DO NOT MODIFY MANUALLY */
|
||||
|
||||
// CHECK_TYPESCRIPT_DECLARATIONS
|
||||
// RUN_PLAIN_BOX_FUNCTION
|
||||
// SKIP_MINIFICATION
|
||||
// SKIP_NODE_JS
|
||||
// INFER_MAIN_MODULE
|
||||
// MODULE: JS_TESTS
|
||||
// FILE: member-properties.kt
|
||||
|
||||
@file:JsExport
|
||||
|
||||
package foo
|
||||
|
||||
|
||||
external interface SomeExternalInterface
|
||||
|
||||
|
||||
class Test {
|
||||
fun sum(x: Int, y: Int): Int =
|
||||
x + y
|
||||
|
||||
fun varargInt(vararg x: Int): Int =
|
||||
x.size
|
||||
|
||||
fun varargNullableInt(vararg x: Int?): Int =
|
||||
x.size
|
||||
|
||||
fun varargWithOtherParameters(x: String, vararg y: String, z: String): Int =
|
||||
x.length + y.size + z.length
|
||||
|
||||
fun varargWithComplexType(vararg x: (Array<IntArray>) -> Array<IntArray>): Int =
|
||||
x.size
|
||||
|
||||
fun sumNullable(x: Int?, y: Int?): Int =
|
||||
(x ?: 0) + (y ?: 0)
|
||||
|
||||
fun defaultParameters(a: String, x: Int = 10, y: String = "OK"): String =
|
||||
a + x.toString() + y
|
||||
|
||||
fun <T> generic1(x: T): T = x
|
||||
|
||||
fun <T> generic2(x: T?): Boolean = (x == null)
|
||||
|
||||
fun <T : String> genericWithConstraint(x: T): T = x
|
||||
|
||||
fun <T> genericWithMultipleConstraints(x: T): T
|
||||
where T : Comparable<T>,
|
||||
T : SomeExternalInterface,
|
||||
T : Throwable = x
|
||||
|
||||
fun <A, B, C, D, E> generic3(a: A, b: B, c: C, d: D): E? = null
|
||||
|
||||
inline fun inlineFun(x: Int, callback: (Int) -> Unit) {
|
||||
callback(x)
|
||||
}
|
||||
}
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
"use strict";
|
||||
var __assign = (this && this.__assign) || function () {
|
||||
__assign = Object.assign || function(t) {
|
||||
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
||||
s = arguments[i];
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
||||
t[p] = s[p];
|
||||
}
|
||||
return t;
|
||||
};
|
||||
return __assign.apply(this, arguments);
|
||||
};
|
||||
var Test = JS_TESTS.foo.Test;
|
||||
function assert(condition) {
|
||||
if (!condition) {
|
||||
throw "Assertion failed";
|
||||
}
|
||||
}
|
||||
function box() {
|
||||
var test = new Test();
|
||||
assert(test.sum(10, 20) === 30);
|
||||
assert(test.varargInt(new Int32Array([1, 2, 3])) === 3);
|
||||
assert(test.varargNullableInt([10, 20, 30, null, undefined, 40]) === 6);
|
||||
assert(test.varargWithOtherParameters("1234", ["1", "2", "3"], "12") === 9);
|
||||
assert(test.varargWithComplexType([]) === 0);
|
||||
assert(test.varargWithComplexType([
|
||||
function (x) { return x; },
|
||||
function (x) { return [new Int32Array([1, 2, 3])]; },
|
||||
function (x) { return []; },
|
||||
]) === 3);
|
||||
assert(test.sumNullable(10, null) === 10);
|
||||
assert(test.sumNullable(undefined, 20) === 20);
|
||||
assert(test.sumNullable(1, 2) === 3);
|
||||
assert(test.defaultParameters("", 20, "OK") === "20OK");
|
||||
assert(test.generic1("FOO") === "FOO");
|
||||
assert(test.generic1({ x: 10 }).x === 10);
|
||||
assert(test.generic2(null) === true);
|
||||
assert(test.generic2(undefined) === true);
|
||||
assert(test.generic2(10) === false);
|
||||
assert(test.generic3(10, true, "__", {}) === null);
|
||||
assert(test.genericWithConstraint("Test") === "Test");
|
||||
var regExpMatchError = __assign(__assign({}, new Error("Test")), "test test".match(/tes/g));
|
||||
assert(test.genericWithMultipleConstraints(regExpMatchError) === regExpMatchError);
|
||||
var result = 0;
|
||||
test.inlineFun(10, function (x) { result = x; });
|
||||
assert(result === 10);
|
||||
return "OK";
|
||||
}
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
import Test = JS_TESTS.foo.Test;
|
||||
|
||||
function assert(condition: boolean) {
|
||||
if (!condition) {
|
||||
throw "Assertion failed";
|
||||
}
|
||||
}
|
||||
|
||||
function box(): string {
|
||||
const test = new Test()
|
||||
assert(test.sum(10, 20) === 30);
|
||||
|
||||
assert(test.varargInt(new Int32Array([1, 2, 3])) === 3);
|
||||
assert(test.varargNullableInt([10, 20, 30, null, undefined, 40]) === 6);
|
||||
assert(test.varargWithOtherParameters("1234", ["1", "2", "3"], "12") === 9);
|
||||
assert(test.varargWithComplexType([]) === 0);
|
||||
assert(test.varargWithComplexType([
|
||||
x => x,
|
||||
x => [new Int32Array([1, 2, 3])],
|
||||
x => [],
|
||||
]) === 3);
|
||||
|
||||
assert(test.sumNullable(10, null) === 10);
|
||||
assert(test.sumNullable(undefined, 20) === 20);
|
||||
assert(test.sumNullable(1, 2) === 3);
|
||||
|
||||
assert(test.defaultParameters("", 20, "OK") === "20OK");
|
||||
|
||||
assert(test.generic1<string>("FOO") === "FOO");
|
||||
assert(test.generic1({x: 10}).x === 10);
|
||||
assert(test.generic2(null) === true);
|
||||
assert(test.generic2(undefined) === true);
|
||||
assert(test.generic2(10) === false);
|
||||
assert(test.generic3(10, true, "__", {}) === null);
|
||||
|
||||
assert(test.genericWithConstraint("Test") === "Test")
|
||||
|
||||
const regExpMatchError: any = { ...new Error("Test"), ..."test test".match(/tes/g) }
|
||||
assert(test.genericWithMultipleConstraints(regExpMatchError) === regExpMatchError)
|
||||
|
||||
let result: number = 0;
|
||||
test.inlineFun(10, x => { result = x; });
|
||||
assert(result === 10);
|
||||
|
||||
return "OK";
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"include": [ "./*" ],
|
||||
"extends": "../common.tsconfig.json"
|
||||
}
|
||||
@@ -1,5 +1,9 @@
|
||||
declare namespace JS_TESTS {
|
||||
type Nullable<T> = T | null | undefined
|
||||
namespace foo {
|
||||
interface SomeExternalInterface {
|
||||
}
|
||||
}
|
||||
namespace foo {
|
||||
class Test {
|
||||
constructor();
|
||||
@@ -13,7 +17,7 @@ declare namespace JS_TESTS {
|
||||
generic1<T>(x: T): T;
|
||||
generic2<T>(x: Nullable<T>): boolean;
|
||||
genericWithConstraint<T extends string>(x: T): T;
|
||||
genericWithMultipleConstraints<T extends unknown/* kotlin.Comparable<T> */ & RegExpMatchArray & Error>(x: T): T;
|
||||
genericWithMultipleConstraints<T extends unknown/* kotlin.Comparable<T> */ & foo.SomeExternalInterface & Error>(x: T): T;
|
||||
generic3<A, B, C, D, E>(a: A, b: B, c: C, d: D): Nullable<E>;
|
||||
inlineFun(x: number, callback: (p0: number) => void): void;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,8 @@
|
||||
|
||||
package foo
|
||||
|
||||
external interface RegExpMatchArray
|
||||
@JsExport
|
||||
external interface SomeExternalInterface
|
||||
|
||||
@JsExport
|
||||
class Test {
|
||||
@@ -41,7 +42,7 @@ class Test {
|
||||
|
||||
fun <T> genericWithMultipleConstraints(x: T): T
|
||||
where T : Comparable<T>,
|
||||
T : RegExpMatchArray,
|
||||
T : SomeExternalInterface,
|
||||
T : Throwable = x
|
||||
|
||||
fun <A, B, C, D, E> generic3(a: A, b: B, c: C, d: D): E? = null
|
||||
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
type Nullable<T> = T | null | undefined
|
||||
export namespace foo {
|
||||
const prop: number;
|
||||
class C {
|
||||
constructor(x: number);
|
||||
get x(): number;
|
||||
doubleX(): number;
|
||||
}
|
||||
function box(): string;
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
/** This file is generated by {@link :js:js.test:generateJsExportOnFileTestFilesForTS} task. DO NOT MODIFY MANUALLY */
|
||||
|
||||
// CHECK_TYPESCRIPT_DECLARATIONS
|
||||
// SKIP_MINIFICATION
|
||||
// SKIP_NODE_JS
|
||||
// INFER_MAIN_MODULE
|
||||
// MODULE: JS_TESTS
|
||||
// MODULE_KIND: COMMON_JS
|
||||
// FILE: commonjs.kt
|
||||
|
||||
@file:JsExport
|
||||
|
||||
package foo
|
||||
|
||||
|
||||
val prop = 10
|
||||
|
||||
|
||||
class C(val x: Int) {
|
||||
fun doubleX() = x * 2
|
||||
}
|
||||
|
||||
|
||||
fun box(): String = "OK"
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
declare namespace JS_TESTS {
|
||||
type Nullable<T> = T | null | undefined
|
||||
namespace foo {
|
||||
const prop: number;
|
||||
class C {
|
||||
constructor(x: number);
|
||||
get x(): number;
|
||||
doubleX(): number;
|
||||
}
|
||||
function box(): string;
|
||||
}
|
||||
}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
/** This file is generated by {@link :js:js.test:generateJsExportOnFileTestFilesForTS} task. DO NOT MODIFY MANUALLY */
|
||||
|
||||
// CHECK_TYPESCRIPT_DECLARATIONS
|
||||
// SKIP_MINIFICATION
|
||||
// SKIP_NODE_JS
|
||||
// INFER_MAIN_MODULE
|
||||
// MODULE: JS_TESTS
|
||||
// FILE: plain.kt
|
||||
|
||||
@file:JsExport
|
||||
|
||||
package foo
|
||||
|
||||
|
||||
val prop = 10
|
||||
|
||||
|
||||
class C(val x: Int) {
|
||||
fun doubleX() = x * 2
|
||||
}
|
||||
|
||||
|
||||
fun box(): String = "OK"
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
type Nullable<T> = T | null | undefined
|
||||
export namespace foo {
|
||||
const prop: number;
|
||||
class C {
|
||||
constructor(x: number);
|
||||
get x(): number;
|
||||
doubleX(): number;
|
||||
}
|
||||
function box(): string;
|
||||
}
|
||||
export as namespace JS_TESTS;
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
/** This file is generated by {@link :js:js.test:generateJsExportOnFileTestFilesForTS} task. DO NOT MODIFY MANUALLY */
|
||||
|
||||
// CHECK_TYPESCRIPT_DECLARATIONS
|
||||
// SKIP_MINIFICATION
|
||||
// SKIP_NODE_JS
|
||||
// INFER_MAIN_MODULE
|
||||
// MODULE: JS_TESTS
|
||||
// MODULE_KIND: UMD
|
||||
// FILE: umd.kt
|
||||
|
||||
@file:JsExport
|
||||
|
||||
package foo
|
||||
|
||||
|
||||
val prop = 10
|
||||
|
||||
|
||||
class C(val x: Int) {
|
||||
fun doubleX() = x * 2
|
||||
}
|
||||
|
||||
|
||||
fun box(): String = "OK"
|
||||
@@ -6,14 +6,15 @@
|
||||
// MODULE_KIND: COMMON_JS
|
||||
// FILE: commonjs.kt
|
||||
|
||||
@file:JsExport
|
||||
|
||||
package foo
|
||||
|
||||
@JsExport
|
||||
val prop = 10
|
||||
|
||||
@JsExport
|
||||
class C(val x: Int) {
|
||||
fun doubleX() = x * 2
|
||||
}
|
||||
|
||||
@JsExport
|
||||
fun box(): String = "OK"
|
||||
@@ -5,14 +5,15 @@
|
||||
// MODULE: JS_TESTS
|
||||
// FILE: plain.kt
|
||||
|
||||
@file:JsExport
|
||||
|
||||
package foo
|
||||
|
||||
@JsExport
|
||||
val prop = 10
|
||||
|
||||
@JsExport
|
||||
class C(val x: Int) {
|
||||
fun doubleX() = x * 2
|
||||
}
|
||||
|
||||
@JsExport
|
||||
fun box(): String = "OK"
|
||||
@@ -6,14 +6,15 @@
|
||||
// MODULE_KIND: UMD
|
||||
// FILE: umd.kt
|
||||
|
||||
@file:JsExport
|
||||
|
||||
package foo
|
||||
|
||||
@JsExport
|
||||
val prop = 10
|
||||
|
||||
@JsExport
|
||||
class C(val x: Int) {
|
||||
fun doubleX() = x * 2
|
||||
}
|
||||
|
||||
@JsExport
|
||||
fun box(): String = "OK"
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
declare namespace JS_TESTS {
|
||||
type Nullable<T> = T | null | undefined
|
||||
namespace foo.bar.baz {
|
||||
class C1 {
|
||||
constructor(value: string);
|
||||
get value(): string;
|
||||
component1(): string;
|
||||
copy(value?: string): foo.bar.baz.C1;
|
||||
toString(): string;
|
||||
hashCode(): number;
|
||||
equals(other: Nullable<any>): boolean;
|
||||
}
|
||||
function f(x1: foo.bar.baz.C1, x2: a.b.C2, x3: C3): string;
|
||||
}
|
||||
namespace a.b {
|
||||
class C2 {
|
||||
constructor(value: string);
|
||||
get value(): string;
|
||||
component1(): string;
|
||||
copy(value?: string): a.b.C2;
|
||||
toString(): string;
|
||||
hashCode(): number;
|
||||
equals(other: Nullable<any>): boolean;
|
||||
}
|
||||
function f(x1: foo.bar.baz.C1, x2: a.b.C2, x3: C3): string;
|
||||
}
|
||||
class C3 {
|
||||
constructor(value: string);
|
||||
get value(): string;
|
||||
component1(): string;
|
||||
copy(value?: string): C3;
|
||||
toString(): string;
|
||||
hashCode(): number;
|
||||
equals(other: Nullable<any>): boolean;
|
||||
}
|
||||
function f(x1: foo.bar.baz.C1, x2: a.b.C2, x3: C3): string;
|
||||
}
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
/** This file is generated by {@link :js:js.test:generateJsExportOnFileTestFilesForTS} task. DO NOT MODIFY MANUALLY */
|
||||
|
||||
// CHECK_TYPESCRIPT_DECLARATIONS
|
||||
// RUN_PLAIN_BOX_FUNCTION
|
||||
// SKIP_MINIFICATION
|
||||
// SKIP_NODE_JS
|
||||
// INFER_MAIN_MODULE
|
||||
|
||||
// MODULE: JS_TESTS
|
||||
// FILE: file1.kt
|
||||
|
||||
@file:JsExport
|
||||
|
||||
package foo.bar.baz
|
||||
|
||||
import a.b.*
|
||||
import C3
|
||||
|
||||
|
||||
data class C1(val value: String)
|
||||
|
||||
|
||||
fun f(x1: C1, x2: C2, x3: C3): String {
|
||||
return "foo.bar.baz.f($x1, $x2, $x3)"
|
||||
}
|
||||
|
||||
// FILE: file2.kt
|
||||
|
||||
@file:JsExport
|
||||
|
||||
package a.b
|
||||
|
||||
import foo.bar.baz.*
|
||||
import C3
|
||||
|
||||
|
||||
data class C2(val value: String)
|
||||
|
||||
fun f(x1: C1, x2: C2, x3: C3): String {
|
||||
return "a.b.f($x1, $x2, $x3)"
|
||||
}
|
||||
|
||||
// FILE: file3.kt
|
||||
|
||||
@file:JsExport
|
||||
|
||||
import a.b.*
|
||||
import foo.bar.baz.*
|
||||
|
||||
|
||||
data class C3(val value: String)
|
||||
|
||||
|
||||
fun f(x1: C1, x2: C2, x3: C3): String {
|
||||
return "f($x1, $x2, $x3)"
|
||||
}
|
||||
Vendored
+19
@@ -0,0 +1,19 @@
|
||||
"use strict";
|
||||
var C1 = JS_TESTS.foo.bar.baz.C1;
|
||||
var C2 = JS_TESTS.a.b.C2;
|
||||
var C3 = JS_TESTS.C3;
|
||||
function box() {
|
||||
var c1 = new C1("1");
|
||||
var c2 = new C2("2");
|
||||
var c3 = new C3("3");
|
||||
var res1 = JS_TESTS.foo.bar.baz.f(c1, c2, c3);
|
||||
var res2 = JS_TESTS.a.b.f(c1, c2, c3);
|
||||
var res3 = JS_TESTS.f(c1, c2, c3);
|
||||
if (res1 !== "foo.bar.baz.f(C1(value=1), C2(value=2), C3(value=3))")
|
||||
return "Fail 1: " + res1;
|
||||
if (res2 !== "a.b.f(C1(value=1), C2(value=2), C3(value=3))")
|
||||
return "Fail 2: " + res2;
|
||||
if (res3 !== "f(C1(value=1), C2(value=2), C3(value=3))")
|
||||
return "Fail 3: " + res3;
|
||||
return "OK";
|
||||
}
|
||||
Vendored
+24
@@ -0,0 +1,24 @@
|
||||
import C1 = JS_TESTS.foo.bar.baz.C1;
|
||||
import C2 = JS_TESTS.a.b.C2;
|
||||
import C3 = JS_TESTS.C3;
|
||||
|
||||
function box(): string {
|
||||
const c1 = new C1("1");
|
||||
const c2 = new C2("2");
|
||||
const c3 = new C3("3");
|
||||
|
||||
const res1 = JS_TESTS.foo.bar.baz.f(c1, c2, c3);
|
||||
const res2 = JS_TESTS.a.b.f(c1, c2, c3);
|
||||
const res3 = JS_TESTS.f(c1, c2, c3);
|
||||
|
||||
if (res1 !== "foo.bar.baz.f(C1(value=1), C2(value=2), C3(value=3))")
|
||||
return "Fail 1: " + res1;
|
||||
|
||||
if (res2 !== "a.b.f(C1(value=1), C2(value=2), C3(value=3))")
|
||||
return "Fail 2: " + res2;
|
||||
|
||||
if (res3 !== "f(C1(value=1), C2(value=2), C3(value=3))")
|
||||
return "Fail 3: " + res3;
|
||||
|
||||
return "OK";
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user