[Wasm] Add JS box/native tests
This commit is contained in:
@@ -39,6 +39,7 @@ fun main(args: Array<String>) {
|
||||
testClass<AbstractJsTranslatorWasmTest> {
|
||||
model("box/main", pattern = "^([^_](.+))\\.kt$", targetBackend = TargetBackend.WASM)
|
||||
model("box/kotlin.test/", pattern = "^([^_](.+))\\.kt$", targetBackend = TargetBackend.WASM)
|
||||
model("box/native/", pattern = "^([^_](.+))\\.kt$", targetBackend = TargetBackend.WASM)
|
||||
}
|
||||
|
||||
testClass<AbstractIrBoxJsES6Test> {
|
||||
|
||||
@@ -86,6 +86,11 @@ abstract class BasicWasmBoxTest(
|
||||
}
|
||||
}
|
||||
|
||||
val additionalJsFile = filePath.removeSuffix(".kt") + ".js"
|
||||
if (File(additionalJsFile).exists()) {
|
||||
jsFilesBefore += additionalJsFile
|
||||
}
|
||||
|
||||
val localCommonFile = file.parent + "/" + COMMON_FILES_NAME + "." + KotlinFileType.EXTENSION
|
||||
val localCommonFiles = if (File(localCommonFile).exists()) listOf(localCommonFile) else emptyList()
|
||||
|
||||
|
||||
js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/JsTranslatorWasmTestGenerated.java
Generated
+128
@@ -130,4 +130,132 @@ public class JsTranslatorWasmTestGenerated extends AbstractJsTranslatorWasmTest
|
||||
runTest("js/js.translator/testData/box/kotlin.test/simple.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("js/js.translator/testData/box/native")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class Native extends AbstractJsTranslatorWasmTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest0(this::doTest, TargetBackend.WASM, testDataFilePath);
|
||||
}
|
||||
|
||||
@TestMetadata("accessToCompanionObjectFromInlineFun.kt")
|
||||
public void testAccessToCompanionObjectFromInlineFun() throws Exception {
|
||||
runTest("js/js.translator/testData/box/native/accessToCompanionObjectFromInlineFun.kt");
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInNative() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("js/js.translator/testData/box/native"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.WASM, true);
|
||||
}
|
||||
|
||||
@TestMetadata("castToNativeClassChecked.kt")
|
||||
public void testCastToNativeClassChecked() throws Exception {
|
||||
runTest("js/js.translator/testData/box/native/castToNativeClassChecked.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("castToNativeInterface.kt")
|
||||
public void testCastToNativeInterface() throws Exception {
|
||||
runTest("js/js.translator/testData/box/native/castToNativeInterface.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("castToNativeInterfaceChecked.kt")
|
||||
public void testCastToNativeInterfaceChecked() throws Exception {
|
||||
runTest("js/js.translator/testData/box/native/castToNativeInterfaceChecked.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("castToNullableNativeInterface.kt")
|
||||
public void testCastToNullableNativeInterface() throws Exception {
|
||||
runTest("js/js.translator/testData/box/native/castToNullableNativeInterface.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("castToTypeParamBoundedByNativeInterface.kt")
|
||||
public void testCastToTypeParamBoundedByNativeInterface() throws Exception {
|
||||
runTest("js/js.translator/testData/box/native/castToTypeParamBoundedByNativeInterface.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("class.kt")
|
||||
public void testClass() throws Exception {
|
||||
runTest("js/js.translator/testData/box/native/class.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("classObject.kt")
|
||||
public void testClassObject() throws Exception {
|
||||
runTest("js/js.translator/testData/box/native/classObject.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt2209.kt")
|
||||
public void testKt2209() throws Exception {
|
||||
runTest("js/js.translator/testData/box/native/kt2209.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("nestedElements.kt")
|
||||
public void testNestedElements() throws Exception {
|
||||
runTest("js/js.translator/testData/box/native/nestedElements.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("objectFunWithVararg.kt")
|
||||
public void testObjectFunWithVararg() throws Exception {
|
||||
runTest("js/js.translator/testData/box/native/objectFunWithVararg.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("passExtLambdaToNative.kt")
|
||||
public void testPassExtLambdaToNative() throws Exception {
|
||||
runTest("js/js.translator/testData/box/native/passExtLambdaToNative.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("passMemberOrExtFromNative.kt")
|
||||
public void testPassMemberOrExtFromNative() throws Exception {
|
||||
runTest("js/js.translator/testData/box/native/passMemberOrExtFromNative.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("passMemberOrExtToNative.kt")
|
||||
public void testPassMemberOrExtToNative() throws Exception {
|
||||
runTest("js/js.translator/testData/box/native/passMemberOrExtToNative.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("passTopLevelFunctionFromNative.kt")
|
||||
public void testPassTopLevelFunctionFromNative() throws Exception {
|
||||
runTest("js/js.translator/testData/box/native/passTopLevelFunctionFromNative.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("passTopLevelOrLocalFunctionToNative.kt")
|
||||
public void testPassTopLevelOrLocalFunctionToNative() throws Exception {
|
||||
runTest("js/js.translator/testData/box/native/passTopLevelOrLocalFunctionToNative.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("privateExternal.kt")
|
||||
public void testPrivateExternal() throws Exception {
|
||||
runTest("js/js.translator/testData/box/native/privateExternal.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("safeCastToNativeInterface.kt")
|
||||
public void testSafeCastToNativeInterface() throws Exception {
|
||||
runTest("js/js.translator/testData/box/native/safeCastToNativeInterface.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("secondaryConstructor.kt")
|
||||
public void testSecondaryConstructor() throws Exception {
|
||||
runTest("js/js.translator/testData/box/native/secondaryConstructor.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simple.kt")
|
||||
public void testSimple() throws Exception {
|
||||
runTest("js/js.translator/testData/box/native/simple.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simpleUndefined.kt")
|
||||
public void testSimpleUndefined() throws Exception {
|
||||
runTest("js/js.translator/testData/box/native/simpleUndefined.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("useClassFromInlineFun.kt")
|
||||
public void testUseClassFromInlineFun() throws Exception {
|
||||
runTest("js/js.translator/testData/box/native/useClassFromInlineFun.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("vararg.kt")
|
||||
public void testVararg() throws Exception {
|
||||
runTest("js/js.translator/testData/box/native/vararg.kt");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// DONT_TARGET_EXACT_BACKEND: WASM
|
||||
// WASM_MUTE_REASON: CLASS_EXPORT
|
||||
// IGNORE_BACKEND: JS_IR_ES6
|
||||
// EXPECTED_REACHABLE_NODES: 1294
|
||||
package foo
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// DONT_TARGET_EXACT_BACKEND: WASM
|
||||
// WASM_MUTE_REASON: UNSUPPORTED_JS_INTEROP
|
||||
// EXPECTED_REACHABLE_NODES: 1290
|
||||
data class A(val number: Int)
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// DONT_TARGET_EXACT_BACKEND: WASM
|
||||
// WASM_MUTE_REASON: UNSUPPORTED_JS_INTEROP
|
||||
// SKIP_MINIFICATION
|
||||
|
||||
val top = "TOP LEVEL"
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// DONT_TARGET_EXACT_BACKEND: WASM
|
||||
// WASM_MUTE_REASON: UNSUPPORTED_JS_INTEROP
|
||||
// EXPECTED_REACHABLE_NODES: 1281
|
||||
external class TypeError(message: String?, fileName: String? = definedExternally, lineNumber: Int? = definedExternally) : Throwable
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// DONT_TARGET_EXACT_BACKEND: WASM
|
||||
// WASM_MUTE_REASON: UNSUPPORTED_JS_INTEROP
|
||||
// KT-46961
|
||||
// IGNORE_BACKEND: JS
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// DONT_TARGET_EXACT_BACKEND: WASM
|
||||
// WASM_MUTE_REASON: UNSUPPORTED_JS_INTEROP
|
||||
// EXPECTED_REACHABLE_NODES: 1298
|
||||
package foo
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// DONT_TARGET_EXACT_BACKEND: WASM
|
||||
// WASM_MUTE_REASON: IMPLEMENTING_EXTERNAL_INTERFACE
|
||||
// EXPECTED_REACHABLE_NODES: 1297
|
||||
package foo
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// DONT_TARGET_EXACT_BACKEND: WASM
|
||||
// WASM_MUTE_REASON: CLASS_EXPORT
|
||||
// SKIP_MINIFICATION
|
||||
// Contains calls from external JS code
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// DONT_TARGET_EXACT_BACKEND: WASM
|
||||
// WASM_MUTE_REASON: UNSUPPORTED_JS_INTEROP
|
||||
// DONT_TARGET_EXACT_BACKEND: JS_IR
|
||||
// DONT_TARGET_EXACT_BACKEND: JS_IR_ES6
|
||||
// EXPECTED_REACHABLE_NODES: 1282
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// DONT_TARGET_EXACT_BACKEND: WASM
|
||||
// WASM_MUTE_REASON: UNSUPPORTED_JS_INTEROP
|
||||
// EXPECTED_REACHABLE_NODES: 1283
|
||||
//FILE: nativeClassAsReifiedTypeArgument.kt
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// DONT_TARGET_EXACT_BACKEND: WASM
|
||||
// WASM_MUTE_REASON: UNSUPPORTED_JS_INTEROP
|
||||
// EXPECTED_REACHABLE_NODES: 1291
|
||||
package foo
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// DONT_TARGET_EXACT_BACKEND: WASM
|
||||
// WASM_MUTE_REASON: UNSUPPORTED_JS_INTEROP
|
||||
// EXPECTED_REACHABLE_NODES: 1244
|
||||
package foo
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// IGNORE_BACKEND: WASM
|
||||
// EXPECTED_REACHABLE_NODES: 1310
|
||||
package foo
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// IGNORE_BACKEND: WASM
|
||||
// EXPECTED_REACHABLE_NODES: 1281
|
||||
import Test.test
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// DONT_TARGET_EXACT_BACKEND: WASM
|
||||
// WASM_MUTE_REASON: UNSUPPORTED_JS_INTEROP
|
||||
// EXPECTED_REACHABLE_NODES: 1304
|
||||
external open class A {
|
||||
open fun f(x: Int): String = definedExternally
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// DONT_TARGET_EXACT_BACKEND: WASM
|
||||
// WASM_MUTE_REASON: UNSUPPORTED_JS_INTEROP
|
||||
// IGNORE_BACKEND: JS_IR
|
||||
// IGNORE_BACKEND: JS_IR_ES6
|
||||
// EXPECTED_REACHABLE_NODES: 1285
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// IGNORE_BACKEND: JS_IR_ES6
|
||||
// TODO: Unmute when extension functions are supported in external declarations.
|
||||
// IGNORE_BACKEND: JS
|
||||
// IGNORE_BACKEND: WASM
|
||||
|
||||
package foo
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// IGNORE_BACKEND: WASM
|
||||
// EXPECTED_REACHABLE_NODES: 1285
|
||||
package foo
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// IGNORE_BACKEND: JS_IR_ES6
|
||||
// TODO: Unmute when extension functions are supported in external declarations.
|
||||
// IGNORE_BACKEND: JS
|
||||
// IGNORE_BACKEND: WASM
|
||||
|
||||
package foo
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// DONT_TARGET_EXACT_BACKEND: WASM
|
||||
// WASM_MUTE_REASON: UNSUPPORTED_JS_INTEROP
|
||||
// IGNORE_BACKEND: JS_IR
|
||||
// IGNORE_BACKEND: JS_IR_ES6
|
||||
// KJS_WITH_FULL_RUNTIME
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// IGNORE_BACKEND: WASM
|
||||
// EXPECTED_REACHABLE_NODES: 1285
|
||||
package foo
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// IGNORE_BACKEND: WASM
|
||||
// EXPECTED_REACHABLE_NODES: 1281
|
||||
package foo
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// DONT_TARGET_EXACT_BACKEND: WASM
|
||||
// WASM_MUTE_REASON: UNSUPPORTED_JS_INTEROP
|
||||
// EXPECTED_REACHABLE_NODES: 1286
|
||||
package foo
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// DONT_TARGET_EXACT_BACKEND: WASM
|
||||
// WASM_MUTE_REASON: UNSUPPORTED_JS_INTEROP
|
||||
// EXPECTED_REACHABLE_NODES: 1288
|
||||
package foo
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// IGNORE_BACKEND: WASM
|
||||
// EXPECTED_REACHABLE_NODES: 1282
|
||||
// FILE: main.kt
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// IGNORE_BACKEND: WASM
|
||||
// EXPECTED_REACHABLE_NODES: 1314
|
||||
package foo
|
||||
|
||||
|
||||
Reference in New Issue
Block a user