summaryrefslogtreecommitdiff
path: root/cask/test
diff options
context:
space:
mode:
authorLi Haoyi <haoyi.sg@gmail.com>2018-07-20 08:48:05 +0800
committerLi Haoyi <haoyi.sg@gmail.com>2018-07-20 08:48:05 +0800
commit37bfff46d2d875d2dec27a24973ec8f6784f1bfb (patch)
treef2d13a4d13bdc9b0a7bddaf6ab6b31e6debe60a2 /cask/test
downloadcask-37bfff46d2d875d2dec27a24973ec8f6784f1bfb.tar.gz
cask-37bfff46d2d875d2dec27a24973ec8f6784f1bfb.tar.bz2
cask-37bfff46d2d875d2dec27a24973ec8f6784f1bfb.zip
first commit
Diffstat (limited to 'cask/test')
-rw-r--r--cask/test/src/test/cask/CaskTest.scala34
1 files changed, 34 insertions, 0 deletions
diff --git a/cask/test/src/test/cask/CaskTest.scala b/cask/test/src/test/cask/CaskTest.scala
new file mode 100644
index 0000000..a1384f8
--- /dev/null
+++ b/cask/test/src/test/cask/CaskTest.scala
@@ -0,0 +1,34 @@
+package test.cask
+
+
+object MyServer extends cask.Server(){
+
+ def x = "/ext"
+ @cask.route("/user/:username" + (x * 2))
+ def showUserProfile(userName: String) = {
+ // show the user profile for that user
+ s"User $userName"
+ }
+
+ @cask.route("/post/:int")
+ def showPost(postId: Int) = {
+ // show the post with the given id, the id is an integer
+ s"Post $postId"
+ }
+
+ @cask.route("/path/:subPath")
+ def show_subpath(subPath: String) = {
+ // show the subpath after /path/
+ s"Subpath $subPath"
+ }
+
+ initialize()
+ println(routes.value)
+}
+
+object Main extends cask.Main(MyServer){
+ def main(args: Array[String]): Unit = {
+ MyServer
+ }
+}
+