[K/JS TEST] Run TestGenerated check on generated TS tests
This commit is contained in:
@@ -165,21 +165,6 @@ fun generateJsExportOnFileTestFor(dir: String): Task = task<Copy>("generate-js-e
|
||||
into(outputDir)
|
||||
}
|
||||
|
||||
val generateTypeScriptJsExportOnFileTests = sequential(
|
||||
tasks = typescriptTestsDir
|
||||
.listFiles { it: File ->
|
||||
it.isDirectory &&
|
||||
!it.path.endsWith("selective-export") &&
|
||||
!it.path.endsWith("implicit-export") &&
|
||||
!it.path.endsWith("inheritance") &&
|
||||
!it.path.endsWith("strict-implicit-export") &&
|
||||
!it.path.endsWith("private-primary-constructor") &&
|
||||
!it.path.endsWith(exportFileDirPostfix)
|
||||
}
|
||||
.map { generateJsExportOnFileTestFor(it.name) }
|
||||
)
|
||||
|
||||
|
||||
fun generateTypeScriptTestFor(dir: String): Task = task<NpmTask>("generate-ts-for-$dir") {
|
||||
val baseDir = fileTree(typescriptTestsDir.resolve(dir))
|
||||
|
||||
@@ -195,6 +180,21 @@ val generateTypeScriptTests = sequential(
|
||||
.map { generateTypeScriptTestFor(it.name) }
|
||||
)
|
||||
|
||||
val generateTypeScriptJsExportOnFileTests = sequential(
|
||||
tasks = typescriptTestsDir
|
||||
.listFiles { it: File ->
|
||||
it.isDirectory &&
|
||||
!it.path.endsWith("selective-export") &&
|
||||
!it.path.endsWith("implicit-export") &&
|
||||
!it.path.endsWith("inheritance") &&
|
||||
!it.path.endsWith("strict-implicit-export") &&
|
||||
!it.path.endsWith("private-primary-constructor") &&
|
||||
!it.path.endsWith(exportFileDirPostfix)
|
||||
}
|
||||
.map { generateJsExportOnFileTestFor(it.name) }
|
||||
.plus(generateTypeScriptTests)
|
||||
)
|
||||
|
||||
fun Test.setupNodeJs() {
|
||||
systemProperty("javascript.engine.path.NodeJs", com.github.gradle.node.variant.VariantComputer()
|
||||
.let { variantComputer ->
|
||||
@@ -218,10 +218,7 @@ fun Test.setUpJsBoxTests(jsEnabled: Boolean, jsIrEnabled: Boolean, firEnabled: B
|
||||
inputs.files(rootDir.resolve("js/js.engines/src/org/jetbrains/kotlin/js/engine/repl.js"))
|
||||
|
||||
dependsOn(":dist")
|
||||
|
||||
if (!project.hasProperty("teamcity")) {
|
||||
dependsOn(generateTypeScriptTests)
|
||||
}
|
||||
dependsOn(generateTypeScriptTests)
|
||||
|
||||
if (jsEnabled) {
|
||||
dependsOn(testJsRuntime)
|
||||
@@ -390,9 +387,7 @@ testsJar {}
|
||||
|
||||
val generateTests by generator("org.jetbrains.kotlin.generators.tests.GenerateJsTestsKt") {
|
||||
dependsOn(":compiler:generateTestData")
|
||||
if (!project.hasProperty("teamcity")) {
|
||||
dependsOn(generateTypeScriptJsExportOnFileTests)
|
||||
}
|
||||
dependsOn(generateTypeScriptJsExportOnFileTests)
|
||||
}
|
||||
|
||||
val prepareNpmTestData by tasks.registering(Copy::class) {
|
||||
|
||||
Vendored
+2
-1
@@ -1,3 +1,4 @@
|
||||
/node_modules/
|
||||
/incrementalOut/
|
||||
*.tsbuildinfo
|
||||
*.tsbuildinfo
|
||||
/typescript-export/**/*.js
|
||||
-14
@@ -1,14 +0,0 @@
|
||||
"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";
|
||||
}
|
||||
-14
@@ -1,14 +0,0 @@
|
||||
"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";
|
||||
}
|
||||
Vendored
-38
@@ -1,38 +0,0 @@
|
||||
"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";
|
||||
}
|
||||
-38
@@ -1,38 +0,0 @@
|
||||
"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
-40
@@ -1,40 +0,0 @@
|
||||
"use strict";
|
||||
var TestDataClass = JS_TESTS.foo.TestDataClass;
|
||||
var KT39423 = JS_TESTS.foo.KT39423;
|
||||
var Test2 = JS_TESTS.foo.Test2;
|
||||
function assert(condition) {
|
||||
if (!condition) {
|
||||
throw "Assertion failed";
|
||||
}
|
||||
}
|
||||
function box() {
|
||||
assert(new TestDataClass("Test").name === "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).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)");
|
||||
assert(new Test2("1", "2").value1 === "1");
|
||||
assert(new Test2("1", "2").value2 === "2");
|
||||
assert(new Test2("1", "2").copy("3").value1 === "3");
|
||||
assert(new Test2("1", "2").copy("3").value2 === "2");
|
||||
assert(new Test2("1", "2").copy(undefined, "3").value1 === "1");
|
||||
assert(new Test2("1", "2").copy(undefined, "3").value2 === "3");
|
||||
assert(new Test2("1", "2").component1() === "1");
|
||||
return "OK";
|
||||
}
|
||||
-40
@@ -1,40 +0,0 @@
|
||||
"use strict";
|
||||
var TestDataClass = JS_TESTS.foo.TestDataClass;
|
||||
var KT39423 = JS_TESTS.foo.KT39423;
|
||||
var Test2 = JS_TESTS.foo.Test2;
|
||||
function assert(condition) {
|
||||
if (!condition) {
|
||||
throw "Assertion failed";
|
||||
}
|
||||
}
|
||||
function box() {
|
||||
assert(new TestDataClass("Test").name === "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).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)");
|
||||
assert(new Test2("1", "2").value1 === "1");
|
||||
assert(new Test2("1", "2").value2 === "2");
|
||||
assert(new Test2("1", "2").copy("3").value1 === "3");
|
||||
assert(new Test2("1", "2").copy("3").value2 === "2");
|
||||
assert(new Test2("1", "2").copy(undefined, "3").value1 === "1");
|
||||
assert(new Test2("1", "2").copy(undefined, "3").value2 === "3");
|
||||
assert(new Test2("1", "2").component1() === "1");
|
||||
return "OK";
|
||||
}
|
||||
Vendored
-13
@@ -1,13 +0,0 @@
|
||||
"use strict";
|
||||
var bar = JS_TESTS.foo.bar;
|
||||
var foo = JS_TESTS.foo.foo;
|
||||
function assert(condition) {
|
||||
if (!condition) {
|
||||
throw "Assertion failed";
|
||||
}
|
||||
}
|
||||
function box() {
|
||||
assert(bar == "Test");
|
||||
assert(foo() == undefined);
|
||||
return "OK";
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
"use strict";
|
||||
var bar = JS_TESTS.foo.bar;
|
||||
var foo = JS_TESTS.foo.foo;
|
||||
function assert(condition) {
|
||||
if (!condition) {
|
||||
throw "Assertion failed";
|
||||
}
|
||||
}
|
||||
function box() {
|
||||
assert(bar == "Test");
|
||||
assert(foo() == undefined);
|
||||
return "OK";
|
||||
}
|
||||
Vendored
-36
@@ -1,36 +0,0 @@
|
||||
"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";
|
||||
}
|
||||
-36
@@ -1,36 +0,0 @@
|
||||
"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";
|
||||
}
|
||||
-29
@@ -1,29 +0,0 @@
|
||||
"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";
|
||||
}
|
||||
Vendored
-29
@@ -1,29 +0,0 @@
|
||||
"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";
|
||||
}
|
||||
-33
@@ -1,33 +0,0 @@
|
||||
"use strict";
|
||||
var foo = JS_TESTS.foo;
|
||||
function assert(condition, message) {
|
||||
if (message === void 0) { message = "Assertion failed"; }
|
||||
if (!condition) {
|
||||
throw message;
|
||||
}
|
||||
}
|
||||
function box() {
|
||||
assert(foo.foo === "Foo", "Error in property 'foo'");
|
||||
assert(foo.bar() === "Bar", "Error in property 'bar'");
|
||||
// @ts-expect-error "the param should not be exported either in TS, or in JS"
|
||||
assert(foo.baz === undefined, "Error in property 'baz'");
|
||||
// @ts-expect-error "the param should not be exported either in TS, or in JS"
|
||||
assert(foo.inter === undefined, "Error in method 'inter'");
|
||||
// @ts-expect-error "the param should not be exported either in TS, or in JS"
|
||||
assert(foo.NotExportableNestedInsideInterface === undefined, "Error in class 'NotExportableNestedInsideInterface'");
|
||||
// @ts-expect-error "the param should not be exported either in TS, or in JS"
|
||||
assert(foo.Companion === undefined, "Error in object 'Companion'");
|
||||
// @ts-expect-error "the param should not be exported either in TS, or in JS"
|
||||
assert(foo.notExportableReified === undefined, "Error in method 'notExportableReified'");
|
||||
// @ts-expect-error "the param should not be exported either in TS, or in JS"
|
||||
assert(foo.notExportableSuspend === undefined, "Error in method 'notExportableSuspend'");
|
||||
// @ts-expect-error "the param should not be exported either in TS, or in JS"
|
||||
assert(foo.notExportableReturn === undefined, "Error in method 'notExportableReturn'");
|
||||
// @ts-expect-error "the param should not be exported either in TS, or in JS"
|
||||
assert(foo.notExportableExentsionProperty === undefined, "Error in method 'notExportableExentsionProperty'");
|
||||
// @ts-expect-error "the param should not be exported either in TS, or in JS"
|
||||
assert(foo.NotExportableAnnotation === undefined, "Error in nested class 'NotExportableAnnotation'");
|
||||
// @ts-expect-error "the param should not be exported either in TS, or in JS"
|
||||
assert(foo.NotExportableInlineClass === undefined, "Error in nested class 'NotExportableInlineClass'");
|
||||
return "OK";
|
||||
}
|
||||
-33
@@ -1,33 +0,0 @@
|
||||
"use strict";
|
||||
var foo = JS_TESTS.foo;
|
||||
function assert(condition, message) {
|
||||
if (message === void 0) { message = "Assertion failed"; }
|
||||
if (!condition) {
|
||||
throw message;
|
||||
}
|
||||
}
|
||||
function box() {
|
||||
assert(foo.foo === "Foo", "Error in property 'foo'");
|
||||
assert(foo.bar() === "Bar", "Error in property 'bar'");
|
||||
// @ts-expect-error "the param should not be exported either in TS, or in JS"
|
||||
assert(foo.baz === undefined, "Error in property 'baz'");
|
||||
// @ts-expect-error "the param should not be exported either in TS, or in JS"
|
||||
assert(foo.inter === undefined, "Error in method 'inter'");
|
||||
// @ts-expect-error "the param should not be exported either in TS, or in JS"
|
||||
assert(foo.NotExportableNestedInsideInterface === undefined, "Error in class 'NotExportableNestedInsideInterface'");
|
||||
// @ts-expect-error "the param should not be exported either in TS, or in JS"
|
||||
assert(foo.Companion === undefined, "Error in object 'Companion'");
|
||||
// @ts-expect-error "the param should not be exported either in TS, or in JS"
|
||||
assert(foo.notExportableReified === undefined, "Error in method 'notExportableReified'");
|
||||
// @ts-expect-error "the param should not be exported either in TS, or in JS"
|
||||
assert(foo.notExportableSuspend === undefined, "Error in method 'notExportableSuspend'");
|
||||
// @ts-expect-error "the param should not be exported either in TS, or in JS"
|
||||
assert(foo.notExportableReturn === undefined, "Error in method 'notExportableReturn'");
|
||||
// @ts-expect-error "the param should not be exported either in TS, or in JS"
|
||||
assert(foo.notExportableExentsionProperty === undefined, "Error in method 'notExportableExentsionProperty'");
|
||||
// @ts-expect-error "the param should not be exported either in TS, or in JS"
|
||||
assert(foo.NotExportableAnnotation === undefined, "Error in nested class 'NotExportableAnnotation'");
|
||||
// @ts-expect-error "the param should not be exported either in TS, or in JS"
|
||||
assert(foo.NotExportableInlineClass === undefined, "Error in nested class 'NotExportableInlineClass'");
|
||||
return "OK";
|
||||
}
|
||||
-70
@@ -1,70 +0,0 @@
|
||||
"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;
|
||||
var formatList = JS_TESTS.foo.formatList;
|
||||
var createList = JS_TESTS.foo.createList;
|
||||
var defaultParametersAtTheBegining = JS_TESTS.foo.defaultParametersAtTheBegining;
|
||||
var nonDefaultParametersInBetween = JS_TESTS.foo.nonDefaultParameterInBetween;
|
||||
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);
|
||||
assert(formatList(createList()) === "1, 2, 3");
|
||||
assert(defaultParametersAtTheBegining("A", "B") == "A and B");
|
||||
assert(defaultParametersAtTheBegining(undefined, "B") == "Default Value and B");
|
||||
assert(nonDefaultParametersInBetween("A", "B", "C") == "A and B and C");
|
||||
assert(nonDefaultParametersInBetween("A", "B") == "A and B and Default C");
|
||||
assert(nonDefaultParametersInBetween(undefined, "B", "C") == "Default A and B and C");
|
||||
assert(nonDefaultParametersInBetween(undefined, "B") == "Default A and B and Default C");
|
||||
return "OK";
|
||||
}
|
||||
@@ -1,70 +0,0 @@
|
||||
"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;
|
||||
var formatList = JS_TESTS.foo.formatList;
|
||||
var createList = JS_TESTS.foo.createList;
|
||||
var defaultParametersAtTheBegining = JS_TESTS.foo.defaultParametersAtTheBegining;
|
||||
var nonDefaultParametersInBetween = JS_TESTS.foo.nonDefaultParameterInBetween;
|
||||
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);
|
||||
assert(formatList(createList()) === "1, 2, 3");
|
||||
assert(defaultParametersAtTheBegining("A", "B") == "A and B");
|
||||
assert(defaultParametersAtTheBegining(undefined, "B") == "Default Value and B");
|
||||
assert(nonDefaultParametersInBetween("A", "B", "C") == "A and B and C");
|
||||
assert(nonDefaultParametersInBetween("A", "B") == "A and B and Default C");
|
||||
assert(nonDefaultParametersInBetween(undefined, "B", "C") == "Default A and B and C");
|
||||
assert(nonDefaultParametersInBetween(undefined, "B") == "Default A and B and Default C");
|
||||
return "OK";
|
||||
}
|
||||
-21
@@ -1,21 +0,0 @@
|
||||
"use strict";
|
||||
var producer = JS_TESTS.foo.producer;
|
||||
var consumer = JS_TESTS.foo.consumer;
|
||||
var A = JS_TESTS.foo.A;
|
||||
var B = JS_TESTS.foo.B;
|
||||
function assert(condition) {
|
||||
if (!condition) {
|
||||
throw "Assertion failed";
|
||||
}
|
||||
}
|
||||
function box() {
|
||||
var nonExportedType = producer(42);
|
||||
var a = new A(nonExportedType);
|
||||
var b = new B(43);
|
||||
assert(consumer(nonExportedType) == 42);
|
||||
a.value = producer(24);
|
||||
assert(consumer(b) == 43);
|
||||
assert(consumer(a.value) == 24);
|
||||
assert(consumer(a.increment(nonExportedType)) == 43);
|
||||
return "OK";
|
||||
}
|
||||
-205
@@ -1,205 +0,0 @@
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || (function () {
|
||||
var extendStatics = function (d, b) {
|
||||
extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
||||
return extendStatics(d, b);
|
||||
};
|
||||
return function (d, b) {
|
||||
if (typeof b !== "function" && b !== null)
|
||||
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
var OC = JS_TESTS.foo.OC;
|
||||
var AC = JS_TESTS.foo.AC;
|
||||
var FC = JS_TESTS.foo.FC;
|
||||
var O1 = JS_TESTS.foo.O1;
|
||||
var O2 = JS_TESTS.foo.O2;
|
||||
var getI3 = JS_TESTS.foo.getI3;
|
||||
var getA = JS_TESTS.foo.getA;
|
||||
var getB = JS_TESTS.foo.getB;
|
||||
var getC = JS_TESTS.foo.getC;
|
||||
var B2 = JS_TESTS.foo.B2;
|
||||
var C2 = JS_TESTS.foo.C2;
|
||||
var EC = JS_TESTS.foo.EC;
|
||||
var A2 = JS_TESTS.foo.A2;
|
||||
var Impl = /** @class */ (function (_super) {
|
||||
__extends(Impl, _super);
|
||||
function Impl() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
Impl.prototype.z = function (z) {
|
||||
};
|
||||
Object.defineProperty(Impl.prototype, "acAbstractProp", {
|
||||
get: function () { return "Impl"; },
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(Impl.prototype, "y", {
|
||||
get: function () { return true; },
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
return Impl;
|
||||
}(AC));
|
||||
var A2Impl = /** @class */ (function (_super) {
|
||||
__extends(A2Impl, _super);
|
||||
function A2Impl() {
|
||||
var _this = _super !== null && _super.apply(this, arguments) || this;
|
||||
_this._bar = "barA2";
|
||||
return _this;
|
||||
}
|
||||
Object.defineProperty(A2Impl.prototype, "bar", {
|
||||
get: function () {
|
||||
return this._bar;
|
||||
},
|
||||
set: function (value) {
|
||||
this._bar = value;
|
||||
},
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(A2Impl.prototype, "baz", {
|
||||
get: function () {
|
||||
return "bazA2";
|
||||
},
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(A2Impl.prototype, "foo", {
|
||||
get: function () {
|
||||
return "fooA2";
|
||||
},
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
A2Impl.prototype.bay = function () {
|
||||
return "bayA2";
|
||||
};
|
||||
return A2Impl;
|
||||
}(A2));
|
||||
function box() {
|
||||
var impl = new Impl();
|
||||
if (impl.acProp !== "acProp")
|
||||
return "Fail 1";
|
||||
if (impl.x !== "AC")
|
||||
return "Fail 2";
|
||||
if (impl.acAbstractProp !== "Impl")
|
||||
return "Fail 2.1";
|
||||
if (impl.y !== true)
|
||||
return "Fail 2.2";
|
||||
var oc = new OC(false, "OC");
|
||||
if (oc.y !== false)
|
||||
return "Fail 3";
|
||||
if (oc.acAbstractProp !== "OC")
|
||||
return "Fail 4";
|
||||
oc.z(10);
|
||||
var fc = new FC();
|
||||
if (fc.y !== true)
|
||||
return "Fail 5";
|
||||
if (fc.acAbstractProp !== "FC")
|
||||
return "Fail 6";
|
||||
fc.z(10);
|
||||
if (O1.y !== true || O2.y !== true)
|
||||
return "Fail 7";
|
||||
if (O1.acAbstractProp != "O1")
|
||||
return "Fail 8";
|
||||
if (O2.acAbstractProp != "O2")
|
||||
return "Fail 9";
|
||||
if (O2.foo() != 10)
|
||||
return "Fail 10";
|
||||
if (getI3().foo != "fooI3")
|
||||
return "Fail 11";
|
||||
if (getI3().bar != "barI3")
|
||||
return "Fail 12";
|
||||
if (getI3().baz != "bazI3")
|
||||
return "Fail 13";
|
||||
if (getI3().bay() != "bayI3")
|
||||
return "Fail 14";
|
||||
if (getA().foo != "fooA")
|
||||
return "Fail 15";
|
||||
if (getA().bar != "barA")
|
||||
return "Fail 16";
|
||||
if (getA().baz != "bazA")
|
||||
return "Fail 17";
|
||||
if (getA().bay() != "bayA")
|
||||
return "Fail 18";
|
||||
if (getB().foo != "fooB")
|
||||
return "Fail 19";
|
||||
if (getB().bar != "barB")
|
||||
return "Fail 20";
|
||||
if (getB().baz != "bazB")
|
||||
return "Fail 21";
|
||||
if (getB().bay() != "bayB")
|
||||
return "Fail 22";
|
||||
if (getC().foo != "fooC")
|
||||
return "Fail 23";
|
||||
if (getC().bar != "barC")
|
||||
return "Fail 24";
|
||||
if (getC().baz != "bazC")
|
||||
return "Fail 25";
|
||||
if (getC().bay() != "bayC")
|
||||
return "Fail 26";
|
||||
var a2Impl = new A2Impl();
|
||||
if (a2Impl.foo != "fooA2")
|
||||
return "Fail 27";
|
||||
if (a2Impl.bar != "barA2")
|
||||
return "Fail 28";
|
||||
a2Impl.bar = "barA2.2";
|
||||
if (a2Impl.bar != "barA2.2")
|
||||
return "Fail 28.2";
|
||||
if (a2Impl.baz != "bazA2")
|
||||
return "Fail 29";
|
||||
if (a2Impl.bay() != "bayA2")
|
||||
return "Fail 30";
|
||||
var b2 = new B2();
|
||||
if (b2.foo != "fooB2")
|
||||
return "Fail 31";
|
||||
if (b2.bar != "barB2")
|
||||
return "Fail 32";
|
||||
if (b2.baz != "bazB2")
|
||||
return "Fail 33";
|
||||
if (b2.bay() != "bayB2")
|
||||
return "Fail 34";
|
||||
var c2 = new C2();
|
||||
if (c2.foo != "fooC2")
|
||||
return "Fail 35";
|
||||
if (c2.bar != "barC2")
|
||||
return "Fail 36";
|
||||
if (c2.baz != "bazC2")
|
||||
return "Fail 37";
|
||||
c2.baz = "bazC2-2";
|
||||
if (c2.baz != "bazC2-2")
|
||||
return "Fail 38";
|
||||
if (c2.bay() != "bayC2")
|
||||
return "Fail 39";
|
||||
if (EC.EC1.foo != "foo")
|
||||
return "Fail 40";
|
||||
if (EC.EC1.bar != "bar")
|
||||
return "Fail 41";
|
||||
if (EC.EC1.baz != "ec1")
|
||||
return "Fail 42";
|
||||
if (EC.EC1.bay() != "bay")
|
||||
return "Fail 43";
|
||||
if (EC.EC2.foo != "foo")
|
||||
return "Fail 44";
|
||||
if (EC.EC2.bar != "bar")
|
||||
return "Fail 45";
|
||||
if (EC.EC2.baz != "ec2")
|
||||
return "Fail 46";
|
||||
if (EC.EC2.bay() != "bay")
|
||||
return "Fail 47";
|
||||
if (EC.EC3.foo != "foo")
|
||||
return "Fail 48";
|
||||
if (EC.EC3.bar != "bar")
|
||||
return "Fail 49";
|
||||
if (EC.EC3.baz != "ec3")
|
||||
return "Fail 50";
|
||||
if (EC.EC3.bay() != "bay")
|
||||
return "Fail 51";
|
||||
return "OK";
|
||||
}
|
||||
Vendored
-24
@@ -1,24 +0,0 @@
|
||||
"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";
|
||||
}
|
||||
-24
@@ -1,24 +0,0 @@
|
||||
"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
-20
@@ -1,20 +0,0 @@
|
||||
"use strict";
|
||||
var TestInterfaceImpl = JS_TESTS.foo.TestInterfaceImpl;
|
||||
var ChildTestInterfaceImpl = JS_TESTS.foo.ChildTestInterfaceImpl;
|
||||
var processInterface = JS_TESTS.foo.processInterface;
|
||||
var processOptionalInterface = JS_TESTS.foo.processOptionalInterface;
|
||||
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'");
|
||||
assert(processOptionalInterface({ required: 4 }) == "4unknown");
|
||||
assert(processOptionalInterface({ required: 4, notRequired: null }) == "4unknown");
|
||||
assert(processOptionalInterface({ required: 4, notRequired: 5 }) == "45");
|
||||
return "OK";
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
"use strict";
|
||||
var TestInterfaceImpl = JS_TESTS.foo.TestInterfaceImpl;
|
||||
var ChildTestInterfaceImpl = JS_TESTS.foo.ChildTestInterfaceImpl;
|
||||
var processInterface = JS_TESTS.foo.processInterface;
|
||||
var processOptionalInterface = JS_TESTS.foo.processOptionalInterface;
|
||||
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'");
|
||||
assert(processOptionalInterface({ required: 4 }) == "4unknown");
|
||||
assert(processOptionalInterface({ required: 4, notRequired: null }) == "4unknown");
|
||||
assert(processOptionalInterface({ required: 4, notRequired: 5 }) == "45");
|
||||
return "OK";
|
||||
}
|
||||
-16
@@ -1,16 +0,0 @@
|
||||
"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({ constructor: Function }) === "Function");
|
||||
var jsNameNestedTest = JsNameTest.NotCompanion.createChild(42);
|
||||
assert(jsNameNestedTest.value === 42);
|
||||
return "OK";
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
"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({ constructor: Function }) === "Function");
|
||||
var jsNameNestedTest = JsNameTest.NotCompanion.createChild(42);
|
||||
assert(jsNameNestedTest.value === 42);
|
||||
return "OK";
|
||||
}
|
||||
-23
@@ -1,23 +0,0 @@
|
||||
"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";
|
||||
}
|
||||
-23
@@ -1,23 +0,0 @@
|
||||
"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";
|
||||
}
|
||||
-48
@@ -1,48 +0,0 @@
|
||||
"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";
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
"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";
|
||||
}
|
||||
Vendored
-19
@@ -1,19 +0,0 @@
|
||||
"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";
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
"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";
|
||||
}
|
||||
-32
@@ -1,32 +0,0 @@
|
||||
"use strict";
|
||||
var OnlyFooParamExported = JS_TESTS.foo.OnlyFooParamExported;
|
||||
function assert(condition, message) {
|
||||
if (message === void 0) { message = "Assertion failed"; }
|
||||
if (!condition) {
|
||||
throw message;
|
||||
}
|
||||
}
|
||||
function box() {
|
||||
var onlyFooParamExported = new OnlyFooParamExported("TEST");
|
||||
assert(OnlyFooParamExported.length === 1, "Error in constructor'");
|
||||
assert(onlyFooParamExported.foo === "TEST", "Error in property 'foo'");
|
||||
// @ts-expect-error "the param should not be exported either in TS, or in JS"
|
||||
assert(onlyFooParamExported.bar === undefined, "Error in property 'bar'");
|
||||
// @ts-expect-error "the param should not be exported either in TS, or in JS"
|
||||
assert(onlyFooParamExported.baz === undefined, "Error in property 'baz'");
|
||||
// @ts-expect-error "the param should not be exported either in TS, or in JS"
|
||||
assert(onlyFooParamExported.inter === undefined, "Error in method 'inter'");
|
||||
// @ts-expect-error "the param should not be exported either in TS, or in JS"
|
||||
assert(onlyFooParamExported.notExportableReified === undefined, "Error in method 'notExportableReified'");
|
||||
// @ts-expect-error "the param should not be exported either in TS, or in JS"
|
||||
assert(onlyFooParamExported.notExportableSuspend === undefined, "Error in method 'notExportableSuspend'");
|
||||
// @ts-expect-error "the param should not be exported either in TS, or in JS"
|
||||
assert(onlyFooParamExported.notExportableReturn === undefined, "Error in method 'notExportableReturn'");
|
||||
// @ts-expect-error "the param should not be exported either in TS, or in JS"
|
||||
assert(onlyFooParamExported.notExportableExentsionProperty === undefined, "Error in method 'notExportableExentsionProperty'");
|
||||
// @ts-expect-error "the param should not be exported either in TS, or in JS"
|
||||
assert(OnlyFooParamExported.NotExportableAnnotation === undefined, "Error in nested class 'NotExportableAnnotation'");
|
||||
// @ts-expect-error "the param should not be exported either in TS, or in JS"
|
||||
assert(OnlyFooParamExported.NotExportableInlineClass === undefined, "Error in nested class 'NotExportableInlineClass'");
|
||||
return "OK";
|
||||
}
|
||||
-32
@@ -1,32 +0,0 @@
|
||||
"use strict";
|
||||
var OnlyFooParamExported = JS_TESTS.foo.OnlyFooParamExported;
|
||||
function assert(condition, message) {
|
||||
if (message === void 0) { message = "Assertion failed"; }
|
||||
if (!condition) {
|
||||
throw message;
|
||||
}
|
||||
}
|
||||
function box() {
|
||||
var onlyFooParamExported = new OnlyFooParamExported("TEST");
|
||||
assert(OnlyFooParamExported.length === 1, "Error in constructor'");
|
||||
assert(onlyFooParamExported.foo === "TEST", "Error in property 'foo'");
|
||||
// @ts-expect-error "the param should not be exported either in TS, or in JS"
|
||||
assert(onlyFooParamExported.bar === undefined, "Error in property 'bar'");
|
||||
// @ts-expect-error "the param should not be exported either in TS, or in JS"
|
||||
assert(onlyFooParamExported.baz === undefined, "Error in property 'baz'");
|
||||
// @ts-expect-error "the param should not be exported either in TS, or in JS"
|
||||
assert(onlyFooParamExported.inter === undefined, "Error in method 'inter'");
|
||||
// @ts-expect-error "the param should not be exported either in TS, or in JS"
|
||||
assert(onlyFooParamExported.notExportableReified === undefined, "Error in method 'notExportableReified'");
|
||||
// @ts-expect-error "the param should not be exported either in TS, or in JS"
|
||||
assert(onlyFooParamExported.notExportableSuspend === undefined, "Error in method 'notExportableSuspend'");
|
||||
// @ts-expect-error "the param should not be exported either in TS, or in JS"
|
||||
assert(onlyFooParamExported.notExportableReturn === undefined, "Error in method 'notExportableReturn'");
|
||||
// @ts-expect-error "the param should not be exported either in TS, or in JS"
|
||||
assert(onlyFooParamExported.notExportableExentsionProperty === undefined, "Error in method 'notExportableExentsionProperty'");
|
||||
// @ts-expect-error "the param should not be exported either in TS, or in JS"
|
||||
assert(OnlyFooParamExported.NotExportableAnnotation === undefined, "Error in nested class 'NotExportableAnnotation'");
|
||||
// @ts-expect-error "the param should not be exported either in TS, or in JS"
|
||||
assert(OnlyFooParamExported.NotExportableInlineClass === undefined, "Error in nested class 'NotExportableInlineClass'");
|
||||
return "OK";
|
||||
}
|
||||
-34
@@ -1,34 +0,0 @@
|
||||
"use strict";
|
||||
var O = JS_TESTS.foo.O;
|
||||
var O0 = JS_TESTS.foo.O0;
|
||||
var Parent = JS_TESTS.foo.Parent;
|
||||
var takesO = JS_TESTS.foo.takesO;
|
||||
var getParent = JS_TESTS.foo.getParent;
|
||||
var createNested1 = JS_TESTS.foo.createNested1;
|
||||
var createNested2 = JS_TESTS.foo.createNested2;
|
||||
var createNested3 = JS_TESTS.foo.createNested3;
|
||||
var WithSimpleObjectInside = JS_TESTS.foo.WithSimpleObjectInside;
|
||||
function assert(condition) {
|
||||
if (!condition) {
|
||||
throw "Assertion failed";
|
||||
}
|
||||
}
|
||||
function box() {
|
||||
assert(typeof O0 === "object" && O0 != null);
|
||||
assert(O.x === 10);
|
||||
assert(O.foo() === 20);
|
||||
assert(takesO(O) === 30);
|
||||
// Do not strip types from those test cases (it is a check of nested objects types usability)
|
||||
var parent = Parent;
|
||||
var nested1 = Parent.Nested1;
|
||||
var nested2 = new Parent.Nested1.Nested2();
|
||||
var nested3 = new Parent.Nested1.Nested2.Companion.Nested3();
|
||||
assert(nested1.value === "Nested1");
|
||||
assert(getParent() === parent);
|
||||
assert(createNested1() === nested1);
|
||||
assert(createNested2() !== nested2 && createNested2() instanceof Parent.Nested1.Nested2);
|
||||
assert(createNested3() !== nested3 && createNested3() instanceof Parent.Nested1.Nested2.Companion.Nested3);
|
||||
assert(WithSimpleObjectInside.value === "WithSimpleObjectInside");
|
||||
assert(WithSimpleObjectInside.SimpleObject.value === "SimpleObject");
|
||||
return "OK";
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
"use strict";
|
||||
var O = JS_TESTS.foo.O;
|
||||
var O0 = JS_TESTS.foo.O0;
|
||||
var Parent = JS_TESTS.foo.Parent;
|
||||
var takesO = JS_TESTS.foo.takesO;
|
||||
var getParent = JS_TESTS.foo.getParent;
|
||||
var createNested1 = JS_TESTS.foo.createNested1;
|
||||
var createNested2 = JS_TESTS.foo.createNested2;
|
||||
var createNested3 = JS_TESTS.foo.createNested3;
|
||||
var WithSimpleObjectInside = JS_TESTS.foo.WithSimpleObjectInside;
|
||||
function assert(condition) {
|
||||
if (!condition) {
|
||||
throw "Assertion failed";
|
||||
}
|
||||
}
|
||||
function box() {
|
||||
assert(typeof O0 === "object" && O0 != null);
|
||||
assert(O.x === 10);
|
||||
assert(O.foo() === 20);
|
||||
assert(takesO(O) === 30);
|
||||
// Do not strip types from those test cases (it is a check of nested objects types usability)
|
||||
var parent = Parent;
|
||||
var nested1 = Parent.Nested1;
|
||||
var nested2 = new Parent.Nested1.Nested2();
|
||||
var nested3 = new Parent.Nested1.Nested2.Companion.Nested3();
|
||||
assert(nested1.value === "Nested1");
|
||||
assert(getParent() === parent);
|
||||
assert(createNested1() === nested1);
|
||||
assert(createNested2() !== nested2 && createNested2() instanceof Parent.Nested1.Nested2);
|
||||
assert(createNested3() !== nested3 && createNested3() instanceof Parent.Nested1.Nested2.Companion.Nested3);
|
||||
assert(WithSimpleObjectInside.value === "WithSimpleObjectInside");
|
||||
assert(WithSimpleObjectInside.SimpleObject.value === "SimpleObject");
|
||||
return "OK";
|
||||
}
|
||||
Vendored
-58
@@ -1,58 +0,0 @@
|
||||
"use strict";
|
||||
var foo = JS_TESTS.foo;
|
||||
function assert(condition) {
|
||||
if (!condition) {
|
||||
throw "Assertion failed";
|
||||
}
|
||||
}
|
||||
assert(typeof foo._any === "object");
|
||||
assert(foo._string === "ZZZ");
|
||||
assert(foo._boolean === true);
|
||||
assert(foo._byte === 1);
|
||||
assert(foo._short === 1);
|
||||
assert(foo._float === 1);
|
||||
assert(foo._double === 1);
|
||||
assert(foo._byte_array instanceof Int8Array);
|
||||
assert(foo._short_array instanceof Int16Array);
|
||||
assert(foo._int_array instanceof Int32Array);
|
||||
assert(foo._float_array instanceof Float32Array);
|
||||
assert(foo._double_array instanceof Float64Array);
|
||||
assert(foo._array_byte instanceof Array);
|
||||
assert(foo._array_short instanceof Array);
|
||||
assert(foo._array_int instanceof Array);
|
||||
assert(foo._array_float instanceof Array);
|
||||
assert(foo._array_double instanceof Array);
|
||||
assert(foo._array_string instanceof Array);
|
||||
assert(foo._array_boolean instanceof Array);
|
||||
assert(foo._array_array_string instanceof Array);
|
||||
assert(foo._array_array_string[0] instanceof Array);
|
||||
assert(foo._array_array_int_array instanceof Array);
|
||||
assert(foo._array_array_int_array[0] instanceof Array);
|
||||
assert(foo._array_array_int_array[0][0] instanceof Int32Array);
|
||||
foo._fun_unit();
|
||||
foo._fun_int_unit(10);
|
||||
assert(foo._fun_boolean_int_string_intarray(true, 20, "A") instanceof Int32Array);
|
||||
assert(foo._curried_fun(1)(2)(3)(4)(5) == 15);
|
||||
assert(foo._higher_order_fun(function (n) { return String(n); }, function (s) { return s.length; })(1000) == 4);
|
||||
assert(foo._n_any != null);
|
||||
assert(foo._n_nothing == null);
|
||||
assert(foo._n_throwable instanceof Error);
|
||||
assert(foo._n_string === "ZZZ");
|
||||
assert(foo._n_boolean === true);
|
||||
assert(foo._n_byte === 1);
|
||||
assert(foo._n_short_array instanceof Int16Array);
|
||||
assert(foo._n_array_int instanceof Array);
|
||||
assert(foo._array_n_int instanceof Array);
|
||||
assert(foo._n_array_n_int instanceof Array);
|
||||
assert(foo._array_n_array_string instanceof Array);
|
||||
var x = foo._array_n_array_string[0];
|
||||
assert(x != null);
|
||||
assert(x instanceof Array);
|
||||
assert(x == null ? false : (x[0] === ":)"));
|
||||
foo._fun_n_int_unit(null);
|
||||
assert(foo._fun_n_boolean_n_int_n_string_n_intarray(false, undefined, "ZZZ") == null);
|
||||
assert(foo._n_curried_fun(10)(null)(30) === 40);
|
||||
assert(foo._n_higher_order_fun(function (n) { return String(n); }, function (s) { return (s == null ? 10 : s.length); })(1000) === 4);
|
||||
function box() {
|
||||
return "OK";
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
"use strict";
|
||||
var foo = JS_TESTS.foo;
|
||||
function assert(condition) {
|
||||
if (!condition) {
|
||||
throw "Assertion failed";
|
||||
}
|
||||
}
|
||||
assert(typeof foo._any === "object");
|
||||
assert(foo._string === "ZZZ");
|
||||
assert(foo._boolean === true);
|
||||
assert(foo._byte === 1);
|
||||
assert(foo._short === 1);
|
||||
assert(foo._float === 1);
|
||||
assert(foo._double === 1);
|
||||
assert(foo._byte_array instanceof Int8Array);
|
||||
assert(foo._short_array instanceof Int16Array);
|
||||
assert(foo._int_array instanceof Int32Array);
|
||||
assert(foo._float_array instanceof Float32Array);
|
||||
assert(foo._double_array instanceof Float64Array);
|
||||
assert(foo._array_byte instanceof Array);
|
||||
assert(foo._array_short instanceof Array);
|
||||
assert(foo._array_int instanceof Array);
|
||||
assert(foo._array_float instanceof Array);
|
||||
assert(foo._array_double instanceof Array);
|
||||
assert(foo._array_string instanceof Array);
|
||||
assert(foo._array_boolean instanceof Array);
|
||||
assert(foo._array_array_string instanceof Array);
|
||||
assert(foo._array_array_string[0] instanceof Array);
|
||||
assert(foo._array_array_int_array instanceof Array);
|
||||
assert(foo._array_array_int_array[0] instanceof Array);
|
||||
assert(foo._array_array_int_array[0][0] instanceof Int32Array);
|
||||
foo._fun_unit();
|
||||
foo._fun_int_unit(10);
|
||||
assert(foo._fun_boolean_int_string_intarray(true, 20, "A") instanceof Int32Array);
|
||||
assert(foo._curried_fun(1)(2)(3)(4)(5) == 15);
|
||||
assert(foo._higher_order_fun(function (n) { return String(n); }, function (s) { return s.length; })(1000) == 4);
|
||||
assert(foo._n_any != null);
|
||||
assert(foo._n_nothing == null);
|
||||
assert(foo._n_throwable instanceof Error);
|
||||
assert(foo._n_string === "ZZZ");
|
||||
assert(foo._n_boolean === true);
|
||||
assert(foo._n_byte === 1);
|
||||
assert(foo._n_short_array instanceof Int16Array);
|
||||
assert(foo._n_array_int instanceof Array);
|
||||
assert(foo._array_n_int instanceof Array);
|
||||
assert(foo._n_array_n_int instanceof Array);
|
||||
assert(foo._array_n_array_string instanceof Array);
|
||||
var x = foo._array_n_array_string[0];
|
||||
assert(x != null);
|
||||
assert(x instanceof Array);
|
||||
assert(x == null ? false : (x[0] === ":)"));
|
||||
foo._fun_n_int_unit(null);
|
||||
assert(foo._fun_n_boolean_n_int_n_string_n_intarray(false, undefined, "ZZZ") == null);
|
||||
assert(foo._n_curried_fun(10)(null)(30) === 40);
|
||||
assert(foo._n_higher_order_fun(function (n) { return String(n); }, function (s) { return (s == null ? 10 : s.length); })(1000) === 4);
|
||||
function box() {
|
||||
return "OK";
|
||||
}
|
||||
-20
@@ -1,20 +0,0 @@
|
||||
"use strict";
|
||||
var SomeBaseClass = JS_TESTS.foo.SomeBaseClass;
|
||||
var SomeExtendingClass = JS_TESTS.foo.SomeExtendingClass;
|
||||
var FinalClassInChain = JS_TESTS.foo.FinalClassInChain;
|
||||
function assert(condition) {
|
||||
if (!condition) {
|
||||
throw "Assertion failed";
|
||||
}
|
||||
}
|
||||
function box() {
|
||||
// @ts-expect-error "the constructor is private and can't be used from JS/TS code"
|
||||
var baseClass = new SomeBaseClass(4);
|
||||
assert(baseClass.answer === 4);
|
||||
// @ts-expect-error "the constructor is private and can't be used from JS/TS code"
|
||||
var extendingClass = new SomeExtendingClass();
|
||||
assert(extendingClass.answer === 42);
|
||||
var finalClassInChain = new FinalClassInChain();
|
||||
assert(finalClassInChain.answer === 42);
|
||||
return "OK";
|
||||
}
|
||||
Vendored
-27
@@ -1,27 +0,0 @@
|
||||
"use strict";
|
||||
var _const_val = JS_TESTS.foo._const_val;
|
||||
var _val = JS_TESTS.foo._val;
|
||||
var _var = JS_TESTS.foo._var;
|
||||
var _valCustom = JS_TESTS.foo._valCustom;
|
||||
var _valCustomWithField = JS_TESTS.foo._valCustomWithField;
|
||||
function assert(condition) {
|
||||
if (!condition) {
|
||||
throw "Assertion failed";
|
||||
}
|
||||
}
|
||||
function box() {
|
||||
assert(_const_val === 1);
|
||||
assert(_val === 1);
|
||||
assert(_var === 1);
|
||||
JS_TESTS.foo._var = 1000;
|
||||
assert(JS_TESTS.foo._var === 1000);
|
||||
assert(_valCustom === 1);
|
||||
assert(_valCustomWithField === 2);
|
||||
assert(JS_TESTS.foo._varCustom === 1);
|
||||
JS_TESTS.foo._varCustom = 20;
|
||||
assert(JS_TESTS.foo._varCustom === 1);
|
||||
assert(JS_TESTS.foo._varCustomWithField === 10);
|
||||
JS_TESTS.foo._varCustomWithField = 10;
|
||||
assert(JS_TESTS.foo._varCustomWithField === 1000);
|
||||
return "OK";
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
"use strict";
|
||||
var _const_val = JS_TESTS.foo._const_val;
|
||||
var _val = JS_TESTS.foo._val;
|
||||
var _var = JS_TESTS.foo._var;
|
||||
var _valCustom = JS_TESTS.foo._valCustom;
|
||||
var _valCustomWithField = JS_TESTS.foo._valCustomWithField;
|
||||
function assert(condition) {
|
||||
if (!condition) {
|
||||
throw "Assertion failed";
|
||||
}
|
||||
}
|
||||
function box() {
|
||||
assert(_const_val === 1);
|
||||
assert(_val === 1);
|
||||
assert(_var === 1);
|
||||
JS_TESTS.foo._var = 1000;
|
||||
assert(JS_TESTS.foo._var === 1000);
|
||||
assert(_valCustom === 1);
|
||||
assert(_valCustomWithField === 2);
|
||||
assert(JS_TESTS.foo._varCustom === 1);
|
||||
JS_TESTS.foo._varCustom = 20;
|
||||
assert(JS_TESTS.foo._varCustom === 1);
|
||||
assert(JS_TESTS.foo._varCustomWithField === 10);
|
||||
JS_TESTS.foo._varCustomWithField = 10;
|
||||
assert(JS_TESTS.foo._varCustomWithField === 1000);
|
||||
return "OK";
|
||||
}
|
||||
-26
@@ -1,26 +0,0 @@
|
||||
"use strict";
|
||||
var A = JS_TESTS.foo.A;
|
||||
var A1 = JS_TESTS.foo.A1;
|
||||
var A2 = JS_TESTS.foo.A2;
|
||||
var A3 = JS_TESTS.foo.A3;
|
||||
var A4 = JS_TESTS.foo.A4;
|
||||
var A5 = JS_TESTS.foo.A5;
|
||||
var A6 = JS_TESTS.foo.A6;
|
||||
var GenericClassWithConstraint = JS_TESTS.foo.GenericClassWithConstraint;
|
||||
function assert(condition) {
|
||||
if (!condition) {
|
||||
throw "Assertion failed";
|
||||
}
|
||||
}
|
||||
function box() {
|
||||
new A();
|
||||
assert(new A1(10).x === 10);
|
||||
assert(new A2("10", true).x === "10");
|
||||
assert(new A3().x === 100);
|
||||
assert(new A4("Hello").test() === "Hello");
|
||||
assert(A5.Companion.x === 10);
|
||||
assert(new A6().then() === 42);
|
||||
assert(new A6().catch() === 24);
|
||||
assert(new GenericClassWithConstraint(new A6()).test.catch() === 24);
|
||||
return "OK";
|
||||
}
|
||||
-26
@@ -1,26 +0,0 @@
|
||||
"use strict";
|
||||
var A = JS_TESTS.foo.A;
|
||||
var A1 = JS_TESTS.foo.A1;
|
||||
var A2 = JS_TESTS.foo.A2;
|
||||
var A3 = JS_TESTS.foo.A3;
|
||||
var A4 = JS_TESTS.foo.A4;
|
||||
var A5 = JS_TESTS.foo.A5;
|
||||
var A6 = JS_TESTS.foo.A6;
|
||||
var GenericClassWithConstraint = JS_TESTS.foo.GenericClassWithConstraint;
|
||||
function assert(condition) {
|
||||
if (!condition) {
|
||||
throw "Assertion failed";
|
||||
}
|
||||
}
|
||||
function box() {
|
||||
new A();
|
||||
assert(new A1(10).x === 10);
|
||||
assert(new A2("10", true).x === "10");
|
||||
assert(new A3().x === 100);
|
||||
assert(new A4("Hello").test() === "Hello");
|
||||
assert(A5.Companion.x === 10);
|
||||
assert(new A6().then() === 42);
|
||||
assert(new A6().catch() === 24);
|
||||
assert(new GenericClassWithConstraint(new A6()).test.catch() === 24);
|
||||
return "OK";
|
||||
}
|
||||
Vendored
-14
@@ -1,14 +0,0 @@
|
||||
"use strict";
|
||||
var TestSealed = JS_TESTS.foo.TestSealed;
|
||||
function assert(condition) {
|
||||
if (!condition) {
|
||||
throw "Assertion failed";
|
||||
}
|
||||
}
|
||||
function box() {
|
||||
assert(new TestSealed.AA().name == "AA");
|
||||
assert(new TestSealed.AA().bar() == "bar");
|
||||
assert(new TestSealed.BB().name == "BB");
|
||||
assert(new TestSealed.BB().baz() == "baz");
|
||||
return "OK";
|
||||
}
|
||||
-14
@@ -1,14 +0,0 @@
|
||||
"use strict";
|
||||
var TestSealed = JS_TESTS.foo.TestSealed;
|
||||
function assert(condition) {
|
||||
if (!condition) {
|
||||
throw "Assertion failed";
|
||||
}
|
||||
}
|
||||
function box() {
|
||||
assert(new TestSealed.AA().name == "AA");
|
||||
assert(new TestSealed.AA().bar() == "bar");
|
||||
assert(new TestSealed.BB().name == "BB");
|
||||
assert(new TestSealed.BB().baz() == "baz");
|
||||
return "OK";
|
||||
}
|
||||
-15
@@ -1,15 +0,0 @@
|
||||
"use strict";
|
||||
var foo = JS_TESTS.foo;
|
||||
function box() {
|
||||
var tens = [
|
||||
foo.exportedVal,
|
||||
foo.exportedFun(),
|
||||
new foo.ExportedClass().value,
|
||||
foo.fileLevelExportedVal,
|
||||
foo.fileLevelExportedFun(),
|
||||
new foo.FileLevelExportedClass().value
|
||||
];
|
||||
if (tens.every(function (value) { return value === 10; }))
|
||||
return "OK";
|
||||
return "FAIL";
|
||||
}
|
||||
Vendored
-28
@@ -1,28 +0,0 @@
|
||||
"use strict";
|
||||
var producer = JS_TESTS.foo.producer;
|
||||
var consumer = JS_TESTS.foo.consumer;
|
||||
var A = JS_TESTS.foo.A;
|
||||
var B = JS_TESTS.foo.B;
|
||||
var childProducer = JS_TESTS.foo.childProducer;
|
||||
var childConsumer = JS_TESTS.foo.childConsumer;
|
||||
var genericChildProducer = JS_TESTS.foo.genericChildProducer;
|
||||
var genericChildConsumer = JS_TESTS.foo.genericChildConsumer;
|
||||
function assert(condition) {
|
||||
if (!condition) {
|
||||
throw "Assertion failed";
|
||||
}
|
||||
}
|
||||
function box() {
|
||||
var nonExportedType = producer(42);
|
||||
var a = new A(nonExportedType);
|
||||
var b = new B(43);
|
||||
assert(consumer(nonExportedType) == 42);
|
||||
a.value = producer(24);
|
||||
assert(consumer(b) == 43);
|
||||
assert(consumer(a.value) == 24);
|
||||
assert(consumer(a.increment(nonExportedType)) == 43);
|
||||
var oneMoreNonExportedType = childProducer(322);
|
||||
assert(consumer(oneMoreNonExportedType) == 322);
|
||||
assert(childConsumer(oneMoreNonExportedType) == 322);
|
||||
return "OK";
|
||||
}
|
||||
Vendored
-17
@@ -1,17 +0,0 @@
|
||||
"use strict";
|
||||
var Class = JS_TESTS.Class;
|
||||
function box() {
|
||||
var tens = [
|
||||
JS_TESTS.publicVal,
|
||||
JS_TESTS.publicFun(),
|
||||
new JS_TESTS.Class().publicVal,
|
||||
new JS_TESTS.Class().publicFun()
|
||||
];
|
||||
if (!tens.every(function (value) { return value === 10; }))
|
||||
return "Fail 1";
|
||||
if (!(new Class() instanceof Class))
|
||||
return "Fail 2";
|
||||
if (!(new Class.publicClass() instanceof Class.publicClass))
|
||||
return "Fail 3";
|
||||
return "OK";
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
"use strict";
|
||||
var Class = JS_TESTS.Class;
|
||||
function box() {
|
||||
var tens = [
|
||||
JS_TESTS.publicVal,
|
||||
JS_TESTS.publicFun(),
|
||||
new JS_TESTS.Class().publicVal,
|
||||
new JS_TESTS.Class().publicFun()
|
||||
];
|
||||
if (!tens.every(function (value) { return value === 10; }))
|
||||
return "Fail 1";
|
||||
if (!(new Class() instanceof Class))
|
||||
return "Fail 2";
|
||||
if (!(new Class.publicClass() instanceof Class.publicClass))
|
||||
return "Fail 3";
|
||||
return "OK";
|
||||
}
|
||||
Reference in New Issue
Block a user