Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: properly test sealed trait derivation #77

Merged
merged 1 commit into from
Mar 26, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 16 additions & 9 deletions generic/src/test/scala/slog4s/generic/DerivationTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -70,22 +70,19 @@ class DerivationTest extends AnyFunSpec {
)
}
it("case class") {
case class Tmp(value: List[Int])
test(Tmp(List(42)), Map("value" -> List(42)))
import TestClasses.CaseClass
test(CaseClass(List(42)), Map("value" -> List(42)))
}
it("sealed trait") {
sealed trait Tmp
object Tmp {
case class Value(value: Int) extends Tmp
}
test(Tmp.Value(42), Map("value" -> 42))
import TestClasses.SealedTrait
test[SealedTrait](SealedTrait.Value(42), Map("value" -> 42))
}
it("sealed trait (case object)") {
sealed trait Foo
case object Bar extends Foo
case object Baz extends Foo
test(Bar, "Bar")
test(Baz, "Baz")
test[Foo](Baz, "Baz")
test[Foo](Bar, "Bar")
}
}
}
Expand Down Expand Up @@ -116,3 +113,13 @@ class DerivationTest extends AnyFunSpec {
}

}

object TestClasses {

case class CaseClass(value: List[Int])

sealed trait SealedTrait
object SealedTrait {
case class Value(value: Int) extends SealedTrait
}
}