Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update scalatest to 3.1.0 #284

Merged
merged 4 commits into from
Dec 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
*/
package play.twirl.api.test

import org.scalatest.MustMatchers
import org.scalatest.WordSpec
import play.twirl.api._

import scala.collection.immutable
import org.scalatest.matchers.must.Matchers
import org.scalatest.wordspec.AnyWordSpec

class BufferedContentSpec extends WordSpec with MustMatchers {
class BufferedContentSpec extends AnyWordSpec with Matchers {

"equality checking" should {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
package play.twirl.api
package test

import org.scalatest.MustMatchers
import org.scalatest.WordSpec
import org.scalatest.matchers.must.Matchers
import org.scalatest.wordspec.AnyWordSpec

class FormatSpec extends WordSpec with MustMatchers {
class FormatSpec extends AnyWordSpec with Matchers {

"Formats" should {
"show null text values as empty" in {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import java.util.ArrayList
import java.util.Optional
import java.util.{ List => JList }

import org.scalatest.MustMatchers
import org.scalatest.WordSpec
import org.scalatest.matchers.must.Matchers
import org.scalatest.wordspec.AnyWordSpec

class StringInterpolationSpec extends WordSpec with MustMatchers {
class StringInterpolationSpec extends AnyWordSpec with Matchers {

"StringInterpolation" should {
"leave string parts untouched" in {
Expand Down
16 changes: 6 additions & 10 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import org.scalajs.jsenv.nodejs.NodeJSEnv
// Binary compatibility is this version
val previousVersion: Option[String] = None

val ScalaTestVersion = "3.1.0"

def binaryCompatibilitySettings(org: String, moduleName: String, scalaBinVersion: String): Set[ModuleID] = {
if (scalaBinVersion.equals(scala213)) Set.empty
else
Expand Down Expand Up @@ -91,7 +93,7 @@ lazy val api = crossProject(JVMPlatform, JSPlatform)
name := "twirl-api",
jsEnv := nodeJs,
libraryDependencies ++= scalaXml.value,
libraryDependencies += "org.scalatest" %%% "scalatest" % scalatest(scalaVersion.value) % "test",
libraryDependencies += "org.scalatest" %%% "scalatest" % ScalaTestVersion % "test",
mimaPreviousArtifacts := binaryCompatibilitySettings(
organization.value,
moduleName.value,
Expand All @@ -109,8 +111,8 @@ lazy val parser = project
.settings(
name := "twirl-parser",
libraryDependencies ++= scalaParserCombinators(scalaVersion.value),
libraryDependencies += "com.novocode" % "junit-interface" % "0.11" % "test",
libraryDependencies += "org.scalatest" %%% "scalatest" % scalatest(scalaVersion.value) % "test",
libraryDependencies += "com.novocode" % "junit-interface" % "0.11" % "test",
libraryDependencies += "org.scalatest" %%% "scalatest" % ScalaTestVersion % "test",
mimaPreviousArtifacts := binaryCompatibilitySettings(organization.value, moduleName.value, scalaBinaryVersion.value)
)

Expand Down Expand Up @@ -141,7 +143,7 @@ lazy val plugin = project
name := "sbt-twirl",
organization := "com.typesafe.sbt",
scalaVersion := scala212,
libraryDependencies += "org.scalatest" %%% "scalatest" % scalatest(scalaVersion.value) % "test",
libraryDependencies += "org.scalatest" %%% "scalatest" % ScalaTestVersion % "test",
resourceGenerators in Compile += generateVersionFile.taskValue,
scriptedDependencies := {
scriptedDependencies.value
Expand Down Expand Up @@ -175,12 +177,6 @@ def generateVersionFile = Def.task {
Seq(file)
}

// Dependencies

def scalatest(scalaV: String): String = scalaV match {
case _ => "3.0.8"
}

def scalaCompiler(version: String) = "org.scala-lang" % "scala-compiler" % version

def scalaParserCombinators(scalaVersion: String): Seq[ModuleID] = scalaVersion match {
Expand Down
53 changes: 25 additions & 28 deletions compiler/src/main/scala/play/twirl/compiler/TwirlCompiler.scala
Original file line number Diff line number Diff line change
Expand Up @@ -539,14 +539,13 @@ package """ :+ packageName :+ """
val resp = PresentationCompiler.global
.askForResponse { () =>
val functionType = "(" + params
.map(
group =>
"(" + group
.map {
case ByNameParam(_, paramType) => " => " + paramType
case a => filterType(a.tpt.toString)
}
.mkString(",") + ")"
.map(group =>
"(" + group
.map {
case ByNameParam(_, paramType) => " => " + paramType
case a => filterType(a.tpt.toString)
}
.mkString(",") + ")"
)
.mkString(" => ") + " => " + returnType + ")"

Expand All @@ -559,16 +558,15 @@ package """ :+ packageName :+ """
.mkString(",") + ")",
returnType,
params
.map(
group =>
"(" + group
.map { p =>
p.name.toString + Option(p.tpt.toString)
.filter(_.startsWith("_root_.scala.<repeated>"))
.map(_ => ".toIndexedSeq:_*")
.getOrElse("")
}
.mkString(",") + ")"
.map(group =>
"(" + group
.map { p =>
p.name.toString + Option(p.tpt.toString)
.filter(_.startsWith("_root_.scala.<repeated>"))
.map(_ => ".toIndexedSeq:_*")
.getOrElse("")
}
.mkString(",") + ")"
)
.mkString
)
Expand All @@ -588,16 +586,15 @@ package """ :+ packageName :+ """
functionType,
params.map(group => "(" + group.map(_.name.toString).mkString(",") + ")").mkString(" => "),
params
.map(
group =>
"(" + group
.map { p =>
p.name.toString + Option(p.tpt.toString)
.filter(_.startsWith("_root_.scala.<repeated>"))
.map(_ => ".toIndexedSeq:_*")
.getOrElse("")
}
.mkString(",") + ")"
.map(group =>
"(" + group
.map { p =>
p.name.toString + Option(p.tpt.toString)
.filter(_.startsWith("_root_.scala.<repeated>"))
.map(_ => ".toIndexedSeq:_*")
.getOrElse("")
}
.mkString(",") + ")"
)
.mkString
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ package test

import java.io._

import org.scalatest.MustMatchers
import org.scalatest.WordSpec
import play.twirl.api.Html
import play.twirl.parser.TwirlIO
import org.scalatest.matchers.must.Matchers
import org.scalatest.wordspec.AnyWordSpec

class CompilerSpec extends WordSpec with MustMatchers {
class CompilerSpec extends AnyWordSpec with Matchers {

import Helper._

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
package play.twirl.compiler
package test

import org.scalatest.MustMatchers
import org.scalatest.WordSpec
import play.twirl.api._

import scala.collection.immutable
import org.scalatest.matchers.must.Matchers
import org.scalatest.wordspec.AnyWordSpec

class TemplateUtilsSpec extends WordSpec with MustMatchers {
class TemplateUtilsSpec extends AnyWordSpec with Matchers {

"Templates" should {

Expand Down
6 changes: 3 additions & 3 deletions parser/src/test/scala/play/twirl/parser/test/ParserSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ package play.twirl.parser
package test

import org.scalatest.Inside
import org.scalatest.MustMatchers
import org.scalatest.WordSpec
import play.twirl.parser.TreeNodes._
import org.scalatest.matchers.must.Matchers
import org.scalatest.wordspec.AnyWordSpec

class ParserSpec extends WordSpec with MustMatchers with Inside {
class ParserSpec extends AnyWordSpec with Matchers with Inside {

val parser = new TwirlParser(shouldParseInclusiveDot = false)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ package play.twirl.sbt
package test

import org.scalatest.Inspectors
import org.scalatest.MustMatchers
import org.scalatest.WordSpec
import play.twirl.sbt.TemplateProblem.TemplateMapping
import play.twirl.sbt.TemplateProblem.TemplateMapping.Location
import org.scalatest.matchers.must.Matchers
import org.scalatest.wordspec.AnyWordSpec

class TemplateMappingSpec extends WordSpec with MustMatchers with Inspectors {
class TemplateMappingSpec extends AnyWordSpec with Matchers with Inspectors {

"TemplateMapping" should {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import java.io.File
import play.twirl.sbt.TemplateProblem.TemplateMapping
import play.twirl.sbt.TemplateProblem.TemplatePosition
import org.scalatest.Inspectors
import org.scalatest.MustMatchers
import org.scalatest.WordSpec
import org.scalatest.matchers.must.Matchers
import org.scalatest.wordspec.AnyWordSpec

class TemplatePositionSpec extends WordSpec with MustMatchers with Inspectors {
class TemplatePositionSpec extends AnyWordSpec with Matchers with Inspectors {

"TemplatePosition" should {

Expand Down