[JS IR BE] Add tests for main function

This commit is contained in:
Roman Artemev
2019-04-26 11:57:51 +03:00
committed by romanart
parent 5bd3bcd237
commit 023306b1b3
4 changed files with 61 additions and 0 deletions
@@ -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")
@@ -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")
+23
View File
@@ -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
View File
@@ -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