diff options
author | Jean Helou <jhe@codamens.fr> | 2019-02-13 23:29:33 +0100 |
---|---|---|
committer | Tobias Roeser <le.petit.fou@web.de> | 2019-02-14 17:45:16 +0100 |
commit | 316fab29c7a87e89fa253fd09504b8b54b66911e (patch) | |
tree | 75236af55f55858320e0ad075485ea99ee9dcfec /contrib/playlib/test | |
parent | 1afcfcafe0ed45aeae52f41768797bb6ab39a4d0 (diff) | |
download | mill-316fab29c7a87e89fa253fd09504b8b54b66911e.tar.gz mill-316fab29c7a87e89fa253fd09504b8b54b66911e.tar.bz2 mill-316fab29c7a87e89fa253fd09504b8b54b66911e.zip |
switch to T.sources for the routesFiles setting
Diffstat (limited to 'contrib/playlib/test')
6 files changed, 29 insertions, 5 deletions
diff --git a/contrib/playlib/test/resources/hello-world/core/conf/routes b/contrib/playlib/test/resources/hello-world/core/conf/routes index 7d5e5498..f71b0cdd 100644 --- a/contrib/playlib/test/resources/hello-world/core/conf/routes +++ b/contrib/playlib/test/resources/hello-world/core/conf/routes @@ -1,2 +1,3 @@ GET / controllers.HomeController.index GET /assets/*file controllers.Assets.versioned(path="/public", file: Asset) +-> /sub sub.Routes
\ No newline at end of file diff --git a/contrib/playlib/test/resources/hello-world/core/conf/sub.routes b/contrib/playlib/test/resources/hello-world/core/conf/sub.routes new file mode 100644 index 00000000..4597a19b --- /dev/null +++ b/contrib/playlib/test/resources/hello-world/core/conf/sub.routes @@ -0,0 +1,2 @@ +GET / controllers.SubController.index +GET /assets/*file controllers.Assets.versioned(path="/public/sub", file: Asset) diff --git a/contrib/playlib/test/resources/invalid/core/conf/routes b/contrib/playlib/test/resources/invalid/core/conf/routes index 1b31139f..5c946fc6 100644 --- a/contrib/playlib/test/resources/invalid/core/conf/routes +++ b/contrib/playlib/test/resources/invalid/core/conf/routes @@ -1,3 +1,4 @@ GET / controllers.HomeController.index -BOB =error controllers.HomeController.error(foo) +-> /sub sub.Routes GET /assets/*file controllers.Assets.versioned(path="/public", file: Asset) +BOB =error controllers.HomeController.error(foo)
\ No newline at end of file diff --git a/contrib/playlib/test/resources/invalidsub/core/conf/routes b/contrib/playlib/test/resources/invalidsub/core/conf/routes new file mode 100644 index 00000000..5c946fc6 --- /dev/null +++ b/contrib/playlib/test/resources/invalidsub/core/conf/routes @@ -0,0 +1,4 @@ +GET / controllers.HomeController.index +-> /sub sub.Routes +GET /assets/*file controllers.Assets.versioned(path="/public", file: Asset) +BOB =error controllers.HomeController.error(foo)
\ No newline at end of file diff --git a/contrib/playlib/test/resources/invalidsub/core/conf/sub.routes b/contrib/playlib/test/resources/invalidsub/core/conf/sub.routes new file mode 100644 index 00000000..9c844a4a --- /dev/null +++ b/contrib/playlib/test/resources/invalidsub/core/conf/sub.routes @@ -0,0 +1,3 @@ +GET / controllers.SubController.index +GET /assets/*file controllers.Assets.versioned(path="/public/sub", file: Asset) +BOB =error controllers.HomeController.error(foo)
\ No newline at end of file diff --git a/contrib/playlib/test/src/mill/playlib/HelloWorldTests.scala b/contrib/playlib/test/src/mill/playlib/HelloWorldTests.scala index 71ee6c4d..20e8ce55 100644 --- a/contrib/playlib/test/src/mill/playlib/HelloWorldTests.scala +++ b/contrib/playlib/test/src/mill/playlib/HelloWorldTests.scala @@ -32,6 +32,7 @@ object HelloWorldTests extends TestSuite { val resourcePath: Path = pwd / 'contrib / 'playlib / 'test / 'resources / "hello-world" val invalidResourcePath: Path = pwd / 'contrib / 'playlib / 'test / 'resources / "invalid" + val invalidSubResourcePath: Path = pwd / 'contrib / 'playlib / 'test / 'resources / "invalidsub" def workspaceTest[T, M <: TestUtil.BaseModule](m: M, resourcePath: Path = resourcePath) (t: TestEvaluator => T) @@ -65,6 +66,8 @@ object HelloWorldTests extends TestSuite { RelPath("controllers/routes.java"), RelPath("router/Routes.scala"), RelPath("router/RoutesPrefix.scala"), + RelPath("sub/Routes.scala"), + RelPath("sub/RoutesPrefix.scala"), RelPath("controllers/javascript/JavaScriptReverseRoutes.scala") ).map( eval.outPath / 'core / 'compileRouter / 'dest / _ @@ -73,7 +76,7 @@ object HelloWorldTests extends TestSuite { result.classes.path == eval.outPath / 'core / 'compileRouter / 'dest, outputFiles.nonEmpty, outputFiles.forall(expectedClassfiles.contains), - outputFiles.size == 5, + outputFiles.size == 7, evalCount > 0 ) @@ -85,9 +88,19 @@ object HelloWorldTests extends TestSuite { 'compileRouter - workspaceTest(HelloWorld, resourcePath = invalidResourcePath) { eval => val eitherResult = eval.apply(HelloWorld.core.compileRouter) val Left(Failure(message, x)) = eitherResult - val expectedMessage = "Unable to compile play routes, compilation error in " + - HelloWorld.millSourcePath.toIO.getAbsolutePath + "/core/conf/routes at line 2, column 1: " + - "HTTP Verb (GET, POST, ...), include (->), comment (#), or modifier line (+) expected" + val expectedMessage = "Unable to compile play routes\ncompilation error in " + + HelloWorld.millSourcePath.toIO.getAbsolutePath + "/core/conf/routes at line 4, column" + + " 1: HTTP Verb (GET, POST, ...), include (->), comment (#), or modifier line (+) expected" + assert( + message == expectedMessage + ) + } + 'compileRouter - workspaceTest(HelloWorld, resourcePath = invalidSubResourcePath) { eval => + val eitherResult = eval.apply(HelloWorld.core.compileRouter) + val Left(Failure(message, x)) = eitherResult + val expectedMessage = "Unable to compile play routes\ncompilation error in " + + HelloWorld.millSourcePath.toIO.getAbsolutePath + "/core/conf/sub.routes at line 3, column" + + " 1: HTTP Verb (GET, POST, ...), include (->), comment (#), or modifier line (+) expected" assert( message == expectedMessage ) |