Skip to content

Commit

Permalink
chore: Add test to close issue 2555
Browse files Browse the repository at this point in the history
  • Loading branch information
jkciesluk committed Dec 5, 2023
1 parent 1870e89 commit 7f9e614
Showing 1 changed file with 78 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -590,4 +590,82 @@ class SyntheticDecorationsSuite extends BaseSyntheticDecorationsSuite {
|}
|""".stripMargin
)

check(
"complex",
"""|object ScalatestMock {
| class SRF
| implicit val subjectRegistrationFunction: SRF = new SRF()
| class Position
| implicit val here: Position = new Position()
| implicit class StringTestOps(name: String) {
| def should(right: => Unit)(implicit config: SRF): Unit = ()
| def in(f: => Unit)(implicit pos: Position): Unit = ()
| }
| implicit def instancesString: Eq[String] with Semigroup[String] = ???
|}
|
|trait Eq[A]
|trait Semigroup[A]
|
|class DemoSpec {
| import ScalatestMock._
|
| "foo" should {
| "checkThing1" in {
| checkThing1[String]
| }
| "checkThing2" in {
| checkThing2[String]
| }
| }
|
| "bar" should {
| "checkThing1" in {
| checkThing1[String]
| }
| }
|
| def checkThing1[A](implicit ev: Eq[A]) = ???
| def checkThing2[A](implicit ev: Eq[A], sem: Semigroup[A]) = ???
|}
|""".stripMargin,
"""|object ScalatestMock {
| class SRF
| implicit val subjectRegistrationFunction: SRF = new SRF()
| class Position
| implicit val here: Position = new Position()
| implicit class StringTestOps(name: String) {
| def should(right: => Unit)(implicit config: SRF): Unit = ()
| def in(f: => Unit)(implicit pos: Position): Unit = ()
| }
| implicit def instancesString: Eq[String] with Semigroup[String] = ???
|}
|
|trait Eq[A]
|trait Semigroup[A]
|
|class DemoSpec {
| import ScalatestMock._
|
| StringTestOps("foo") should {
| StringTestOps("checkThing1") in {
| checkThing1[String](instancesString)
| }(here)
| StringTestOps("checkThing2") in {
| checkThing2[String](instancesString, instancesString)
| }(here)
| }(subjectRegistrationFunction)
|
| StringTestOps("bar") should {
| StringTestOps("checkThing1") in {
| checkThing1[String](instancesString)
| }(here)
| }(subjectRegistrationFunction)
|
| def checkThing1[A](implicit ev: Eq[A]): Nothing = ???
| def checkThing2[A](implicit ev: Eq[A], sem: Semigroup[A]): Nothing = ???
|}
|""".stripMargin
)
}

0 comments on commit 7f9e614

Please sign in to comment.