Skip to content
Permalink
Browse files

scala2.13

  • Loading branch information...
takayahilton authored and travisbrown committed Sep 12, 2019
1 parent 6fc164b commit 9b4bb653de2382d1f682c9df44ab4e392458524b
@@ -1 +1,2 @@
target/
.idea/
@@ -4,7 +4,8 @@ language: scala

scala:
- 2.11.12
- 2.12.8
- 2.12.10
- 2.13.0

jdk:
- openjdk8
@@ -16,3 +17,9 @@ install:

script:
sbt ++$TRAVIS_SCALA_VERSION clean coverage test scalastyle scalafmtCheck scalafmtSbtCheck test:scalafmtCheck unidoc coverageReport && codecov;

cache:
directories:
- $HOME/.ivy2/cache
- $HOME/.sbt
- $HOME/.coursier
@@ -1,8 +1,9 @@
package io.catbird.benchmark

import org.scalatest.{ BeforeAndAfter, FlatSpec }
import org.scalatest.BeforeAndAfter
import org.scalatest.flatspec.AnyFlatSpec

class RerunnableBenchmarkSpec extends FlatSpec with BeforeAndAfter {
class RerunnableBenchmarkSpec extends AnyFlatSpec with BeforeAndAfter {
val benchmark: RerunnableBenchmark = new RerunnableBenchmark
val sum = benchmark.numbers.sum

@@ -1,45 +1,52 @@
import ReleaseTransformations._

val catsVersion = "1.6.1"
val catsEffectVersion = "1.4.0"
val catsVersion = "2.0.0"
val catsEffectVersion = "2.0.0"
val utilVersion = "19.8.1"
val finagleVersion = "19.8.0"
val finagleVersion = "19.9.0"

organization in ThisBuild := "io.catbird"

val compilerOptions = Seq(
def compilerOptions(scalaVersion: String): Seq[String] = Seq(
"-deprecation",
"-encoding",
"UTF-8",
"-feature",
"-language:existentials",
"-language:higherKinds",
"-unchecked",
"-Yno-adapted-args",
"-Ywarn-dead-code",
"-Ywarn-numeric-widen",
"-Xfuture",
"-Ywarn-unused-import",
"-Yno-imports",
"-Yno-predef"
)
) ++ (if (priorTo2_13(scalaVersion))
Seq(
"-Ywarn-unused-import",
"-Yno-adapted-args",
"-Xfuture"
)
else
Seq(
"-Ywarn-unused:imports",
"-Ymacro-annotations"
))

val docMappingsApiDir = settingKey[String]("Subdirectory in site target directory for API docs")

lazy val baseSettings = Seq(
scalacOptions ++= compilerOptions,
crossScalaVersions := Seq("2.11.12", "2.12.10", "2.13.0"),
scalacOptions ++= compilerOptions(scalaVersion.value),
scalacOptions in (Compile, console) ~= {
_.filterNot(Set("-Ywarn-unused-import", "-Yno-imports", "-Yno-predef"))
_.filterNot(Set("-Ywarn-unused-import", "-Ywarn-unused:imports", "-Yno-imports", "-Yno-predef"))
},
scalacOptions in (Test, console) ~= {
_.filterNot(Set("-Ywarn-unused-import", "-Yno-imports", "-Yno-predef"))
_.filterNot(Set("-Ywarn-unused-import", "-Ywarn-unused:imports", "-Yno-imports", "-Yno-predef"))
},
libraryDependencies ++= Seq(
"org.typelevel" %% "cats-core" % catsVersion,
"org.scalacheck" %% "scalacheck" % "1.13.5" % Test,
"org.scalacheck" %% "scalacheck" % "1.14.0" % Test,
"org.scalatest" %% "scalatest" % "3.0.8" % Test,
"org.typelevel" %% "cats-laws" % catsVersion % Test,
"org.typelevel" %% "discipline" % "0.9.0" % Test,
"org.typelevel" %% "discipline-core" % "1.0.0" % Test,
"org.typelevel" %% "discipline-scalatest" % "1.0.0-M1" % Test,
compilerPlugin("org.typelevel" %% "kind-projector" % "0.10.3")
),
resolvers += Resolver.sonatypeRepo("snapshots"),
@@ -170,3 +177,9 @@ credentials ++= (
password
)
).toSeq

def priorTo2_13(scalaVersion: String): Boolean =
CrossVersion.partialVersion(scalaVersion) match {
case Some((2, minor)) if minor < 13 => true
case _ => false
}
@@ -1,21 +1,21 @@
package io.catbird.util.effect

import cats.kernel.Eq
import cats.effect.{ Bracket, IO }
import cats.effect.laws.discipline.EffectTests
import cats.effect.laws.discipline.arbitrary.catsEffectLawsArbitraryForIO
import cats.effect.laws.util.{ TestContext, TestInstances }
import cats.effect.{ Bracket, IO }
import cats.instances.either._
import cats.instances.int._
import cats.instances.tuple._
import cats.instances.unit._
import cats.kernel.Eq
import cats.laws.discipline.arbitrary._
import com.twitter.util.{ Await, Monitor, Throw }
import io.catbird.util.{ ArbitraryInstances, Rerunnable }
import org.scalatest.FunSuite
import org.scalatest.funsuite.AnyFunSuite
import org.typelevel.discipline.scalatest.Discipline

class RerunnableSuite extends FunSuite with Discipline with ArbitraryInstances with TestInstances {
class RerunnableSuite extends AnyFunSuite with Discipline with ArbitraryInstances with TestInstances {
implicit val context: TestContext = TestContext()
implicit def rerunnableEq[A](implicit A: Eq[A]): Eq[Rerunnable[A]] =
Eq.by[Rerunnable[A], IO[A]](rerunnableToIO)
@@ -6,13 +6,13 @@ import cats.laws.discipline._
import cats.laws.discipline.eq._
import com.twitter.conversions.DurationOps._
import com.twitter.finagle.Service
import org.scalatest.FunSuite
import org.scalatest.funsuite.AnyFunSuite
import org.typelevel.discipline.scalatest.Discipline

class ServiceSuite extends FunSuite with Discipline with ServiceInstances with ArbitraryInstances with EqInstances {
implicit val eq: Eq[Service[Int, Int]] = serviceEq(1.second)
class ServiceSuite extends AnyFunSuite with Discipline with ServiceInstances with ArbitraryInstances with EqInstances {
implicit val eq: Eq[Service[Boolean, Int]] = serviceEq(1.second)

checkAll("Service", CategoryTests[Service].compose[Int, Int, Int, Int])
checkAll("Service", CategoryTests[Service].category[Int, Int, Int, Int])
checkAll("Service", ProfunctorTests[Service].profunctor[Int, Int, Int, Int, Int, Int])
checkAll("Service", CategoryTests[Service].compose[Boolean, Int, Boolean, Int])
checkAll("Service", CategoryTests[Service].category[Boolean, Int, Boolean, Int])
checkAll("Service", ProfunctorTests[Service].profunctor[Boolean, Int, Boolean, Int, Boolean, Int])
}
@@ -57,8 +57,10 @@ trait FutureInstances extends FutureInstances1 {
final def futureEqWithFailure[A](atMost: Duration)(implicit A: Eq[A], T: Eq[Throwable]): Eq[Future[A]] =
Eq.by[Future[A], Future[Try[A]]](_.liftToTry)(futureEq[Try[A]](atMost))

implicit final val twitterFutureParallelInstance: Parallel[Future, FuturePar] =
new Parallel[Future, FuturePar] {
implicit final val twitterFutureParallelInstance: Parallel.Aux[Future, FuturePar] =
new Parallel[Future] {
type F[x] = FuturePar[x]

final override val applicative: Applicative[FuturePar] =
futureParCommutativeApplicative

@@ -1,18 +1,18 @@
package io.catbird.util

import cats.{ Comonad, Eq }
import cats.instances.either._
import cats.instances.int._
import cats.instances.tuple._
import cats.instances.unit._
import cats.kernel.laws.discipline.MonoidTests
import cats.laws.discipline._
import cats.laws.discipline.arbitrary._
import cats.{ Comonad, Eq }
import com.twitter.conversions.DurationOps._
import org.scalatest.FunSuite
import org.scalatest.funsuite.AnyFunSuite
import org.typelevel.discipline.scalatest.Discipline

class RerunnableSuite extends FunSuite with Discipline with ArbitraryInstances with EqInstances {
class RerunnableSuite extends AnyFunSuite with Discipline with ArbitraryInstances with EqInstances {
implicit def rerunnableEq[A](implicit A: Eq[A]): Eq[Rerunnable[A]] =
Rerunnable.rerunnableEqWithFailure[A](1.second)
implicit val rerunnableComonad: Comonad[Rerunnable] = Rerunnable.rerunnableComonad(1.second)
@@ -8,10 +8,10 @@ import cats.kernel.laws.discipline.{ MonoidTests, SemigroupTests }
import cats.laws.discipline._
import com.twitter.concurrent.AsyncStream
import com.twitter.conversions.DurationOps._
import org.scalatest.FunSuite
import org.scalatest.funsuite.AnyFunSuite
import org.typelevel.discipline.scalatest.Discipline

class AsyncStreamSuite extends FunSuite with Discipline with AsyncStreamInstances with ArbitraryInstances {
class AsyncStreamSuite extends AnyFunSuite with Discipline with AsyncStreamInstances with ArbitraryInstances {

implicit val eqAsyncStreamInt: Eq[AsyncStream[Int]] = asyncStreamEq(1.second)
implicit val eqAsyncStreamAsyncStreamInt: Eq[AsyncStream[AsyncStream[Int]]] = asyncStreamEq(1.second)
@@ -1,20 +1,20 @@
package io.catbird.util

import cats.{ Comonad, Eq }
import cats.instances.either._
import cats.instances.int._
import cats.instances.tuple._
import cats.instances.unit._
import cats.kernel.laws.discipline.{ MonoidTests, SemigroupTests }
import cats.laws.discipline._
import cats.laws.discipline.arbitrary._
import cats.{ Comonad, Eq }
import com.twitter.conversions.DurationOps._
import com.twitter.util.Future
import org.scalacheck.Arbitrary
import org.scalatest.FunSuite
import org.scalatest.funsuite.AnyFunSuite
import org.typelevel.discipline.scalatest.Discipline

class FutureSuite extends FunSuite with Discipline with FutureInstances with ArbitraryInstances with EqInstances {
class FutureSuite extends AnyFunSuite with Discipline with FutureInstances with ArbitraryInstances with EqInstances {
implicit val eqFutureInt: Eq[Future[Int]] = futureEqWithFailure(1.second)
implicit val eqFutureFutureInt: Eq[Future[Future[Int]]] = futureEqWithFailure(1.second)
implicit val eqFutureFutureFutureInt: Eq[Future[Future[Future[Int]]]] = futureEqWithFailure(1.second)
@@ -6,23 +6,24 @@ import cats.instances.option._
import cats.instances.tuple._
import cats.instances.unit._
import cats.kernel.laws.discipline.{ MonoidTests, SemigroupTests }
import cats.laws.discipline.{ MonadErrorTests, TraverseTests }
import cats.laws.discipline.arbitrary._
import cats.laws.discipline.{ MonadErrorTests, TraverseTests }
import com.twitter.util.{ Return, Throw, Try }
import org.scalatest.prop.{ Checkers, PropertyChecks }
import org.scalatest.{ FunSuite, PropSpec }
import org.scalatest.funsuite.AnyFunSuite
import org.scalatest.propspec.AnyPropSpec
import org.scalatestplus.scalacheck.{ Checkers, ScalaCheckPropertyChecks }
import org.typelevel.discipline.scalatest.Discipline

trait TryTest extends ArbitraryInstances with EqInstances with TryInstances

class TrySuite extends FunSuite with TryTest with Discipline {
class TrySuite extends AnyFunSuite with TryTest with Discipline {
checkAll("Try[Int]", MonadErrorTests[Try, Throwable].monadError[Int, Int, Int])
checkAll("Try[Int]", TraverseTests[Try].traverse[Int, Int, Int, Int, Option, Option])
checkAll("Try[Int]", SemigroupTests[Try[Int]](twitterTrySemigroup[Int]).semigroup)
checkAll("Try[Int]", MonoidTests[Try[Int]].monoid)
}

class TrySpec extends PropSpec with PropertyChecks with Checkers with TryTest {
class TrySpec extends AnyPropSpec with ScalaCheckPropertyChecks with Checkers with TryTest {
property("Equality for Try should use universal equality for Throw") {
case class SomeError(message: String) extends Exception(message)

@@ -1,15 +1,15 @@
package io.catbird.util

import cats.{ Comonad, Eq }
import cats.instances.int._
import cats.instances.tuple._
import cats.kernel.laws.discipline.{ MonoidTests, SemigroupTests }
import cats.laws.discipline._
import cats.{ Comonad, Eq }
import com.twitter.util.Var
import org.scalatest.FunSuite
import org.scalatest.funsuite.AnyFunSuite
import org.typelevel.discipline.scalatest.Discipline

class VarSuite extends FunSuite with Discipline with VarInstances with ArbitraryInstances {
class VarSuite extends AnyFunSuite with Discipline with VarInstances with ArbitraryInstances {
implicit val eqVarInt: Eq[Var[Int]] = varEq
implicit val eqVarVarInt: Eq[Var[Var[Int]]] = varEq
implicit val eqVarVarVarInt: Eq[Var[Var[Var[Int]]]] = varEq

0 comments on commit 9b4bb65

Please sign in to comment.
You can’t perform that action at this time.