summaryrefslogtreecommitdiff
path: root/example
diff options
context:
space:
mode:
authorLi Haoyi <haoyi.sg@gmail.com>2018-08-13 00:42:18 +0800
committerLi Haoyi <haoyi.sg@gmail.com>2018-08-13 00:45:14 +0800
commiteb32d8d4a1e2bd50e5416fcfefd72dfe6da1a7bb (patch)
tree9b58c66dd7f54624b3d023e10ffa62c2a341feca /example
parentbdf3a1313a171a5a01a8cbec535b7366e4861924 (diff)
downloadcask-eb32d8d4a1e2bd50e5416fcfefd72dfe6da1a7bb.tar.gz
cask-eb32d8d4a1e2bd50e5416fcfefd72dfe6da1a7bb.tar.bz2
cask-eb32d8d4a1e2bd50e5416fcfefd72dfe6da1a7bb.zip
Add scalatags example
Diffstat (limited to 'example')
-rw-r--r--example/compress/build.sc2
-rw-r--r--example/compress2/build.sc2
-rw-r--r--example/compress3/build.sc2
-rw-r--r--example/cookies/build.sc2
-rw-r--r--example/decorated/build.sc2
-rw-r--r--example/decorated2/build.sc2
-rw-r--r--example/formJsonPost/build.sc2
-rw-r--r--example/httpMethods/build.sc2
-rw-r--r--example/minimalApplication/build.sc2
-rw-r--r--example/minimalApplication2/build.sc2
-rw-r--r--example/redirectAbort/build.sc2
-rw-r--r--example/scalatags/app/src/Scalatags.scala15
-rw-r--r--example/scalatags/app/test/src/ExampleTests.scala29
-rw-r--r--example/scalatags/build.sc19
-rw-r--r--example/staticFiles/build.sc2
-rw-r--r--example/todo/app/test/src/ExampleTests.scala (renamed from example/todo/app/test/src/TodoTest.scala)2
-rw-r--r--example/todo/build.sc2
-rw-r--r--example/todoApi/build.sc2
-rw-r--r--example/todoDb/build.sc2
-rw-r--r--example/variableRoutes/build.sc2
20 files changed, 80 insertions, 17 deletions
diff --git a/example/compress/build.sc b/example/compress/build.sc
index 6b3ab3f..2794393 100644
--- a/example/compress/build.sc
+++ b/example/compress/build.sc
@@ -9,7 +9,7 @@ trait AppModule extends ScalaModule{
object test extends Tests{
def testFrameworks = Seq("utest.runner.Framework")
- def forkArgs = Seq("--illegal-access=deny")
+
def ivyDeps = Agg(
ivy"com.lihaoyi::utest::0.6.3",
ivy"com.lihaoyi::requests::0.1.2",
diff --git a/example/compress2/build.sc b/example/compress2/build.sc
index 6b3ab3f..2794393 100644
--- a/example/compress2/build.sc
+++ b/example/compress2/build.sc
@@ -9,7 +9,7 @@ trait AppModule extends ScalaModule{
object test extends Tests{
def testFrameworks = Seq("utest.runner.Framework")
- def forkArgs = Seq("--illegal-access=deny")
+
def ivyDeps = Agg(
ivy"com.lihaoyi::utest::0.6.3",
ivy"com.lihaoyi::requests::0.1.2",
diff --git a/example/compress3/build.sc b/example/compress3/build.sc
index 6b3ab3f..2794393 100644
--- a/example/compress3/build.sc
+++ b/example/compress3/build.sc
@@ -9,7 +9,7 @@ trait AppModule extends ScalaModule{
object test extends Tests{
def testFrameworks = Seq("utest.runner.Framework")
- def forkArgs = Seq("--illegal-access=deny")
+
def ivyDeps = Agg(
ivy"com.lihaoyi::utest::0.6.3",
ivy"com.lihaoyi::requests::0.1.2",
diff --git a/example/cookies/build.sc b/example/cookies/build.sc
index 6b3ab3f..2794393 100644
--- a/example/cookies/build.sc
+++ b/example/cookies/build.sc
@@ -9,7 +9,7 @@ trait AppModule extends ScalaModule{
object test extends Tests{
def testFrameworks = Seq("utest.runner.Framework")
- def forkArgs = Seq("--illegal-access=deny")
+
def ivyDeps = Agg(
ivy"com.lihaoyi::utest::0.6.3",
ivy"com.lihaoyi::requests::0.1.2",
diff --git a/example/decorated/build.sc b/example/decorated/build.sc
index 6b3ab3f..2794393 100644
--- a/example/decorated/build.sc
+++ b/example/decorated/build.sc
@@ -9,7 +9,7 @@ trait AppModule extends ScalaModule{
object test extends Tests{
def testFrameworks = Seq("utest.runner.Framework")
- def forkArgs = Seq("--illegal-access=deny")
+
def ivyDeps = Agg(
ivy"com.lihaoyi::utest::0.6.3",
ivy"com.lihaoyi::requests::0.1.2",
diff --git a/example/decorated2/build.sc b/example/decorated2/build.sc
index 6b3ab3f..2794393 100644
--- a/example/decorated2/build.sc
+++ b/example/decorated2/build.sc
@@ -9,7 +9,7 @@ trait AppModule extends ScalaModule{
object test extends Tests{
def testFrameworks = Seq("utest.runner.Framework")
- def forkArgs = Seq("--illegal-access=deny")
+
def ivyDeps = Agg(
ivy"com.lihaoyi::utest::0.6.3",
ivy"com.lihaoyi::requests::0.1.2",
diff --git a/example/formJsonPost/build.sc b/example/formJsonPost/build.sc
index 6b3ab3f..2794393 100644
--- a/example/formJsonPost/build.sc
+++ b/example/formJsonPost/build.sc
@@ -9,7 +9,7 @@ trait AppModule extends ScalaModule{
object test extends Tests{
def testFrameworks = Seq("utest.runner.Framework")
- def forkArgs = Seq("--illegal-access=deny")
+
def ivyDeps = Agg(
ivy"com.lihaoyi::utest::0.6.3",
ivy"com.lihaoyi::requests::0.1.2",
diff --git a/example/httpMethods/build.sc b/example/httpMethods/build.sc
index 6b3ab3f..2794393 100644
--- a/example/httpMethods/build.sc
+++ b/example/httpMethods/build.sc
@@ -9,7 +9,7 @@ trait AppModule extends ScalaModule{
object test extends Tests{
def testFrameworks = Seq("utest.runner.Framework")
- def forkArgs = Seq("--illegal-access=deny")
+
def ivyDeps = Agg(
ivy"com.lihaoyi::utest::0.6.3",
ivy"com.lihaoyi::requests::0.1.2",
diff --git a/example/minimalApplication/build.sc b/example/minimalApplication/build.sc
index 6b3ab3f..2794393 100644
--- a/example/minimalApplication/build.sc
+++ b/example/minimalApplication/build.sc
@@ -9,7 +9,7 @@ trait AppModule extends ScalaModule{
object test extends Tests{
def testFrameworks = Seq("utest.runner.Framework")
- def forkArgs = Seq("--illegal-access=deny")
+
def ivyDeps = Agg(
ivy"com.lihaoyi::utest::0.6.3",
ivy"com.lihaoyi::requests::0.1.2",
diff --git a/example/minimalApplication2/build.sc b/example/minimalApplication2/build.sc
index 6b3ab3f..2794393 100644
--- a/example/minimalApplication2/build.sc
+++ b/example/minimalApplication2/build.sc
@@ -9,7 +9,7 @@ trait AppModule extends ScalaModule{
object test extends Tests{
def testFrameworks = Seq("utest.runner.Framework")
- def forkArgs = Seq("--illegal-access=deny")
+
def ivyDeps = Agg(
ivy"com.lihaoyi::utest::0.6.3",
ivy"com.lihaoyi::requests::0.1.2",
diff --git a/example/redirectAbort/build.sc b/example/redirectAbort/build.sc
index 6b3ab3f..2794393 100644
--- a/example/redirectAbort/build.sc
+++ b/example/redirectAbort/build.sc
@@ -9,7 +9,7 @@ trait AppModule extends ScalaModule{
object test extends Tests{
def testFrameworks = Seq("utest.runner.Framework")
- def forkArgs = Seq("--illegal-access=deny")
+
def ivyDeps = Agg(
ivy"com.lihaoyi::utest::0.6.3",
ivy"com.lihaoyi::requests::0.1.2",
diff --git a/example/scalatags/app/src/Scalatags.scala b/example/scalatags/app/src/Scalatags.scala
new file mode 100644
index 0000000..600f022
--- /dev/null
+++ b/example/scalatags/app/src/Scalatags.scala
@@ -0,0 +1,15 @@
+package app
+import scalatags.Text.all._
+object Scalatags extends cask.MainRoutes{
+ @cask.get("/")
+ def hello() = {
+ "<!doctype html>" + html(
+ body(
+ h1("Hello World"),
+ p("I am cow")
+ )
+ )
+ }
+
+ initialize()
+}
diff --git a/example/scalatags/app/test/src/ExampleTests.scala b/example/scalatags/app/test/src/ExampleTests.scala
new file mode 100644
index 0000000..8eccecf
--- /dev/null
+++ b/example/scalatags/app/test/src/ExampleTests.scala
@@ -0,0 +1,29 @@
+package app
+import io.undertow.Undertow
+
+import utest._
+
+object ExampleTests extends TestSuite{
+ def test[T](example: cask.main.BaseMain)(f: String => T): T = {
+ val server = Undertow.builder
+ .addHttpListener(8080, "localhost")
+ .setHandler(example.defaultHandler)
+ .build
+ server.start()
+ val res =
+ try f("http://localhost:8080")
+ finally server.stop()
+ res
+ }
+
+ val tests = Tests {
+ 'Scalatags - test(Scalatags) { host =>
+ val body = requests.get(host).text()
+
+ assert(
+ body.contains("<h1>Hello World</h1>"),
+ body.contains("<p>I am cow</p>"),
+ )
+ }
+ }
+}
diff --git a/example/scalatags/build.sc b/example/scalatags/build.sc
new file mode 100644
index 0000000..ff39504
--- /dev/null
+++ b/example/scalatags/build.sc
@@ -0,0 +1,19 @@
+import mill._, scalalib._
+
+
+trait AppModule extends ScalaModule{
+ def scalaVersion = "2.12.6"
+ def ivyDeps = Agg(
+ ivy"com.lihaoyi::cask:0.0.1",
+ ivy"com.lihaoyi::scalatags:0.6.7",
+ )
+
+ object test extends Tests{
+ def testFrameworks = Seq("utest.runner.Framework")
+
+ def ivyDeps = Agg(
+ ivy"com.lihaoyi::utest::0.6.3",
+ ivy"com.lihaoyi::requests::0.1.2",
+ )
+ }
+} \ No newline at end of file
diff --git a/example/staticFiles/build.sc b/example/staticFiles/build.sc
index 6b3ab3f..2794393 100644
--- a/example/staticFiles/build.sc
+++ b/example/staticFiles/build.sc
@@ -9,7 +9,7 @@ trait AppModule extends ScalaModule{
object test extends Tests{
def testFrameworks = Seq("utest.runner.Framework")
- def forkArgs = Seq("--illegal-access=deny")
+
def ivyDeps = Agg(
ivy"com.lihaoyi::utest::0.6.3",
ivy"com.lihaoyi::requests::0.1.2",
diff --git a/example/todo/app/test/src/TodoTest.scala b/example/todo/app/test/src/ExampleTests.scala
index 8f38612..e8ca7eb 100644
--- a/example/todo/app/test/src/TodoTest.scala
+++ b/example/todo/app/test/src/ExampleTests.scala
@@ -1,6 +1,6 @@
package app
import utest._
-object TodoTests extends TestSuite{
+object ExampleTests extends TestSuite{
def test[T](example: cask.main.BaseMain)(f: String => T): T = {
val server = io.undertow.Undertow.builder
.addHttpListener(8080, "localhost")
diff --git a/example/todo/build.sc b/example/todo/build.sc
index b570b3b..77a4dee 100644
--- a/example/todo/build.sc
+++ b/example/todo/build.sc
@@ -11,7 +11,7 @@ trait AppModule extends ScalaModule{
object test extends Tests{
def testFrameworks = Seq("utest.runner.Framework")
- def forkArgs = Seq("--illegal-access=deny")
+
def ivyDeps = Agg(
ivy"com.lihaoyi::utest::0.6.3",
ivy"com.lihaoyi::requests::0.1.2",
diff --git a/example/todoApi/build.sc b/example/todoApi/build.sc
index 6b3ab3f..2794393 100644
--- a/example/todoApi/build.sc
+++ b/example/todoApi/build.sc
@@ -9,7 +9,7 @@ trait AppModule extends ScalaModule{
object test extends Tests{
def testFrameworks = Seq("utest.runner.Framework")
- def forkArgs = Seq("--illegal-access=deny")
+
def ivyDeps = Agg(
ivy"com.lihaoyi::utest::0.6.3",
ivy"com.lihaoyi::requests::0.1.2",
diff --git a/example/todoDb/build.sc b/example/todoDb/build.sc
index b570b3b..77a4dee 100644
--- a/example/todoDb/build.sc
+++ b/example/todoDb/build.sc
@@ -11,7 +11,7 @@ trait AppModule extends ScalaModule{
object test extends Tests{
def testFrameworks = Seq("utest.runner.Framework")
- def forkArgs = Seq("--illegal-access=deny")
+
def ivyDeps = Agg(
ivy"com.lihaoyi::utest::0.6.3",
ivy"com.lihaoyi::requests::0.1.2",
diff --git a/example/variableRoutes/build.sc b/example/variableRoutes/build.sc
index 6b3ab3f..2794393 100644
--- a/example/variableRoutes/build.sc
+++ b/example/variableRoutes/build.sc
@@ -9,7 +9,7 @@ trait AppModule extends ScalaModule{
object test extends Tests{
def testFrameworks = Seq("utest.runner.Framework")
- def forkArgs = Seq("--illegal-access=deny")
+
def ivyDeps = Agg(
ivy"com.lihaoyi::utest::0.6.3",
ivy"com.lihaoyi::requests::0.1.2",