From 8e3a27b85e3ecc213af9bfe38fc5a5f7014d89b8 Mon Sep 17 00:00:00 2001 From: Jacob Wang Date: Sat, 31 Aug 2024 09:24:20 +0100 Subject: [PATCH] Upgrade to munit 1.0.1 --- build.sbt | 4 +-- .../DifferAutoDerivationSpec.scala | 33 +++++++++---------- 2 files changed, 18 insertions(+), 19 deletions(-) diff --git a/build.sbt b/build.sbt index e4f84df..f140204 100644 --- a/build.sbt +++ b/build.sbt @@ -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" diff --git a/modules/coretest/src/test/scala-3/difflicious/DifferAutoDerivationSpec.scala b/modules/coretest/src/test/scala-3/difflicious/DifferAutoDerivationSpec.scala index 2ef76c9..12c676f 100644 --- a/modules/coretest/src/test/scala-3/difflicious/DifferAutoDerivationSpec.scala +++ b/modules/coretest/src/test/scala-3/difflicious/DifferAutoDerivationSpec.scala @@ -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) @@ -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")) @@ -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) +}