Skip to content
This repository was archived by the owner on Nov 4, 2022. It is now read-only.

Commit ce37ec7

Browse files
add sealed trait derivation test
1 parent 8b49625 commit ce37ec7

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

core/src/test/scala/io/findify/scalapacked/codecs/ShapelessCodecDerivationTest.scala

+9
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,15 @@ class ShapelessCodecDerivationTest extends FlatSpec with Matchers {
1919
size(Wrapped("foo", Nested(1))) shouldBe 11
2020
}
2121

22+
it should "derive sealed trait hierarchies" in {
23+
sealed trait Foo
24+
case class Bar(a: String) extends Foo
25+
case class Baz(b: Int) extends Foo
26+
case class Root(r: Foo)
27+
implicit val fooCodec = deriveCodec[Foo]
28+
size(Root(Bar("xxx"))) shouldBe 11
29+
}
30+
2231
it should "derive classes with custom types" in {
2332
implicit val dtCodec = new Codec[SuperDate] {
2433
override def read(buffer: MemoryPool, offset: Int): SuperDate = SuperDate(

0 commit comments

Comments
 (0)