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 - } -}