Merge pull request #6710 from xuwei-k/update-scalatest

Update scalatest
This commit is contained in:
eugene yokota 2021-11-14 21:34:29 -05:00 committed by GitHub
commit ad6f07bfee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
26 changed files with 59 additions and 50 deletions

View File

@ -7,6 +7,7 @@
package sbt.internal.util
import org.scalatest._
import org.scalatest.flatspec.AnyFlatSpec
import org.scalatest.matchers.should.Matchers
abstract class UnitSpec extends FlatSpec with Matchers
abstract class UnitSpec extends AnyFlatSpec with Matchers

View File

@ -7,6 +7,7 @@
package sbt.internal.util
import org.scalatest._
import org.scalatest.flatspec.AnyFlatSpec
import org.scalatest.matchers.should.Matchers
abstract class UnitSpec extends FlatSpec with Matchers
abstract class UnitSpec extends AnyFlatSpec with Matchers

View File

@ -7,9 +7,9 @@
package sbt.internal.util.complete
import org.scalatest.FlatSpec
import org.scalatest.flatspec.AnyFlatSpec
class SizeParserSpec extends FlatSpec {
class SizeParserSpec extends AnyFlatSpec {
"SizeParser" should "handle raw bytes" in {
assert(Parser.parse(str = "123456", SizeParser.value) == Right(123456L))
}

View File

@ -9,9 +9,10 @@ package sbt.util
import sbt.internal.util._
import org.scalatest._
import org.scalatest.flatspec.AnyFlatSpec
import org.scalatest.matchers.should.Matchers
class LogExchangeSpec extends FlatSpec with Matchers {
class LogExchangeSpec extends AnyFlatSpec with Matchers {
import LogExchange._
checkTypeTag("stringTypeTagThrowable", stringTypeTagThrowable, StringTypeTag.fast[Throwable])

View File

@ -7,13 +7,14 @@
package sbt.internal.util
import org.scalatest._
import org.scalatest.flatspec.AnyFlatSpec
import org.scalatest.matchers.should.Matchers
import sbt.util._
import java.io.{ File, PrintWriter }
import sbt.io.Using
import scala.annotation.nowarn
class ManagedLoggerSpec extends FlatSpec with Matchers {
class ManagedLoggerSpec extends AnyFlatSpec with Matchers {
val context = LoggerContext(useLog4J = true)
@nowarn
val asyncStdout = new ConsoleAppenderFromLog4J("asyncStdout", LogExchange.asyncStdout)

View File

@ -7,9 +7,9 @@
package sbt.internal.util
import org.scalatest.FlatSpec
import org.scalatest.flatspec.AnyFlatSpec
class CleanStringSpec extends FlatSpec {
class CleanStringSpec extends AnyFlatSpec {
"EscHelpers" should "not modify normal strings" in {
val cleanString = s"1234"
assert(EscHelpers.stripColorsAndMoves(cleanString) == cleanString)

View File

@ -9,12 +9,13 @@ package sbt.internal.util
import java.io.{ File, PrintStream }
import org.scalatest.{ BeforeAndAfterAll, FlatSpec }
import org.scalatest.flatspec.AnyFlatSpec
import org.scalatest.BeforeAndAfterAll
import sbt.internal.util.Terminal.SimpleTerminal
import scala.io.Source
class ProgressStateSpec extends FlatSpec with BeforeAndAfterAll {
class ProgressStateSpec extends AnyFlatSpec with BeforeAndAfterAll {
private lazy val fileIn = new File("/tmp/tmp.txt")
private lazy val fileOut = Source.fromFile("/tmp/tmp.txt")

View File

@ -9,10 +9,10 @@ package sbt.internal.util
import java.io.InputStream
import java.nio.charset.Charset
import org.scalatest.FlatSpec
import org.scalatest.flatspec.AnyFlatSpec
import java.util.concurrent.LinkedBlockingQueue
class UTF8DecoderSpec extends FlatSpec {
class UTF8DecoderSpec extends AnyFlatSpec {
val decoder = Charset.forName("UTF-8").newDecoder
"ascii characters" should "not be modified" in {
val inputStream = new InputStream {

View File

@ -7,9 +7,9 @@
package sbt.internal.util
import org.scalatest._
import org.scalatest.flatspec.AnyFlatSpec
class SourcePositionSpec extends FlatSpec {
class SourcePositionSpec extends AnyFlatSpec {
"SourcePosition()" should "return a sane SourcePosition" in {
val filename = "SourcePositionSpec.scala"
val lineNumber = 16

View File

@ -8,7 +8,7 @@
package sbt
import scala.concurrent.duration._
import org.scalatest.FlatSpec
import org.scalatest.flatspec.AnyFlatSpec
import sbt.internal.util.complete.Parser
object MultiParserSpec {
@ -22,7 +22,7 @@ object MultiParserSpec {
}
}
import sbt.MultiParserSpec._
class MultiParserSpec extends FlatSpec {
class MultiParserSpec extends AnyFlatSpec {
"parsing" should "parse single commands" in {
assert(";foo".parse == Seq("foo"))
assert("; foo".parse == Seq("foo"))

View File

@ -10,7 +10,8 @@ package sbt.internal
import java.io.File
import java.nio.file.Files
import org.scalatest.{ FlatSpec, Matchers }
import org.scalatest.flatspec.AnyFlatSpec
import org.scalatest.matchers.should.Matchers
import sbt.internal.classpath.ClassLoaderCache
import sbt.io.IO
@ -19,7 +20,7 @@ object ClassLoaderCacheTest {
def get(classpath: Seq[File]): ClassLoader = c(classpath.toList)
}
}
class ClassLoaderCacheTest extends FlatSpec with Matchers {
class ClassLoaderCacheTest extends AnyFlatSpec with Matchers {
import ClassLoaderCacheTest._
private def withCache[R](f: ClassLoaderCache => R): R = {
val cache = new ClassLoaderCache(ClassLoader.getSystemClassLoader)

View File

@ -7,12 +7,12 @@
package sbt
import org.scalatest.FlatSpec
import org.scalatest.flatspec.AnyFlatSpec
import sbt.internal.util.{ AttributeKey, AttributeMap }
import sbt.io.syntax.file
import scala.annotation.nowarn
class ScopeDisplaySpec extends FlatSpec {
class ScopeDisplaySpec extends AnyFlatSpec {
val project = ProjectRef(file("foo/bar"), "bar")
val mangledName = "bar_slash_blah_blah_blah"

View File

@ -7,12 +7,12 @@
package sbt.std
import org.scalatest.{ TestData, fixture }
import org.scalatest.{ TestData, fixture, funsuite }
import sbt.std.TestUtil._
import scala.tools.reflect.{ FrontEnd, ToolBoxError }
class TaskConfigSpec extends fixture.FunSuite with fixture.TestDataFixture {
class TaskConfigSpec extends funsuite.FixtureAnyFunSuite with fixture.TestDataFixture {
private def expectError(
errorSnippet: String,
compileOptions: String = "",

View File

@ -8,11 +8,11 @@
package sbt.std.neg
import scala.tools.reflect.ToolBoxError
import org.scalatest.{ TestData, fixture }
import org.scalatest.{ TestData, fixture, funsuite }
import sbt.std.{ TaskLinterDSLFeedback, TestUtil }
import sbt.std.TestUtil._
class TaskNegSpec extends fixture.FunSuite with fixture.TestDataFixture {
class TaskNegSpec extends funsuite.FixtureAnyFunSuite with fixture.TestDataFixture {
def expectError(
errorSnippet: String,
compileOptions: String = "",

View File

@ -8,11 +8,12 @@
package sbt
package internal
import org.scalatest._
import org.scalatest.diagrams.Diagrams
import org.scalatest.funsuite.AnyFunSuite
import sbt.internal.CrossJava.JavaDiscoverConfig._
import scala.collection.immutable.ListMap
class CrossJavaTest extends FunSuite with DiagrammedAssertions {
class CrossJavaTest extends AnyFunSuite with Diagrams {
test("The Java home selector should select the most recent") {
assert(
List("jdk1.8.0.jdk", "jdk1.8.0_121.jdk", "jdk1.8.0_45.jdk")

View File

@ -9,13 +9,13 @@ package sbt.internal
import java.nio.file.{ Path, Paths }
import org.scalatest.FlatSpec
import org.scalatest.flatspec.AnyFlatSpec
import sbt.nio.FileStamp
import sbt.nio.FileStamp.Formats
import sjsonnew.JsonFormat
import sjsonnew.support.scalajson.unsafe.Converter
class FileStampJsonSpec extends FlatSpec {
class FileStampJsonSpec extends AnyFlatSpec {
"file hashes" should "be serializable" in {
val hashes = Seq(
Paths.get("foo") -> FileStamp.hash("bar"),

View File

@ -9,12 +9,12 @@ package sbt.internal
import java.util.concurrent.atomic.AtomicReference
import org.scalatest.FunSuite
import org.scalatest.funsuite.AnyFunSuite
import scala.collection.mutable.ListBuffer
import scala.concurrent.duration._
class GCMonitorTest extends FunSuite {
class GCMonitorTest extends AnyFunSuite {
class TestMonitor extends GCMonitorBase {
val loggedTotals = ListBuffer.empty[Long]
override protected val window = 10.seconds

View File

@ -13,10 +13,10 @@ import java.lang.ProcessBuilder
import java.lang.ProcessBuilder.Redirect
import java.nio.file.{ Files, Path }
import java.util.concurrent.TimeUnit
import org.scalatest.FlatSpec
import org.scalatest.flatspec.AnyFlatSpec
import sbt.io.IO
class InstallSbtnSpec extends FlatSpec {
class InstallSbtnSpec extends AnyFlatSpec {
private def withTemp[R](ext: String)(f: Path => R): R = {
val tmp = Files.createTempFile("sbt-1.4.1-", ext)
try f(tmp)

View File

@ -7,11 +7,12 @@
package sbt.internal.graph.rendering
import org.scalatest.{ FlatSpec, Matchers }
import org.scalatest.flatspec.AnyFlatSpec
import org.scalatest.matchers.should.Matchers
import sbt.internal.graph.rendering.TreeView.createJson
import sbt.internal.graph.{ GraphModuleId, Module, ModuleGraph, ModuleModel }
class TreeViewTest extends FlatSpec with Matchers {
class TreeViewTest extends AnyFlatSpec with Matchers {
val modA = GraphModuleId("orgA", "nameA", "1.0")
val modB = GraphModuleId("orgB", "nameB", "2.0")
val modC = GraphModuleId("orgC", "nameC", "3.0")

View File

@ -94,7 +94,7 @@ object Dependencies {
val jline3Reader = "org.jline" % "jline-reader" % jline3Version
val jline3Builtins = "org.jline" % "jline-builtins" % jline3Version
val jansi = "org.fusesource.jansi" % "jansi" % "2.1.0"
val scalatest = "org.scalatest" %% "scalatest" % "3.0.8"
val scalatest = "org.scalatest" %% "scalatest" % "3.2.10"
val scalacheck = "org.scalacheck" %% "scalacheck" % "1.14.0"
val junit = "junit" % "junit" % "4.13.1"
val scalaVerify = "com.eed3si9n.verify" %% "verify" % "1.0.0"

View File

@ -8,11 +8,11 @@
package sbt
import org.scalatest
import org.scalatest.{ TestData, fixture }
import org.scalatest.{ TestData, fixture, funsuite }
import scala.tools.reflect.{ FrontEnd, ToolBoxError }
class IllegalReferenceSpec extends fixture.FunSuite with fixture.TestDataFixture {
class IllegalReferenceSpec extends funsuite.FixtureAnyFunSuite with fixture.TestDataFixture {
private def toolboxClasspath(td: TestData): String =
td.configMap.get("sbt.server.classpath") match {
case Some(s: String) => s

View File

@ -12,9 +12,9 @@ import sbt.io.syntax._
import CacheImplicits._
import org.scalatest.FlatSpec
import org.scalatest.flatspec.AnyFlatSpec
class CacheSpec extends FlatSpec {
class CacheSpec extends AnyFlatSpec {
"A cache" should "NOT throw an exception if read without being written previously" in {
testCache[String, Int] {

View File

@ -9,10 +9,10 @@ package sbt.util
import sjsonnew.shaded.scalajson.ast.unsafe._
import sjsonnew._, support.scalajson.unsafe._
import org.scalatest.FlatSpec
import org.scalatest.flatspec.AnyFlatSpec
import sbt.io.IO
class FileInfoSpec extends FlatSpec {
class FileInfoSpec extends AnyFlatSpec {
val file = new java.io.File(".").getAbsoluteFile
val fileInfo: ModifiedFileInfo = FileModified(file, IO.getModifiedTimeOrZero(file))
val filesInfo = FilesInfo(Set(fileInfo))

View File

@ -13,9 +13,9 @@ import sbt.io.syntax._
import CacheImplicits._
import sjsonnew.{ Builder, deserializationError, JsonFormat, Unbuilder }
import org.scalatest.FlatSpec
import org.scalatest.flatspec.AnyFlatSpec
class SingletonCacheSpec extends FlatSpec {
class SingletonCacheSpec extends AnyFlatSpec {
case class ComplexType(val x: Int, y: String, z: List[Int])
object ComplexType {

View File

@ -7,7 +7,7 @@
package sbt.util
import org.scalatest.FlatSpec
import org.scalatest.flatspec.AnyFlatSpec
import sbt.io.IO
import sbt.io.syntax._
import sbt.util.CacheImplicits._
@ -15,7 +15,7 @@ import sjsonnew.{ Builder, JsonWriter }
import scala.concurrent.Promise
class TrackedSpec extends FlatSpec {
class TrackedSpec extends AnyFlatSpec {
"lastOutput" should "store the last output" in {
withStore { store =>
val value = 5

View File

@ -17,6 +17,7 @@ import sbt.librarymanagement.ivy._
import sbt.util.Logger
import xsbti.compile.CompilerBridgeProvider
import org.scalatest._
import org.scalatest.matchers.should.Matchers
/**
* Base class for test suites that must be able to fetch and compile the compiler bridge.
@ -24,7 +25,7 @@ import org.scalatest._
* This is a very good example on how to instantiate the compiler bridge provider.
*/
abstract class IvyBridgeProviderSpecification
extends fixture.FlatSpec
extends flatspec.FixtureAnyFlatSpec
with fixture.TestDataFixture
with Matchers {
def currentBase: File = new File(".")