[JS IR] Add test in external js fun with default args

^KT-40090 fixed
This commit is contained in:
Ilya Goncharov
2020-11-18 19:26:19 +03:00
parent 8eb2ae18dc
commit 5c731c6c04
3 changed files with 35 additions and 0 deletions
@@ -0,0 +1,25 @@
// TARGET_BACKEND: JS_IR
// CALL_MAIN
external fun create(
p0: String = definedExternally,
p1: String = definedExternally,
p2: String = definedExternally,
p3: String = definedExternally,
p4: String = definedExternally,
) : Array<String>
fun main() {
js("global.create = function() {return arguments}")
}
fun box(): String {
val zeroArgs = create()
if (zeroArgs.size != 0) return "fail: $zeroArgs arguments instead 0"
val p2 = "p2"
val threeArgs = create(p2 = p2)
if (threeArgs.size != 3 || threeArgs[2] != p2) return "fail: $threeArgs arguments instead 3"
return "OK"
}
@@ -10077,6 +10077,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes
public void testAllFilesPresentInExternal() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/external"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true);
}
@TestMetadata("jsWithDefaultArg.kt")
public void testJsWithDefaultArg() throws Exception {
runTest("compiler/testData/codegen/box/external/jsWithDefaultArg.kt");
}
}
@TestMetadata("compiler/testData/codegen/box/fakeOverride")
@@ -10077,6 +10077,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
public void testAllFilesPresentInExternal() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/external"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true);
}
@TestMetadata("jsWithDefaultArg.kt")
public void testJsWithDefaultArg() throws Exception {
runTest("compiler/testData/codegen/box/external/jsWithDefaultArg.kt");
}
}
@TestMetadata("compiler/testData/codegen/box/fakeOverride")