summaryrefslogtreecommitdiff
path: root/cask/test/src
diff options
context:
space:
mode:
authorLi Haoyi <haoyi.sg@gmail.com>2019-10-09 11:35:22 +0800
committerLi Haoyi <haoyi.sg@gmail.com>2019-10-09 11:42:03 +0800
commit5638b1b2ed83deb15108c9e99a3c1d3f6fecbf9b (patch)
treeedf49c618c824b58df9227654becdd0d8d7ab5b6 /cask/test/src
parent8571a1eae3a3798dde92022fac042ab3732e0d6f (diff)
downloadcask-5638b1b2ed83deb15108c9e99a3c1d3f6fecbf9b.tar.gz
cask-5638b1b2ed83deb15108c9e99a3c1d3f6fecbf9b.tar.bz2
cask-5638b1b2ed83deb15108c9e99a3c1d3f6fecbf9b.zip
Statically check the set of decorators applied to each endpoint method
Diffstat (limited to 'cask/test/src')
-rw-r--r--cask/test/src/test/cask/FailureTests.scala15
1 files changed, 15 insertions, 0 deletions
diff --git a/cask/test/src/test/cask/FailureTests.scala b/cask/test/src/test/cask/FailureTests.scala
index bd27971..65018ce 100644
--- a/cask/test/src/test/cask/FailureTests.scala
+++ b/cask/test/src/test/cask/FailureTests.scala
@@ -9,10 +9,25 @@ object FailureTests extends TestSuite {
delegate(Map("extra" -> 31337))
}
}
+
val tests = Tests{
'mismatchedDecorators - {
utest.compileError("""
object Decorated extends cask.MainRoutes{
+ @myDecorator
+ @cask.websocket("/hello/:world")
+ def hello(world: String)(extra: Int) = ???
+ initialize()
+ }
+ """).check(
+ """
+ def hello(world: String)(extra: Int) = ???
+ ^
+ """,
+ "required: cask.router.Decorator[_, cask.endpoints.WebsocketResult, _]"
+ )
+ utest.compileError("""
+ object Decorated extends cask.MainRoutes{
@cask.get("/hello/:world")
@myDecorator()
def hello(world: String)(extra: Int)= world