diff options
author | Li Haoyi <haoyi.sg@gmail.com> | 2018-02-17 11:53:48 -0800 |
---|---|---|
committer | Li Haoyi <haoyi.sg@gmail.com> | 2018-02-17 11:53:48 -0800 |
commit | 865045540bd80bebb1655005abf32bc089c33895 (patch) | |
tree | 694178964ec1f8f8af821f854655865cd9cd8612 /scalalib/test | |
parent | 92edcae5094e52783f825021e4172a6b072300e0 (diff) | |
parent | 4cae6ff8a1111bb6c4bc6a44e67bd0affdbb9792 (diff) | |
download | mill-865045540bd80bebb1655005abf32bc089c33895.tar.gz mill-865045540bd80bebb1655005abf32bc089c33895.tar.bz2 mill-865045540bd80bebb1655005abf32bc089c33895.zip |
Merge branch '130'
Diffstat (limited to 'scalalib/test')
-rw-r--r-- | scalalib/test/src/mill/scalalib/HelloWorldTests.scala | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/scalalib/test/src/mill/scalalib/HelloWorldTests.scala b/scalalib/test/src/mill/scalalib/HelloWorldTests.scala index 1d39f180..945bec27 100644 --- a/scalalib/test/src/mill/scalalib/HelloWorldTests.scala +++ b/scalalib/test/src/mill/scalalib/HelloWorldTests.scala @@ -33,6 +33,15 @@ object HelloWorldTests extends TestSuite { class HelloWorldCross(val crossScalaVersion: String) extends CrossScalaModule } + object HelloWorldDefaultMain extends HelloBase { + object core extends HelloWorldModule + } + + object HelloWorldWithoutMain extends HelloBase { + object core extends HelloWorldModule{ + def mainClass = None + } + } object HelloWorldWithMain extends HelloBase { object core extends HelloWorldModule{ @@ -291,8 +300,8 @@ object HelloWorldTests extends TestSuite { read(runResult) == "hello rockjam, your age is: 25" ) } - 'notRunWithoutMainClass - workspaceTest(HelloWorld){eval => - val Left(Result.Exception(err, _)) = eval.apply(HelloWorld.core.run()) + 'notRunWithoutMainClass - workspaceTest(HelloWorldWithoutMain){eval => + val Left(Result.Exception(err, _)) = eval.apply(HelloWorldWithoutMain.core.run()) assert( err.isInstanceOf[RuntimeException] @@ -314,8 +323,22 @@ object HelloWorldTests extends TestSuite { read(runResult) == "hello rockjam, your age is: 25" ) } - 'notRunWithoutMainClass - workspaceTest(HelloWorld){eval => - val Left(Result.Exception(err, _)) = eval.apply(HelloWorld.core.runLocal()) + 'runWithDefaultMain - workspaceTest(HelloWorldDefaultMain){eval => + val runResult = eval.outPath / 'core / 'run / 'dest / "hello-mill" + val Right((_, evalCount)) = eval.apply( + HelloWorldDefaultMain.core.runLocal(runResult.toString) + ) + + assert(evalCount > 0) + + + assert( + exists(runResult), + read(runResult) == "hello rockjam, your age is: 25" + ) + } + 'notRunWithoutMainClass - workspaceTest(HelloWorldWithoutMain){eval => + val Left(Result.Exception(err, _)) = eval.apply(HelloWorldWithoutMain.core.runLocal()) assert( err.isInstanceOf[RuntimeException] |