diff options
author | Stewart Stewart <stewinsalot@gmail.com> | 2016-12-19 22:37:31 -0500 |
---|---|---|
committer | Stewart Stewart <stewinsalot@gmail.com> | 2016-12-19 22:37:31 -0500 |
commit | 2555bc7b3bc5b6f9057c85217ae5e1cfaa2e77c0 (patch) | |
tree | 2fe616b99dcb0785d5959258f97fe221ac4479ec /src/test/scala/xyz/driver/core | |
parent | e0a4590247199fb4f9ad49ea6520f104b2622c51 (diff) | |
parent | dd8cbb3ada14a4f05d5683b90a5b83dc4b3b35f5 (diff) | |
download | driver-core-2555bc7b3bc5b6f9057c85217ae5e1cfaa2e77c0.tar.gz driver-core-2555bc7b3bc5b6f9057c85217ae5e1cfaa2e77c0.tar.bz2 driver-core-2555bc7b3bc5b6f9057c85217ae5e1cfaa2e77c0.zip |
Merge branch 'master' into dal-improvements
Diffstat (limited to 'src/test/scala/xyz/driver/core')
-rw-r--r-- | src/test/scala/xyz/driver/core/CoreTest.scala | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/test/scala/xyz/driver/core/CoreTest.scala b/src/test/scala/xyz/driver/core/CoreTest.scala index 3eb9eaa..da9fd9a 100644 --- a/src/test/scala/xyz/driver/core/CoreTest.scala +++ b/src/test/scala/xyz/driver/core/CoreTest.scala @@ -39,6 +39,27 @@ class CoreTest extends FlatSpec with Matchers with MockitoSugar { theSameElementsInOrderAs(Seq(Id[String]("1"), Id[String]("2"), Id[String]("3"), Id[String]("4"))) } + it should "have type-safe conversions" in { + final case class X(id: Id[X]) + final case class Y(id: Id[Y]) + final case class Z(id: Id[Z]) + + implicit val xy = Id.Mapper[X, Y] + implicit val yx = Id.Mapper[Y, X] + implicit val yz = Id.Mapper[Y, Z] + implicit val zy = Id.Mapper[Z, Y] + + // The real test is that the following statements compile: + val x = X(Id("0")) + val y = Y(x.id) + val z = Z(y.id) + val y2 = Y(z.id) + val x2 = X(y2.id) + + (x2 === x) should be(true) + (y2 === y) should be(true) + } + "Name" should "have equality and ordering working correctly" in { (Name[String]("foo") === Name[String]("foo")) should be(true) |