diff options
author | Som Snytt <som.snytt@gmail.com> | 2016-05-16 16:24:50 -0700 |
---|---|---|
committer | Som Snytt <som.snytt@gmail.com> | 2016-05-16 21:08:44 -0700 |
commit | 73ca44be579e5100706d174f18025fc4487e9cb9 (patch) | |
tree | c68b732b86ac053419d859b8cb107b24bac4586b /test | |
parent | b3f8332cf399cd15067c879c8297c25598045883 (diff) | |
download | scala-73ca44be579e5100706d174f18025fc4487e9cb9.tar.gz scala-73ca44be579e5100706d174f18025fc4487e9cb9.tar.bz2 scala-73ca44be579e5100706d174f18025fc4487e9cb9.zip |
SI-4625 Recognize App in script
Cheap name test: if the script object extends "App",
take it for a main-bearing parent.
Note that if `-Xscript` is not `Main`, the default,
then the source is taken as a snippet and there is
no attempt to locate an existing `main` method.
Diffstat (limited to 'test')
-rw-r--r-- | test/files/run/t4625.check | 1 | ||||
-rw-r--r-- | test/files/run/t4625.scala | 7 | ||||
-rw-r--r-- | test/files/run/t4625.script | 5 |
3 files changed, 13 insertions, 0 deletions
diff --git a/test/files/run/t4625.check b/test/files/run/t4625.check new file mode 100644 index 0000000000..e4a4d15b87 --- /dev/null +++ b/test/files/run/t4625.check @@ -0,0 +1 @@ +Test ran. diff --git a/test/files/run/t4625.scala b/test/files/run/t4625.scala new file mode 100644 index 0000000000..44f6225220 --- /dev/null +++ b/test/files/run/t4625.scala @@ -0,0 +1,7 @@ + +import scala.tools.partest.ScriptTest + +object Test extends ScriptTest { + // must be called Main to get probing treatment in parser + override def testmain = "Main" +} diff --git a/test/files/run/t4625.script b/test/files/run/t4625.script new file mode 100644 index 0000000000..600ceacbb6 --- /dev/null +++ b/test/files/run/t4625.script @@ -0,0 +1,5 @@ + +object Main extends Runnable with App { + def run() = println("Test ran.") + run() +} |