summaryrefslogtreecommitdiff
path: root/scalaplugin/src/test/scala/mill/scalaplugin/HelloWorldTests.scala
diff options
context:
space:
mode:
authorrockjam <5min4eq.unity@gmail.com>2017-11-29 19:29:03 +0300
committerrockjam <5min4eq.unity@gmail.com>2017-11-30 13:30:45 +0300
commit2ac4cb2263812d2edc16faaf376b0386b990144e (patch)
treec86fbb56158eea299a13c3aa8f1d3ebd1f620e86 /scalaplugin/src/test/scala/mill/scalaplugin/HelloWorldTests.scala
parent2222c14b405e5f2c429380293ed8165cb84fa156 (diff)
downloadmill-2ac4cb2263812d2edc16faaf376b0386b990144e.tar.gz
mill-2ac4cb2263812d2edc16faaf376b0386b990144e.tar.bz2
mill-2ac4cb2263812d2edc16faaf376b0386b990144e.zip
implment runMain command
Diffstat (limited to 'scalaplugin/src/test/scala/mill/scalaplugin/HelloWorldTests.scala')
-rw-r--r--scalaplugin/src/test/scala/mill/scalaplugin/HelloWorldTests.scala25
1 files changed, 24 insertions, 1 deletions
diff --git a/scalaplugin/src/test/scala/mill/scalaplugin/HelloWorldTests.scala b/scalaplugin/src/test/scala/mill/scalaplugin/HelloWorldTests.scala
index f4a4e993..f2a428e5 100644
--- a/scalaplugin/src/test/scala/mill/scalaplugin/HelloWorldTests.scala
+++ b/scalaplugin/src/test/scala/mill/scalaplugin/HelloWorldTests.scala
@@ -40,6 +40,7 @@ object HelloWorldTests extends TestSuite {
TestEvaluator.eval(mapping, outputPath)(t)
val helloWorldMapping = Discovered.mapping(HelloWorld)
+ val helloWorldWithMainMapping = Discovered.mapping(HelloWorldWithMain)
def tests: Tests = Tests {
prepareWorkspace()
@@ -178,6 +179,28 @@ object HelloWorldTests extends TestSuite {
)
}
}
+ 'runMain - {
+ 'runIfMainClassProvided - {
+ val Right((_, evalCount)) =
+ eval(HelloWorldWithMain.runMain(), helloWorldWithMainMapping)
+
+ assert(evalCount > 0)
+
+ val runResult = workspacePath / "hello-mill"
+ assert(
+ exists(runResult),
+ read(runResult) == "hello rockjam, your age is: 25"
+ )
+ }
+ 'notRunWithoutMainClass - {
+ val Left(Result.Exception(err)) =
+ eval(HelloWorld.runMain(), helloWorldMapping)
+
+ assert(
+ err.isInstanceOf[RuntimeException]
+ )
+ }
+ }
'jar - {
'nonEmpty - {
val Right((result, evalCount)) =
@@ -206,7 +229,7 @@ object HelloWorldTests extends TestSuite {
}
'runJar - {
val Right((result, evalCount)) =
- eval(HelloWorldWithMain.jar, Discovered.mapping(HelloWorldWithMain))
+ eval(HelloWorldWithMain.jar, helloWorldWithMainMapping)
assert(
exists(result.path),