diff options
author | Li Haoyi <haoyi.sg@gmail.com> | 2019-11-17 14:58:37 -0800 |
---|---|---|
committer | Li Haoyi <haoyi.sg@gmail.com> | 2019-11-17 14:58:37 -0800 |
commit | 4e5fec34f11e0fa7678c8f7dd6beae754c4ce3fd (patch) | |
tree | 2ffc9c8be31d595f41d66f5d450d56a7cdf5922a | |
parent | 5c81eea50539b0d5d4e3593a61dea101d2e471ce (diff) | |
download | mill-4e5fec34f11e0fa7678c8f7dd6beae754c4ce3fd.tar.gz mill-4e5fec34f11e0fa7678c8f7dd6beae754c4ce3fd.tar.bz2 mill-4e5fec34f11e0fa7678c8f7dd6beae754c4ce3fd.zip |
update docs to add a example with test suite
-rw-r--r-- | docs/build.sc | 5 | ||||
-rw-r--r-- | docs/example-1/build.sc | 2 | ||||
-rw-r--r-- | docs/example-2/build.sc | 2 | ||||
-rw-r--r-- | docs/example-3/build.sc | 10 | ||||
-rw-r--r-- | docs/example-3/foo/src/Example.scala | 4 | ||||
-rw-r--r-- | docs/example-3/foo/test/src/ExampleTests.scala | 11 | ||||
-rw-r--r-- | docs/pages/2 - Configuring Mill.md | 10 |
7 files changed, 38 insertions, 6 deletions
diff --git a/docs/build.sc b/docs/build.sc index c0303136..340e5ce8 100644 --- a/docs/build.sc +++ b/docs/build.sc @@ -148,7 +148,12 @@ def main(publish: Boolean = false) = { os.copy(os.pwd/"VisualizePlan.svg", targetFolder/"VisualizePlan.svg") os.proc('zip, "-r", targetFolder/"example-1.zip", "example-1").call() + os.proc('zip, "-ur", targetFolder/"example-1.zip", "../mill").call() os.proc('zip, "-r", targetFolder/"example-2.zip", "example-2").call() + os.proc('zip, "-ur", targetFolder/"example-2.zip", "../mill").call() + os.proc('zip, "-r", targetFolder/"example-3.zip", "example-3").call() + os.proc('zip, "-ur", targetFolder/"example-3.zip", "../mill").call() + for(i <- posts.indices){ val post = posts(i) diff --git a/docs/example-1/build.sc b/docs/example-1/build.sc index fa3b5d29..6d4d6d81 100644 --- a/docs/example-1/build.sc +++ b/docs/example-1/build.sc @@ -2,5 +2,5 @@ import mill._, scalalib._ object foo extends ScalaModule{ - def scalaVersion = "2.12.4" + def scalaVersion = "2.13.1" }
\ No newline at end of file diff --git a/docs/example-2/build.sc b/docs/example-2/build.sc index eb74f10c..9a3848b2 100644 --- a/docs/example-2/build.sc +++ b/docs/example-2/build.sc @@ -2,7 +2,7 @@ import mill._, scalalib._, publish._ object foo extends ScalaModule with PublishModule { - def scalaVersion = "2.12.4" + def scalaVersion = "2.13.1" def publishVersion = "0.0.1" def pomSettings = PomSettings( diff --git a/docs/example-3/build.sc b/docs/example-3/build.sc new file mode 100644 index 00000000..7e40a964 --- /dev/null +++ b/docs/example-3/build.sc @@ -0,0 +1,10 @@ +// build.sc +import mill._, scalalib._ + +object foo extends ScalaModule{ + def scalaVersion = "2.13.1" + object test extends Tests{ + def ivyDeps = Agg(ivy"com.lihaoyi::utest::0.7.1") + def testFrameworks = Seq("utest.runner.Framework") + } +}
\ No newline at end of file diff --git a/docs/example-3/foo/src/Example.scala b/docs/example-3/foo/src/Example.scala new file mode 100644 index 00000000..a7511558 --- /dev/null +++ b/docs/example-3/foo/src/Example.scala @@ -0,0 +1,4 @@ +package foo +object Example{ + def hello(): String = "Hello World" +}
\ No newline at end of file diff --git a/docs/example-3/foo/test/src/ExampleTests.scala b/docs/example-3/foo/test/src/ExampleTests.scala new file mode 100644 index 00000000..52df8c96 --- /dev/null +++ b/docs/example-3/foo/test/src/ExampleTests.scala @@ -0,0 +1,11 @@ +package foo +import utest._ +object ExampleTests extends TestSuite{ + def tests = Tests{ + test("hello"){ + val result = Example.hello() + assert(result == "Hello World") + result + } + } +}
\ No newline at end of file diff --git a/docs/pages/2 - Configuring Mill.md b/docs/pages/2 - Configuring Mill.md index 0df98a5c..1654d685 100644 --- a/docs/pages/2 - Configuring Mill.md +++ b/docs/pages/2 - Configuring Mill.md @@ -99,15 +99,17 @@ object YourBuild extends ScalaModule { import mill._, scalalib._ object foo extends ScalaModule { - def scalaVersion = "2.12.4" + def scalaVersion = "2.13.1" object test extends Tests { - def ivyDeps = Agg(ivy"com.lihaoyi::utest:0.6.0") + def ivyDeps = Agg(ivy"com.lihaoyi::utest:0.7.1") def testFrameworks = Seq("utest.runner.Framework") } } ``` +- [Example 3](example-3.zip) + You can define a test suite by creating a nested module extending `Tests`, and specifying the ivy coordinates and name of your test framework. This expects the tests to be laid out as follows: @@ -116,12 +118,12 @@ tests to be laid out as follows: build.sc foo/ src/ - Main.scala + Example.scala resources/ ... test/ src/ - MainTest.scala + ExampleTest.scala resources/ ... out/ |