Skip to content

Commit 584f77a

Browse files
committed
#24 Added a test showing polymorphic types support
1 parent 394cd46 commit 584f77a

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
Compared to the built-in macros, this project brings support for:
88

99
- sealed traits ;
10-
- recursive types.
10+
- recursive types ;
11+
- polymorphic types.
1112

1213
The artifacts are built for Scala 2.11 and Play 2.4.
1314

src/test/scala/julienrf/json/derived/DerivedOFormatSuite.scala

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,14 @@ class DerivedOFormatSuite extends FeatureSpec with Checkers {
7878
identityLaw[Tree]
7979
}
8080
}
81+
82+
scenario("polylmorphic types") {
83+
case class Quux[A](value: A)
84+
implicit val fooFormat: OFormat[Quux[Int]] = oformat[Quux[Int]]
85+
implicit val arbitraryFoo: Arbitrary[Quux[Int]] =
86+
Arbitrary(arbitrary[Int].map(new Quux(_)))
87+
identityLaw[Quux[Int]]
88+
}
8189
}
8290

8391
def identityLaw[A](implicit reads: Reads[A], owrites: OWrites[A], arbA: Arbitrary[A]): Unit =

0 commit comments

Comments
 (0)