[JS IR BE] Add tests for main function
This commit is contained in:
+10
@@ -5238,6 +5238,11 @@ public class IrBoxJsTestGenerated extends AbstractIrBoxJsTest {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/box/main"), Pattern.compile("^([^_](.+))\\.kt$"), TargetBackend.JS_IR, true);
|
||||
}
|
||||
|
||||
@TestMetadata("differentMains.kt")
|
||||
public void testDifferentMains() throws Exception {
|
||||
runTest("js/js.translator/testData/box/main/differentMains.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("incremental.kt")
|
||||
public void testIncremental() throws Exception {
|
||||
runTest("js/js.translator/testData/box/main/incremental.kt");
|
||||
@@ -5267,6 +5272,11 @@ public class IrBoxJsTestGenerated extends AbstractIrBoxJsTest {
|
||||
public void testSuspendMainThrows() throws Exception {
|
||||
runTest("js/js.translator/testData/box/main/suspendMainThrows.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("twoMains.kt")
|
||||
public void testTwoMains() throws Exception {
|
||||
runTest("js/js.translator/testData/box/main/twoMains.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("js/js.translator/testData/box/multiFile")
|
||||
|
||||
+10
@@ -5243,6 +5243,11 @@ public class BoxJsTestGenerated extends AbstractBoxJsTest {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/box/main"), Pattern.compile("^([^_](.+))\\.kt$"), TargetBackend.JS, true);
|
||||
}
|
||||
|
||||
@TestMetadata("differentMains.kt")
|
||||
public void testDifferentMains() throws Exception {
|
||||
runTest("js/js.translator/testData/box/main/differentMains.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("incremental.kt")
|
||||
public void testIncremental() throws Exception {
|
||||
runTest("js/js.translator/testData/box/main/incremental.kt");
|
||||
@@ -5272,6 +5277,11 @@ public class BoxJsTestGenerated extends AbstractBoxJsTest {
|
||||
public void testSuspendMainThrows() throws Exception {
|
||||
runTest("js/js.translator/testData/box/main/suspendMainThrows.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("twoMains.kt")
|
||||
public void testTwoMains() throws Exception {
|
||||
runTest("js/js.translator/testData/box/main/twoMains.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("js/js.translator/testData/box/multiFile")
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
// EXPECTED_REACHABLE_NODES: 1281
|
||||
// CALL_MAIN
|
||||
|
||||
var ok: String = "OK"
|
||||
|
||||
fun main(args: Array<Int>) {
|
||||
ok += "Fail Int"
|
||||
}
|
||||
|
||||
fun main(args: Array<String?>) {
|
||||
ok += "Fail String?"
|
||||
}
|
||||
|
||||
fun main(args: Array<in String>) {
|
||||
ok += "Fail IN"
|
||||
}
|
||||
|
||||
fun main(args: Array<String>): Unit? {
|
||||
ok += "Fail return Unit?"
|
||||
return Unit
|
||||
}
|
||||
|
||||
fun box() = ok
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
// EXPECTED_REACHABLE_NODES: 1281
|
||||
// CALL_MAIN
|
||||
|
||||
var o: String = "fail O"
|
||||
var k: String = "K"
|
||||
|
||||
fun main() {
|
||||
k = "fail K"
|
||||
}
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
assertEquals(1, args.size)
|
||||
assertEquals("testArg", args[0])
|
||||
|
||||
o = "O"
|
||||
}
|
||||
|
||||
fun box() = o + k
|
||||
Reference in New Issue
Block a user