Entry point selection.

$ kotlinc -entry foo.bar.qux ...

selects `qux(args: Array<String>):Unit` in the package `foo.bar` as an entry point.

The short flag is `-e`.
This commit is contained in:
Alexander Gorshenev
2017-06-01 18:45:54 +03:00
committed by alexander-gorshenev
parent a2fa4938f3
commit 5192bd1313
11 changed files with 205 additions and 3 deletions
+19
View File
@@ -371,6 +371,25 @@ task hello4(type: RunKonanTest) {
source = "runtime/basic/hello4.kt"
}
task entry0(type: RunKonanTest) {
goldValue = "Hello.\n"
source = "runtime/basic/entry0.kt"
flags = ["-entry", "koko.lala.main"]
}
task entry1(type: RunKonanTest) {
goldValue = "Hello.\n"
source = "runtime/basic/entry1.kt"
flags = ["-entry", "foo"]
}
task entry2(type: LinkKonanTest) {
goldValue = "Hello.\n"
source = "runtime/basic/entry2.kt"
lib = "runtime/basic/libentry2.kt"
flags = ["-entry", "foo"]
}
task tostring0(type: RunKonanTest) {
goldValue = "127\n-1\n239\nA\nЁ\nト\n1122334455\n112233445566778899\n3.14159265358\n1.0E27\n1.0E-300\ntrue\nfalse\n"
source = "runtime/basic/tostring0.kt"
@@ -0,0 +1,32 @@
package koko.lala
fun fail() {
println("Test failed, this is a wrong main() function.")
}
fun main() {
fail()
}
fun <T> main(args: Array<String>) {
fail()
}
fun main(args: Array<Int>) {
fail()
}
fun main(args: Array<String>, second_arg: Int) {
fail()
}
class Foo {
fun main(args: Array<String>) {
fail()
}
}
fun main(args: Array<String>) {
println("Hello.")
}
@@ -0,0 +1,13 @@
fun fail() {
println("Test failed, this is a wrong main() function.")
}
fun foo(args: Array<String>) {
println("Hello.")
}
fun main(args: Array<String>) {
fail()
}
@@ -0,0 +1,4 @@
fun main(args: Array<String>) {
fail()
}
@@ -0,0 +1,8 @@
fun fail() {
println("Test failed, this is a wrong main() function.")
}
fun foo(args: Array<String>) {
println("Hello.")
}