diff --git a/build.sbt b/build.sbt index 0eac781..35d0064 100644 --- a/build.sbt +++ b/build.sbt @@ -1,6 +1,6 @@ import sbtcrossproject.CrossPlugin.autoImport.{crossProject, CrossType} -scalaVersion in ThisBuild := "2.13.0" +scalaVersion in ThisBuild := "2.13.3" crossScalaVersions in ThisBuild := Seq(scalaVersion.value, "2.12.8") @@ -13,9 +13,10 @@ val library = name := "play-json-derived-codecs", libraryDependencies ++= Seq( "com.chuusai" %%% "shapeless" % "2.3.3", - "org.scalatest" %%% "scalatest" % "3.0.8" % Test, - "org.scalacheck" %%% "scalacheck" % "1.14.0" % Test, - "com.typesafe.play" %%% "play-json" % "2.8.0" + "org.scalatest" %%% "scalatest" % "3.2.3" % Test, + "org.scalacheck" %%% "scalacheck" % "1.15.2" % Test, + "org.scalatestplus" %%% "scalacheck-1-15" % "3.2.3.0" % Test, + "com.typesafe.play" %%% "play-json" % "2.9.2" ), publishTo := { val nexus = "https://oss.sonatype.org" @@ -50,7 +51,7 @@ val library = "-Xlint" ) ++ (CrossVersion.partialVersion(scalaVersion.value) match { - case Some((2, n)) if n >= 13 => Seq("-Xsource:2.14") + case Some((2, n)) if n >= 13 => Seq("-Xsource:3") case _ => Seq("-Yno-adapted-args", "-Ywarn-unused-import", "-Xfuture") }) }, diff --git a/library/src/test/scala/julienrf/json/derived/DerivedOFormatSuite.scala b/library/src/test/scala/julienrf/json/derived/DerivedOFormatSuite.scala index a5d8b69..1227ca2 100644 --- a/library/src/test/scala/julienrf/json/derived/DerivedOFormatSuite.scala +++ b/library/src/test/scala/julienrf/json/derived/DerivedOFormatSuite.scala @@ -2,15 +2,15 @@ package julienrf.json.derived import org.scalacheck.{Gen, Arbitrary} import org.scalacheck.Arbitrary.arbitrary -import org.scalatest.FeatureSpec -import org.scalatest.prop.Checkers +import org.scalatest.featurespec.AnyFeatureSpec +import org.scalatestplus.scalacheck.Checkers import play.api.libs.json.{JsNumber, Json, OFormat, OWrites, Reads, __} -class DerivedOFormatSuite extends FeatureSpec with Checkers { +class DerivedOFormatSuite extends AnyFeatureSpec with Checkers { - feature("encoding andThen decoding = identity") { + Feature("encoding andThen decoding = identity") { - scenario("product type") { + Scenario("product type") { case class Foo(s: String, i: Int) implicit val fooArbitrary: Arbitrary[Foo] = Arbitrary(for (s <- arbitrary[String]; i <- arbitrary[Int]) yield Foo(s, i)) @@ -18,14 +18,14 @@ class DerivedOFormatSuite extends FeatureSpec with Checkers { identityLaw[Foo] } - scenario("tuple type") { + Scenario("tuple type") { type Foo = (String, Int) implicit val fooFormat: OFormat[Foo] = oformat() identityLaw[Foo] } - scenario("sum types") { + Scenario("sum types") { sealed trait Foo case class Bar(x: Int) extends Foo case class Baz(s: String) extends Foo @@ -54,7 +54,7 @@ class DerivedOFormatSuite extends FeatureSpec with Checkers { } } - scenario("recursive types") { + Scenario("recursive types") { sealed trait Tree case class Leaf(s: String) extends Tree case class Node(lhs: Tree, rhs: Tree) extends Tree @@ -83,7 +83,7 @@ class DerivedOFormatSuite extends FeatureSpec with Checkers { } } - scenario("polylmorphic types") { + Scenario("polylmorphic types") { case class Quux[A](value: A) implicit val fooFormat: OFormat[Quux[Int]] = oformat() implicit val arbitraryFoo: Arbitrary[Quux[Int]] = @@ -95,8 +95,8 @@ class DerivedOFormatSuite extends FeatureSpec with Checkers { def identityLaw[A](implicit reads: Reads[A], owrites: OWrites[A], arbA: Arbitrary[A]): Unit = check((a: A) => reads.reads(owrites.writes(a)).fold(_ => false, _ == a)) - feature("default codecs represent sum types using nested JSON objects") { - scenario("default codecs represent sum types using nested JSON objects") { + Feature("default codecs represent sum types using nested JSON objects") { + Scenario("default codecs represent sum types using nested JSON objects") { sealed trait Foo case class Bar(x: Int) extends Foo case class Baz(s: String) extends Foo @@ -105,8 +105,8 @@ class DerivedOFormatSuite extends FeatureSpec with Checkers { } } - feature("sum types JSON representation can be customized") { - scenario("sum types JSON representation can be customized") { + Feature("sum types JSON representation can be customized") { + Scenario("sum types JSON representation can be customized") { sealed trait Foo case class Bar(x: Int) extends Foo case class Baz(s: String) extends Foo @@ -115,25 +115,25 @@ class DerivedOFormatSuite extends FeatureSpec with Checkers { } } - feature("case classes can have optional values") { + Feature("case classes can have optional values") { case class Foo(s: Option[String]) implicit val fooFormat: OFormat[Foo] = oformat() implicit val arbitraryFoo: Arbitrary[Foo] = Arbitrary(for (s <- arbitrary[Option[String]]) yield Foo(s)) - scenario("identity law") { + Scenario("identity law") { identityLaw[Foo] } - scenario("Missing fields are successfully decoded as `None`") { + Scenario("Missing fields are successfully decoded as `None`") { assert(fooFormat.reads(Json.obj()).asOpt.contains(Foo(None))) } - scenario("Wrong fields are errors") { + Scenario("Wrong fields are errors") { assert(fooFormat.reads(Json.obj("s" -> 42)).asOpt.isEmpty) } - scenario("Nested objects") { + Scenario("Nested objects") { case class Bar(foo: Foo) implicit val barFormat: OFormat[Bar] = oformat() implicit val arbitraryBar: Arbitrary[Bar] = @@ -146,8 +146,8 @@ class DerivedOFormatSuite extends FeatureSpec with Checkers { } } - feature("error messages must be helpful") { - scenario("error messages must be helpful") { + Feature("error messages must be helpful") { + Scenario("error messages must be helpful") { sealed trait Foo case class Bar(x: Int) extends Foo case class Baz(s: String) extends Foo @@ -161,8 +161,8 @@ class DerivedOFormatSuite extends FeatureSpec with Checkers { } } - feature("user-defined type tags") { - scenario("user-defined type tags") { + Feature("user-defined type tags") { + Scenario("user-defined type tags") { sealed trait Foo case class Bar(x: Int) extends Foo case class Baz(s: String) extends Foo diff --git a/library/src/test/scala/julienrf/json/derived/NameAdapterSuite.scala b/library/src/test/scala/julienrf/json/derived/NameAdapterSuite.scala index 038690c..a8b9172 100644 --- a/library/src/test/scala/julienrf/json/derived/NameAdapterSuite.scala +++ b/library/src/test/scala/julienrf/json/derived/NameAdapterSuite.scala @@ -2,15 +2,15 @@ package julienrf.json.derived import org.scalacheck.Arbitrary.arbitrary import org.scalacheck.{Arbitrary, Gen} -import org.scalatest.FeatureSpec -import org.scalatest.prop.Checkers +import org.scalatest.featurespec.AnyFeatureSpec +import org.scalatestplus.scalacheck.Checkers import play.api.libs.json._ -class NameAdapterSuite extends FeatureSpec with Checkers { +class NameAdapterSuite extends AnyFeatureSpec with Checkers { - feature("use camelCase as the default casing for field names") { + Feature("use camelCase as the default casing for field names") { - scenario("product type") { + Scenario("product type") { case class Foo(sC: String, iC: Int) implicit val fooArbitrary: Arbitrary[(Foo, JsValue)] = Arbitrary(for (s <- Gen.alphaStr; i <- arbitrary[Int]) yield (Foo(s, i), Json.obj("sC" -> s, "iC" -> i))) @@ -20,9 +20,9 @@ class NameAdapterSuite extends FeatureSpec with Checkers { } - feature("customize the casing for field names") { + Feature("customize the casing for field names") { - scenario("product type") { + Scenario("product type") { case class Foo(sC: String, iC: Int) implicit val fooArbitrary: Arbitrary[(Foo, JsValue)] = Arbitrary(for (s <- Gen.alphaStr; i <- arbitrary[Int]) yield (Foo(s, i), Json.obj("s_c" -> s, "i_c" -> i))) @@ -30,7 +30,7 @@ class NameAdapterSuite extends FeatureSpec with Checkers { jsonIdentityLaw[Foo] } - scenario("sum types") { + Scenario("sum types") { sealed trait Foo case class Bar(xC: Int) extends Foo case class Baz(sC: String) extends Foo @@ -50,7 +50,7 @@ class NameAdapterSuite extends FeatureSpec with Checkers { jsonIdentityLaw[Foo] } - scenario("sum types with options") { + Scenario("sum types with options") { sealed trait Foo case class Bar(xC: Int) extends Foo case class Baz(sC: String) extends Foo @@ -73,7 +73,7 @@ class NameAdapterSuite extends FeatureSpec with Checkers { - scenario("recursive type") { + Scenario("recursive type") { sealed trait Tree case class Leaf(lS: String) extends Tree case class Node(lhsSnake: Tree, rhsSnake: Tree) extends Tree diff --git a/project/build.properties b/project/build.properties index d3f83a3..797e7cc 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=0.13.17 \ No newline at end of file +sbt.version=1.3.10 diff --git a/project/plugins.sbt b/project/plugins.sbt index 2adcbdc..afd0f45 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -4,4 +4,4 @@ addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "0.9.3") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "0.5.0") -addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.29") +addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.3.0")