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

Upgrade to munit 1.0.1 #38

Merged
merged 1 commit into from
Aug 31, 2024
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import sbtghactions.JavaSpec
import complete.DefaultParsers._
import sbt.Reference.display

val munitVersion = "0.7.29" // Upgrading to 1.0.1 seems to break Scala 3 DifferAutoDerivationSpec.scala..
val munitScalacheckVersion = "0.7.29"
val munitVersion = "1.0.1"
val munitScalacheckVersion = "1.0.0"
val catsVersion = "2.12.0"
val scalatestVersion = "3.2.19"
val weaverVersion = "0.8.4"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package difflicioustest

import munit.ScalaCheckSuite
import DifferAutoDerivationSpec.P1

class DifferAutoDerivationSpec extends ScalaCheckSuite {
test("should not compile without instance in scope") {
val result = compileErrors("""
val result = compileErrors(
"""
import difflicious._
final case class P1(f1: String)

Expand All @@ -14,35 +16,28 @@ class DifferAutoDerivationSpec extends ScalaCheckSuite {
""")
assertNoDiff(
result,
"""error:
|No given instance of type difflicious.Differ[P1] was found for parameter differ of method apply in object Differ
|
|The following import might fix the problem:
|
| import difflicious.generic.auto.autoDerived
|
"""error: No given instance of type difflicious.Differ[P1] was found for parameter differ of method apply in object Differ
| Differ[P1].diff(P1("a"), P1("b"))
| ^
|""".stripMargin
)
}
test("should find auto derived instance for product") {
val result = compileErrors("""
val result = compileErrors(
"""
import difflicious._
import difflicious.generic.auto.given

final case class P1(f1: String)

Differ[P1].diff(P1("a"), P1("b"))
""")
assertNoDiff(result, "")
}
test("should put auto derived instance back into scope") {
val result = compileErrors("""
val result = compileErrors(
"""
import difflicious._
import difflicious.generic.auto.given

final case class P1(f1: String)
implicit val d: Differ[P1] = implicitly[Derived[P1]].differ

Differ[P1].diff(P1("a"), P1("b"))
Expand All @@ -54,11 +49,15 @@ class DifferAutoDerivationSpec extends ScalaCheckSuite {
import difflicious.generic.auto._
import difflicious.generic.auto.given

final case class P1(f1: String, f2: String)
final case class P2(p1: P1)
implicit val d: Differ[P1] = implicitly[Derived[P1]].differ.ignoreAt(_.f1)
final case class Pi(f1: String, f2: String)
final case class P2(p1: Pi)
implicit val d: Differ[Pi] = implicitly[Derived[Pi]].differ.ignoreAt(_.f1)

val r = Differ[P2].diff(P2(P1("a", "a")), P2(P1("b", "a")))
val r = Differ[P2].diff(P2(Pi("a", "a")), P2(Pi("b", "a")))
assertEquals(r.isOk, true)
}
}

object DifferAutoDerivationSpec {
final case class P1(f1: String)
}