Created
January 24, 2016 14:39
-
-
Save stanch/81f9981f7ab473ff4419 to your computer and use it in GitHub Desktop.
Extending Quicklens (https://github.com/adamw/quicklens) to support sealed traits
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
case class Grand(parent: Parent) | |
sealed trait Parent { def x: Int } | |
case class Child1(x: Int) extends Parent | |
case class Child2(x: Int) extends Parent | |
val grand = Grand(Child1(3)) | |
it should "modify a field in a sealed trait" in { | |
modify(grand)(_.parent.x).using(_ + 1) should be (Grand(Child1(4))) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment