Skip to content

Commit 94229b5

Browse files
authored
Add missing test for value classes with generic type values
1 parent 472ad22 commit 94229b5

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

jsoniter-scala-macros/shared/src/test/scala/com/github/plokhotnyuk/jsoniter_scala/macros/JsonCodecMakerSpec.scala

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ object Alias {
2828
case class OrderId(value: I) extends AnyVal
2929
}
3030

31+
object Generic {
32+
case class UserId[S](id: S) extends AnyVal
33+
34+
case class OrderId[I](value: I) extends AnyVal
35+
}
36+
3137
object UserId2 {
3238
type Opaque = Base with Tag
3339

@@ -1221,6 +1227,10 @@ class JsonCodecMakerSpec extends VerifyingSpec {
12211227
verifySerDeser(make[Alias.UserId], Alias.UserId("123abc"), """"123abc"""")
12221228
verifySerDeser(make[Alias.OrderId], Alias.OrderId(123123), "123123")
12231229
}
1230+
"serialize and deserialize value classes with generic type values" in {
1231+
verifySerDeser(make[Generic.UserId[String]], Generic.UserId[String]("123abc"), """"123abc"""")
1232+
verifySerDeser(make[Generic.OrderId[Int]], Generic.OrderId[Int](123123), "123123")
1233+
}
12241234
"serialize and deserialize case classes with one value classes when turned on inlining of one value classes" in {
12251235
case class UserId(value: String)
12261236

0 commit comments

Comments
 (0)