aboutsummaryrefslogtreecommitdiff
path: root/src/test/scala/CoproductTypeFormats.scala
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/scala/CoproductTypeFormats.scala')
-rw-r--r--src/test/scala/CoproductTypeFormats.scala16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/test/scala/CoproductTypeFormats.scala b/src/test/scala/CoproductTypeFormats.scala
index cdf0201..e20871c 100644
--- a/src/test/scala/CoproductTypeFormats.scala
+++ b/src/test/scala/CoproductTypeFormats.scala
@@ -28,12 +28,12 @@ class CoproductTypeFormats
"Nested parameter case class child" should behave like checkCoherence[Expr](
Plus(Value(42), One),
- """{"type":"Plus","lhs":{"type":"Value","x":42},"rhs":"One"}"""
+ """{"type":"Plus","lhs":{"type":"Value","x":42},"rhs":{"type":"One"}}"""
)
"Case object child" should behave like checkCoherence[Expr](
One,
- """"One""""
+ """{"type": "One"}"""
)
@gadt("kind")
@@ -45,13 +45,23 @@ class CoproductTypeFormats
"""{"kind":"If","type":"class"}"""
)
+ @gadt("""_`crazy type!`"""")
+ sealed abstract trait Crazy
+ case class CrazyType() extends Crazy
+
+ "GADT with special characters in type field" should behave like checkCoherence[
+ Crazy](
+ CrazyType(),
+ """{"_`crazy type!`\"": "CrazyType"}"""
+ )
+
sealed trait Enum
case object A extends Enum
case object B extends Enum
"Enum" should behave like checkCoherence[List[Enum]](
A :: B :: Nil,
- """["A", "B"]"""
+ """[{"type":"A"}, {"type":"B"}]"""
)
"Serializing as sealed trait an deserializing as child" should "work" in {