diff options
author | Jon Pretty <jon.pretty@propensive.com> | 2018-01-09 10:02:39 +0000 |
---|---|---|
committer | Jon Pretty <jon.pretty@propensive.com> | 2018-01-09 10:02:39 +0000 |
commit | 6431fba02b1663701564adacef07a292ff7c32d7 (patch) | |
tree | f4a56d098df94013bf8c8ea171c8dc7afc33825f /tests/src/main | |
parent | 2353f9f1d3961a29a1d7b6173f5fd22d7acf0f47 (diff) | |
download | magnolia-6431fba02b1663701564adacef07a292ff7c32d7.tar.gz magnolia-6431fba02b1663701564adacef07a292ff7c32d7.tar.bz2 magnolia-6431fba02b1663701564adacef07a292ff7c32d7.zip |
Make access of combine and dispatch lazyvirtual-params-3
Diffstat (limited to 'tests/src/main')
-rw-r--r-- | tests/src/main/scala/tests.scala | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/src/main/scala/tests.scala b/tests/src/main/scala/tests.scala index f56afcb..909ee82 100644 --- a/tests/src/main/scala/tests.scala +++ b/tests/src/main/scala/tests.scala @@ -28,6 +28,7 @@ class Length(val value: Int) extends AnyVal case class FruitBasket(fruits: Fruit*) case class Lunchbox(fruit: Fruit, drink: String) + object Fruit { implicit val showFruit: Show[String, Fruit] = new Show[String, Fruit] { def show(f: Fruit): String = f.name } @@ -45,6 +46,7 @@ case class `%%`(`/`: Int, `#`: String) case class Param(a: String, b: String) case class Test(param: Param) + object Test { def apply(): Test = Test(Param("", "")) @@ -355,5 +357,13 @@ object Tests extends TestApp { Show.gen[Path[String]].show(OffRoad(Some(Crossroad(Destination("A"), Destination("B"))))) }.assert(_ == "OffRoad(path=Crossroad(left=Destination(value=A),right=Destination(value=B)))") + + test("does not derive for coproduct without dispatch defined") { + scalac"DefaultNoCoproduct.gen[Entity]" + }.assert(_ == TypecheckError("magnolia: the method `dispatch` should be defined on the derivation object")) + + test("still derives for case class without dispatch defined") { + DefaultNoCoproduct.gen[Company].default + }.assert(_ == Company("")) } } |