From 850a8a6aeb4875d916663092e362eb0bfc24bc99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olivier=20M=C3=A9lois?= Date: Fri, 16 Sep 2022 12:22:40 +0200 Subject: [PATCH] Remove specs2 sources altogether (#580) --- .../src/weaver/specs2compat/Matchers.scala | 37 ---------- .../weaver/specs2compat/MatchersSpec.scala | 73 ------------------- 2 files changed, 110 deletions(-) delete mode 100644 modules/specs2/src/weaver/specs2compat/Matchers.scala delete mode 100644 modules/specs2/test/src/weaver/specs2compat/MatchersSpec.scala diff --git a/modules/specs2/src/weaver/specs2compat/Matchers.scala b/modules/specs2/src/weaver/specs2compat/Matchers.scala deleted file mode 100644 index 8e89eb03..00000000 --- a/modules/specs2/src/weaver/specs2compat/Matchers.scala +++ /dev/null @@ -1,37 +0,0 @@ -package weaver.specs2compat - -import cats.Monoid -import cats.data.{ NonEmptyList, Validated } -import cats.effect.IO - -import weaver.{ AssertionException, EffectSuite, Expectations, SourceLocation } - -import org.specs2.matcher.{ MatchResult, MustMatchers } - -trait Matchers[F[_]] extends MustMatchers { - self: EffectSuite[F] => - - implicit def toExpectations[A]( - m: MatchResult[A] - )( - implicit pos: SourceLocation - ): Expectations = - if (m.toResult.isSuccess) { - Monoid[Expectations].empty - } else { - Expectations(Validated.invalidNel(new AssertionException( - m.toResult.message, - NonEmptyList.of(pos)))) - } - - implicit def toExpectationsF[A]( - m: MatchResult[A] - )( - implicit pos: SourceLocation - ): F[Expectations] = effectCompat.effect.pure(toExpectations(m)) - -} - -trait IOMatchers extends Matchers[IO] { - self: EffectSuite[IO] => -} diff --git a/modules/specs2/test/src/weaver/specs2compat/MatchersSpec.scala b/modules/specs2/test/src/weaver/specs2compat/MatchersSpec.scala deleted file mode 100644 index 169d87f1..00000000 --- a/modules/specs2/test/src/weaver/specs2compat/MatchersSpec.scala +++ /dev/null @@ -1,73 +0,0 @@ -package weaver.specs2compat - -import weaver.{ Expectations, SimpleIOSuite } - -import org.specs2.matcher.MatchResult - -object MatchersSpec extends SimpleIOSuite with IOMatchers { - pureTest("pureTest { 1 must beEqualTo(1) }") { - 1 must beEqualTo(1) - } - - pureTest("pureTest { 1 must be_==(1) }") { - 1 must be_==(1) - } - - pureTest("pureTest { 1 must_== 1 }") { - 1 must_== 1 - } - - pureTest("pureTest { 1 mustEqual 1 }") { - 1 mustEqual 1 - } - - pureTest("pureTest { 1 === 1 }") { - 1 === 1 - } - - def expectFailure[A](matchResult: MatchResult[A]): Expectations = { - matchResult.run.toEither.fold( - nel => expect(nel.head.message == matchResult.toResult.message), - _ => failure("Expected assertion exception") - ) - } - - pureTest("pureTest { expectFailure { 1 must beEqualTo(2) } }") { - expectFailure { 1 must beEqualTo(2) } - } - - pureTest("pureTest { expectFailure { 1 must be_==(2) } }") { - expectFailure(1 must be_==(2)) - } - - pureTest("pureTest { expectFailure { 1 must_== 2 } }") { - expectFailure(1 must_== 2) - } - - pureTest("pureTest { expectFailure { 1 mustEqual 2 } }") { - expectFailure { 1 mustEqual 2 } - } - - pureTest("pureTest { expectFailure { 1 === 2 failed } }") { - expectFailure(1 === 2) - } - pureTest("pureTest { 1 must beEqualTo(1) }") { - 1 must beEqualTo(1) - } - - pureTest("pureTest { 1 must be_==(1) }") { - 1 must be_==(1) - } - - pureTest("pureTest { 1 must_== 1 }") { - 1 must_== 1 - } - - pureTest("pureTest { 1 mustEqual 1 }") { - 1 mustEqual 1 - } - - pureTest("pureTest { 1 === 1 }") { - 1 === 1 - } -}