Skip to content

Commit

Permalink
upgrade to ScalaTest 3.1
Browse files Browse the repository at this point in the history
and avoid deprecated stuff, to pave the way for moving to 3.2
  • Loading branch information
SethTisue committed Jul 2, 2020
1 parent 0be7a97 commit 2ec2c2f
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 26 deletions.
10 changes: 1 addition & 9 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,7 @@ ThisBuild / homepage := Some(url("http://github.com/oleg-py/better-monadic-for")
ThisBuild / scalaVersion := Option(System.getenv("SCALA_VERSION")).filter(_.nonEmpty).getOrElse(scala213)

val testSettings = Seq(
libraryDependencies ++= Seq(
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, 13)) =>
// bincompatible enough :)
"org.scalatest" % "scalatest_2.13.0-RC3" % "3.1.0-SNAP12" % Test
case _ => "org.scalatest" %% "scalatest" % "3.1.0-SNAP12" % Test
}

),
libraryDependencies += "org.scalatest" %% "scalatest" % "3.1.2" % Test,
Test / scalacOptions ++= {
val jar = (betterMonadicFor / Compile / packageBin).value
Seq(s"-Xplugin:${jar.getAbsolutePath}", s"-Jdummy=${jar.lastModified}") // ensures recompile
Expand Down
4 changes: 2 additions & 2 deletions cats-tests/src/test/scala/com/olegpy/bm4/CatsSyntaxTest.scala
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package com.olegpy.bm4

import cats.Monad
import org.scalatest.FreeSpec
import org.scalatest.freespec.AnyFreeSpec
import cats.implicits._

class CatsSyntaxTest extends FreeSpec {
class CatsSyntaxTest extends AnyFreeSpec {
implicit val mcCatsInstance: cats.FlatMap[MapCheck] = new cats.FlatMap[MapCheck] {
def flatMap[A, B](fa: MapCheck[A])(f: A => MapCheck[B]): MapCheck[B] = {
fa.flatMap(f)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.olegpy.bm4

import org.ensime.pcplod._
import org.scalatest.FreeSpec
import org.scalatest.freespec.AnyFreeSpec

class PresentationCompiler extends FreeSpec {
class PresentationCompiler extends AnyFreeSpec {
"PC should have no errors" in {
withMrPlod("Arrows.scala") { pc =>
assert(pc.messages.isEmpty)
Expand Down
4 changes: 2 additions & 2 deletions plugin-tests/src/test/scala/com/olegpy/bm4/TestFor.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package com.olegpy.bm4
import scala.concurrent.Future
import scala.concurrent.duration.Duration

import org.scalatest.{FreeSpec, FunSuite}
import org.scalatest.freespec.AnyFreeSpec

/** Mo is a lazy monad without `withFilter` */
sealed trait Mo[A] {
Expand All @@ -26,7 +26,7 @@ object Mo {
val unit: Mo[Unit] = Mo(())
}

class TestFor extends FreeSpec {
class TestFor extends AnyFreeSpec {

"Plugin allows" - {
"destructuring for monads without withFilter" in {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package com.olegpy.bm4

import org.scalatest.FreeSpec
import org.scalatest.freespec.AnyFreeSpec

object CTTest {
def foo[A]: Mo[A] = for {
implicit0(a: A) <- Mo.delay(null.asInstanceOf[A])
} yield implicitly[A]
}

class TestImplicitPatterns extends FreeSpec {
class TestImplicitPatterns extends AnyFreeSpec {
case class ImplicitTest(id: String)
def typed[A](a: A) = ()
case class ImplicitTest2(id: String)
Expand Down
4 changes: 2 additions & 2 deletions plugin-tests/src/test/scala/com/olegpy/bm4/TestNoMap.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.olegpy.bm4

import org.scalatest.FreeSpec
import org.scalatest.freespec.AnyFreeSpec

case class MapCalled() extends Exception

Expand All @@ -9,7 +9,7 @@ class MapCheck[+A](a: A) {
def flatMap[B](f: A => MapCheck[B]): MapCheck[B] = f(a)
}

class TestNoMap extends FreeSpec {
class TestNoMap extends AnyFreeSpec {
"emits no map(b => b) in for-comprehension" in {
for {
_ <- new MapCheck(42)
Expand Down
7 changes: 3 additions & 4 deletions plugin-tests/src/test/scala/com/olegpy/bm4/TestNoTuples.scala
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
package com.olegpy.bm4

import com.olegpy.bm4.TestNoTuples.TupleChecker
import org.scalatest.FreeSpec
import org.scalatest.freespec.AnyFreeSpec


class TestNoTuples extends FreeSpec {
class TestNoTuples extends AnyFreeSpec {
"Plugin removes tuples produced in binding" - {
"for single definition" in {
for {
Expand Down Expand Up @@ -147,4 +146,4 @@ object TestNoTuples {
f(a)
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.olegpy.bm4

import org.scalatest.FreeSpec
import org.scalatest.freespec.AnyFreeSpec
import scalaz._, Scalaz._

class ScalazSyntaxTest extends FreeSpec {
class ScalazSyntaxTest extends AnyFreeSpec {
implicit val scalazInstance: Bind[MapCheck] = new Bind[MapCheck] {
def bind[A, B](fa: MapCheck[A])(f: A => MapCheck[B]): MapCheck[B] = fa.flatMap(f)

Expand All @@ -19,4 +19,4 @@ class ScalazSyntaxTest extends FreeSpec {

sillyTest(new MapCheck(11), new MapCheck(42))
}
}
}

0 comments on commit 2ec2c2f

Please sign in to comment.