summaryrefslogtreecommitdiff
path: root/scalalib/test/resources/hello-world/src
diff options
context:
space:
mode:
authorLi Haoyi <haoyi.sg@gmail.com>2018-01-20 03:49:17 -0800
committerLi Haoyi <haoyi.sg@gmail.com>2018-01-20 03:49:17 -0800
commitd14f56a3fd881f809e58783c49866d1491a5f3fe (patch)
tree4a9f93d3d7f69211aa444ce15837fe6e79b9db7f /scalalib/test/resources/hello-world/src
parentaebd7a144fab5bdb95f6ee4f4bc170be65cd0549 (diff)
downloadmill-d14f56a3fd881f809e58783c49866d1491a5f3fe.tar.gz
mill-d14f56a3fd881f809e58783c49866d1491a5f3fe.tar.bz2
mill-d14f56a3fd881f809e58783c49866d1491a5f3fe.zip
Swap over to simplified Mill module/source layout from SBT's
Removes a lot of useless folders and gives us a chance to exercise this simplified layout. Support for the SBT layout is still verified by our integration tests
Diffstat (limited to 'scalalib/test/resources/hello-world/src')
-rw-r--r--scalalib/test/resources/hello-world/src/Main.scala12
-rw-r--r--scalalib/test/resources/hello-world/src/Result.scala7
2 files changed, 19 insertions, 0 deletions
diff --git a/scalalib/test/resources/hello-world/src/Main.scala b/scalalib/test/resources/hello-world/src/Main.scala
new file mode 100644
index 00000000..14139d6f
--- /dev/null
+++ b/scalalib/test/resources/hello-world/src/Main.scala
@@ -0,0 +1,12 @@
+import scala.collection._ // unused import to check unused imports warning
+import java.nio.file.{Files, Paths}
+
+object Main extends App {
+
+ val person = Person.fromString("rockjam:25")
+ val greeting = s"hello ${person.name}, your age is: ${person.age}"
+ println(greeting)
+ val resultPath = Paths.get(args(0))
+ Files.createDirectories(resultPath.getParent)
+ Files.write(resultPath, greeting.getBytes)
+}
diff --git a/scalalib/test/resources/hello-world/src/Result.scala b/scalalib/test/resources/hello-world/src/Result.scala
new file mode 100644
index 00000000..d7d29a51
--- /dev/null
+++ b/scalalib/test/resources/hello-world/src/Result.scala
@@ -0,0 +1,7 @@
+object Person {
+ def fromString(s: String): Person = {
+ val Array(name, age) = s.split(":")
+ Person(name, age.toInt)
+ }
+}
+case class Person(name: String, age: Int)