diff options
| author | Jim Lawson | 2020-03-25 09:35:21 -0700 |
|---|---|---|
| committer | GitHub | 2020-03-25 16:35:21 +0000 |
| commit | 9995f081291d974a6b5ad319e67a9d19cdc4a56d (patch) | |
| tree | 351bcbc4cedc97ffbb219f043c4961e52d12ada7 /src | |
| parent | bdac6e1c55694f1562a56b2eb0716733bd2f1fc0 (diff) | |
Update scalatest 3.1.0 (#1383)
* Removed unused imports in src/test/
* Update ScalaTest deprecations.
* Update scalatest from 3.0.8 to 3.1.0; apply auto fix for deprecations
Co-authored-by: Jack Koenig <koenig@sifive.com>
Diffstat (limited to 'src')
34 files changed, 116 insertions, 82 deletions
diff --git a/src/test/scala/firrtl/JsonProtocolSpec.scala b/src/test/scala/firrtl/JsonProtocolSpec.scala index 57c460a8..7d04e9fc 100644 --- a/src/test/scala/firrtl/JsonProtocolSpec.scala +++ b/src/test/scala/firrtl/JsonProtocolSpec.scala @@ -2,10 +2,10 @@ package firrtlTests -import org.scalatest.FlatSpec import org.json4s._ import firrtl.annotations.{NoTargetAnnotation, JsonProtocol, InvalidAnnotationJSONException, HasSerializationHints, Annotation} +import org.scalatest.flatspec.AnyFlatSpec object JsonProtocolTestClasses { trait Parent @@ -25,7 +25,7 @@ object JsonProtocolTestClasses { import JsonProtocolTestClasses._ -class JsonProtocolSpec extends FlatSpec { +class JsonProtocolSpec extends AnyFlatSpec { def serializeAndDeserialize(anno: Annotation): Annotation = { val serializedAnno = JsonProtocol.serialize(Seq(anno)) JsonProtocol.deserialize(serializedAnno).head diff --git a/src/test/scala/firrtl/stage/phases/tests/DriverCompatibilitySpec.scala b/src/test/scala/firrtl/stage/phases/tests/DriverCompatibilitySpec.scala index 89f2ec07..64654175 100644 --- a/src/test/scala/firrtl/stage/phases/tests/DriverCompatibilitySpec.scala +++ b/src/test/scala/firrtl/stage/phases/tests/DriverCompatibilitySpec.scala @@ -2,7 +2,7 @@ package firrtl.stage.phases.tests -import org.scalatest.{FlatSpec, Matchers, PrivateMethodTester} +import org.scalatest.PrivateMethodTester import java.io.File import firrtl._ @@ -10,8 +10,10 @@ import firrtl.stage.phases.DriverCompatibility._ import firrtl.options.{InputAnnotationFileAnnotation, Phase, TargetDirAnnotation} import firrtl.stage.{CompilerAnnotation, FirrtlCircuitAnnotation, FirrtlFileAnnotation, FirrtlSourceAnnotation, OutputFileAnnotation, RunFirrtlTransformAnnotation} import firrtl.stage.phases.DriverCompatibility +import org.scalatest.flatspec.AnyFlatSpec +import org.scalatest.matchers.should.Matchers -class DriverCompatibilitySpec extends FlatSpec with Matchers with PrivateMethodTester { +class DriverCompatibilitySpec extends AnyFlatSpec with Matchers with PrivateMethodTester { class PhaseFixture(val phase: Phase) diff --git a/src/test/scala/firrtl/testutils/FirrtlSpec.scala b/src/test/scala/firrtl/testutils/FirrtlSpec.scala index 46f36e87..4cc9382f 100644 --- a/src/test/scala/firrtl/testutils/FirrtlSpec.scala +++ b/src/test/scala/firrtl/testutils/FirrtlSpec.scala @@ -18,6 +18,9 @@ import firrtl.analyses.{GetNamespace, ModuleNamespaceAnnotation} import firrtl.annotations._ import firrtl.transforms.{DontTouchAnnotation, NoDedupAnnotation, RenameModules} import firrtl.util.BackendCompilationUtilities +import org.scalatest.flatspec.AnyFlatSpec +import org.scalatest.matchers.should.Matchers +import org.scalatest.propspec.AnyPropSpec class CheckLowForm extends SeqTransform { def inputForm = LowForm @@ -255,9 +258,9 @@ object FirrtlCheckers extends FirrtlMatchers { } } -abstract class FirrtlPropSpec extends PropSpec with ScalaCheckPropertyChecks with FirrtlRunners with LazyLogging +abstract class FirrtlPropSpec extends AnyPropSpec with ScalaCheckPropertyChecks with FirrtlRunners with LazyLogging -abstract class FirrtlFlatSpec extends FlatSpec with FirrtlRunners with FirrtlMatchers with LazyLogging +abstract class FirrtlFlatSpec extends AnyFlatSpec with FirrtlRunners with FirrtlMatchers with LazyLogging // Who tests the testers? class TestFirrtlFlatSpec extends FirrtlFlatSpec { diff --git a/src/test/scala/firrtl/testutils/PassTests.scala b/src/test/scala/firrtl/testutils/PassTests.scala index c172163e..3d820003 100644 --- a/src/test/scala/firrtl/testutils/PassTests.scala +++ b/src/test/scala/firrtl/testutils/PassTests.scala @@ -2,7 +2,7 @@ package firrtl.testutils -import org.scalatest.FlatSpec +import org.scalatest.flatspec.AnyFlatSpec import firrtl.ir.Circuit import firrtl.passes.{PassExceptions, RemoveEmpty} import firrtl.transforms.DedupModules @@ -12,7 +12,7 @@ import logger._ // An example methodology for testing Firrtl Passes // Spec class should extend this class -abstract class SimpleTransformSpec extends FlatSpec with FirrtlMatchers with Compiler with LazyLogging { +abstract class SimpleTransformSpec extends AnyFlatSpec with FirrtlMatchers with Compiler with LazyLogging { // Utility function def squash(c: Circuit): Circuit = RemoveEmpty.run(c) diff --git a/src/test/scala/firrtlTests/AnnotationTests.scala b/src/test/scala/firrtlTests/AnnotationTests.scala index 8077d314..31ee9680 100644 --- a/src/test/scala/firrtlTests/AnnotationTests.scala +++ b/src/test/scala/firrtlTests/AnnotationTests.scala @@ -14,7 +14,7 @@ import firrtl.passes.memlib.PinAnnotation import firrtl.util.BackendCompilationUtilities import firrtl.testutils._ import net.jcazevedo.moultingyaml._ -import org.scalatest.Matchers +import org.scalatest.matchers.should.Matchers /** * An example methodology for testing Firrtl annotations. diff --git a/src/test/scala/firrtlTests/CheckSpec.scala b/src/test/scala/firrtlTests/CheckSpec.scala index aa154bab..c622bde5 100644 --- a/src/test/scala/firrtlTests/CheckSpec.scala +++ b/src/test/scala/firrtlTests/CheckSpec.scala @@ -6,8 +6,10 @@ import org.scalatest._ import firrtl.{Parser, CircuitState, UnknownForm, Transform} import firrtl.ir.Circuit import firrtl.passes.{Pass,ToWorkingIR,CheckHighForm,ResolveKinds,InferTypes,CheckTypes,PassException,InferWidths,CheckWidths,ResolveFlows,CheckFlows} +import org.scalatest.flatspec.AnyFlatSpec +import org.scalatest.matchers.should.Matchers -class CheckSpec extends FlatSpec with Matchers { +class CheckSpec extends AnyFlatSpec with Matchers { val defaultPasses = Seq(ToWorkingIR, CheckHighForm) def checkHighInput(input: String) = { defaultPasses.foldLeft(Parser.parse(input.split("\n").toIterator)) { diff --git a/src/test/scala/firrtlTests/CompilerTests.scala b/src/test/scala/firrtlTests/CompilerTests.scala index 8e17ceb1..6c51c252 100644 --- a/src/test/scala/firrtlTests/CompilerTests.scala +++ b/src/test/scala/firrtlTests/CompilerTests.scala @@ -2,8 +2,8 @@ package firrtlTests -import org.scalatest.FlatSpec -import org.scalatest.Matchers +import org.scalatest.flatspec.AnyFlatSpec +import org.scalatest.matchers.should.Matchers import firrtl.ir.Circuit import firrtl.{ @@ -25,7 +25,7 @@ import firrtl.{ * the compiler is executed. The output of the compiler * should be compared against the check string. */ -abstract class CompilerSpec extends FlatSpec { +abstract class CompilerSpec extends AnyFlatSpec { def parse (s: String): Circuit = Parser.parse(s.split("\n").toIterator) def compiler: Compiler def input: String diff --git a/src/test/scala/firrtlTests/DriverSpec.scala b/src/test/scala/firrtlTests/DriverSpec.scala index f59ccb2c..cd644041 100644 --- a/src/test/scala/firrtlTests/DriverSpec.scala +++ b/src/test/scala/firrtlTests/DriverSpec.scala @@ -4,7 +4,8 @@ package firrtlTests import java.io.{File, FileWriter} -import org.scalatest.{FreeSpec, Matchers} +import org.scalatest.freespec.AnyFreeSpec +import org.scalatest.matchers.should.Matchers import firrtl.passes.InlineAnnotation import firrtl.passes.memlib.{InferReadWriteAnnotation, ReplSeqMemAnnotation} import firrtl.transforms.BlackBoxTargetDirAnno @@ -28,7 +29,7 @@ object ExceptingTransform { } //noinspection ScalaStyle -class DriverSpec extends FreeSpec with Matchers with BackendCompilationUtilities { +class DriverSpec extends AnyFreeSpec with Matchers with BackendCompilationUtilities { val outputDir = createTestDirectory("DriverSpec") "CommonOptions are some simple options available across the chisel3 ecosystem" - { "CommonOption provide an scopt implementation of an OptionParser" - { diff --git a/src/test/scala/firrtlTests/ExecutionOptionsManagerSpec.scala b/src/test/scala/firrtlTests/ExecutionOptionsManagerSpec.scala index 7f561051..863b6900 100644 --- a/src/test/scala/firrtlTests/ExecutionOptionsManagerSpec.scala +++ b/src/test/scala/firrtlTests/ExecutionOptionsManagerSpec.scala @@ -3,9 +3,10 @@ package firrtlTests import firrtl._ -import org.scalatest.{Matchers, FreeSpec} +import org.scalatest.freespec.AnyFreeSpec +import org.scalatest.matchers.should.Matchers -class ExecutionOptionsManagerSpec extends FreeSpec with Matchers { +class ExecutionOptionsManagerSpec extends AnyFreeSpec with Matchers { "ExecutionOptionsManager is a container for one more more ComposableOptions Block" - { "It has a default CommonOptionsBlock" in { val manager = new ExecutionOptionsManager("test") diff --git a/src/test/scala/firrtlTests/FileUtilsSpec.scala b/src/test/scala/firrtlTests/FileUtilsSpec.scala index 1a23fb48..7b643e84 100644 --- a/src/test/scala/firrtlTests/FileUtilsSpec.scala +++ b/src/test/scala/firrtlTests/FileUtilsSpec.scala @@ -2,11 +2,12 @@ package firrtlTests -import org.scalatest.{FlatSpec, Matchers} import firrtl.FileUtils +import org.scalatest.flatspec.AnyFlatSpec +import org.scalatest.matchers.should.Matchers -class FileUtilsSpec extends FlatSpec with Matchers { +class FileUtilsSpec extends AnyFlatSpec with Matchers { private val sampleAnnotations: String = "annotations/SampleAnnotations.anno" private val sampleAnnotationsFileName: String = s"src/test/resources/$sampleAnnotations" diff --git a/src/test/scala/firrtlTests/UtilsSpec.scala b/src/test/scala/firrtlTests/UtilsSpec.scala index a1a72634..069c160e 100644 --- a/src/test/scala/firrtlTests/UtilsSpec.scala +++ b/src/test/scala/firrtlTests/UtilsSpec.scala @@ -1,11 +1,10 @@ package firrtlTests -import org.scalatest.FlatSpec -import org.scalatest.Matchers._ - import firrtl.Utils +import org.scalatest.matchers.should.Matchers._ +import org.scalatest.flatspec.AnyFlatSpec -class UtilsSpec extends FlatSpec { +class UtilsSpec extends AnyFlatSpec { behavior of "Utils.expandPrefix" diff --git a/src/test/scala/firrtlTests/VerilogMemDelaySpec.scala b/src/test/scala/firrtlTests/VerilogMemDelaySpec.scala index e7f27d0e..52f9ee36 100644 --- a/src/test/scala/firrtlTests/VerilogMemDelaySpec.scala +++ b/src/test/scala/firrtlTests/VerilogMemDelaySpec.scala @@ -5,9 +5,10 @@ package firrtlTests import firrtl._ import firrtl.passes.memlib.VerilogMemDelays import firrtl.passes.CheckHighForm -import org.scalatest.{FreeSpec, Matchers} +import org.scalatest.freespec.AnyFreeSpec +import org.scalatest.matchers.should.Matchers -class VerilogMemDelaySpec extends FreeSpec with Matchers { +class VerilogMemDelaySpec extends AnyFreeSpec with Matchers { "The following low FIRRTL should be parsed by VerilogMemDelays" in { val input = """ diff --git a/src/test/scala/firrtlTests/annotationTests/LoadMemoryAnnotationSpec.scala b/src/test/scala/firrtlTests/annotationTests/LoadMemoryAnnotationSpec.scala index c702df13..5fa345bf 100644 --- a/src/test/scala/firrtlTests/annotationTests/LoadMemoryAnnotationSpec.scala +++ b/src/test/scala/firrtlTests/annotationTests/LoadMemoryAnnotationSpec.scala @@ -3,9 +3,10 @@ package firrtlTests.annotationTests import firrtl.annotations._ -import org.scalatest.{FreeSpec, Matchers} +import org.scalatest.freespec.AnyFreeSpec +import org.scalatest.matchers.should.Matchers -class LoadMemoryAnnotationSpec extends FreeSpec with Matchers { +class LoadMemoryAnnotationSpec extends AnyFreeSpec with Matchers { "LoadMemoryAnnotation getFileName" - { "add name of subcomponent to file name when a memory was split" in { val lma = new LoadMemoryAnnotation( diff --git a/src/test/scala/firrtlTests/constraint/InequalitySpec.scala b/src/test/scala/firrtlTests/constraint/InequalitySpec.scala index 02a853cb..8b26c80c 100644 --- a/src/test/scala/firrtlTests/constraint/InequalitySpec.scala +++ b/src/test/scala/firrtlTests/constraint/InequalitySpec.scala @@ -1,10 +1,11 @@ package firrtlTests.constraint import firrtl.constraint._ -import org.scalatest.{FlatSpec, Matchers} import firrtl.ir.Closed +import org.scalatest.flatspec.AnyFlatSpec +import org.scalatest.matchers.should.Matchers -class InequalitySpec extends FlatSpec with Matchers { +class InequalitySpec extends AnyFlatSpec with Matchers { behavior of "Constraints" diff --git a/src/test/scala/firrtlTests/options/OptionParserSpec.scala b/src/test/scala/firrtlTests/options/OptionParserSpec.scala index 1d055801..b8efbdb6 100644 --- a/src/test/scala/firrtlTests/options/OptionParserSpec.scala +++ b/src/test/scala/firrtlTests/options/OptionParserSpec.scala @@ -8,9 +8,10 @@ import firrtl.options.{DoNotTerminateOnExit, DuplicateHandling, ExceptOnError, O import scopt.OptionParser -import org.scalatest.{FlatSpec, Matchers} +import org.scalatest.flatspec.AnyFlatSpec +import org.scalatest.matchers.should.Matchers -class OptionParserSpec extends FlatSpec with Matchers with firrtl.testutils.Utils { +class OptionParserSpec extends AnyFlatSpec with Matchers with firrtl.testutils.Utils { case class IntAnnotation(x: Int) extends NoTargetAnnotation { def extract: Int = x diff --git a/src/test/scala/firrtlTests/options/OptionsViewSpec.scala b/src/test/scala/firrtlTests/options/OptionsViewSpec.scala index 0953027f..0c868cb2 100644 --- a/src/test/scala/firrtlTests/options/OptionsViewSpec.scala +++ b/src/test/scala/firrtlTests/options/OptionsViewSpec.scala @@ -2,13 +2,14 @@ package firrtlTests.options -import org.scalatest.{FlatSpec, Matchers} import firrtl.options.OptionsView import firrtl.AnnotationSeq import firrtl.annotations.{Annotation,NoTargetAnnotation} +import org.scalatest.flatspec.AnyFlatSpec +import org.scalatest.matchers.should.Matchers -class OptionsViewSpec extends FlatSpec with Matchers { +class OptionsViewSpec extends AnyFlatSpec with Matchers { /* Annotations */ case class NameAnnotation(name: String) extends NoTargetAnnotation diff --git a/src/test/scala/firrtlTests/options/PhaseManagerSpec.scala b/src/test/scala/firrtlTests/options/PhaseManagerSpec.scala index 744d621e..f9e4b444 100644 --- a/src/test/scala/firrtlTests/options/PhaseManagerSpec.scala +++ b/src/test/scala/firrtlTests/options/PhaseManagerSpec.scala @@ -2,7 +2,6 @@ package firrtlTests.options -import org.scalatest.{FlatSpec, Matchers} import firrtl.AnnotationSeq import firrtl.options.{DependencyManagerException, Phase, PhaseManager, PreservesAll, Dependency} @@ -10,6 +9,8 @@ import firrtl.options.{DependencyManagerException, Phase, PhaseManager, Preserve import java.io.{File, PrintWriter} import sys.process._ +import org.scalatest.flatspec.AnyFlatSpec +import org.scalatest.matchers.should.Matchers trait IdentityPhase extends Phase { def transform(annotations: AnnotationSeq): AnnotationSeq = annotations @@ -381,7 +382,7 @@ object OrderingFixture { } -class PhaseManagerSpec extends FlatSpec with Matchers { +class PhaseManagerSpec extends AnyFlatSpec with Matchers { def writeGraphviz(pm: PhaseManager, dir: String): Unit = { diff --git a/src/test/scala/firrtlTests/options/RegistrationSpec.scala b/src/test/scala/firrtlTests/options/RegistrationSpec.scala index 00b705df..41b5bbf6 100644 --- a/src/test/scala/firrtlTests/options/RegistrationSpec.scala +++ b/src/test/scala/firrtlTests/options/RegistrationSpec.scala @@ -2,7 +2,8 @@ package firrtlTests.options -import org.scalatest.{FlatSpec, Matchers} +import org.scalatest.flatspec.AnyFlatSpec +import org.scalatest.matchers.should.Matchers import java.util.ServiceLoader import firrtl.options.{RegisteredTransform, RegisteredLibrary, ShellOption} @@ -33,7 +34,7 @@ class BarLibrary extends RegisteredLibrary { helpText = "World option") ) } -class RegistrationSpec extends FlatSpec with Matchers { +class RegistrationSpec extends AnyFlatSpec with Matchers { behavior of "RegisteredTransform" diff --git a/src/test/scala/firrtlTests/options/ShellSpec.scala b/src/test/scala/firrtlTests/options/ShellSpec.scala index 50000550..af6b2669 100644 --- a/src/test/scala/firrtlTests/options/ShellSpec.scala +++ b/src/test/scala/firrtlTests/options/ShellSpec.scala @@ -2,12 +2,13 @@ package firrtlTests.options -import org.scalatest.{FlatSpec, Matchers} import firrtl.annotations.NoTargetAnnotation import firrtl.options.Shell +import org.scalatest.flatspec.AnyFlatSpec +import org.scalatest.matchers.should.Matchers -class ShellSpec extends FlatSpec with Matchers { +class ShellSpec extends AnyFlatSpec with Matchers { case object A extends NoTargetAnnotation case object B extends NoTargetAnnotation diff --git a/src/test/scala/firrtlTests/options/phases/AddDefaultsSpec.scala b/src/test/scala/firrtlTests/options/phases/AddDefaultsSpec.scala index 362d139f..3401a408 100644 --- a/src/test/scala/firrtlTests/options/phases/AddDefaultsSpec.scala +++ b/src/test/scala/firrtlTests/options/phases/AddDefaultsSpec.scala @@ -2,12 +2,13 @@ package firrtlTests.options.phases -import org.scalatest.{FlatSpec, Matchers} import firrtl.options.{Phase, TargetDirAnnotation} import firrtl.options.phases.AddDefaults +import org.scalatest.flatspec.AnyFlatSpec +import org.scalatest.matchers.should.Matchers -class AddDefaultsSpec extends FlatSpec with Matchers { +class AddDefaultsSpec extends AnyFlatSpec with Matchers { class Fixture { val phase: Phase = new AddDefaults diff --git a/src/test/scala/firrtlTests/options/phases/ChecksSpec.scala b/src/test/scala/firrtlTests/options/phases/ChecksSpec.scala index b988f838..96d6569d 100644 --- a/src/test/scala/firrtlTests/options/phases/ChecksSpec.scala +++ b/src/test/scala/firrtlTests/options/phases/ChecksSpec.scala @@ -2,13 +2,14 @@ package firrtlTests.options.phases -import org.scalatest.{FlatSpec, Matchers} import firrtl.AnnotationSeq import firrtl.options.{OptionsException, OutputAnnotationFileAnnotation, Phase, TargetDirAnnotation} import firrtl.options.phases.Checks +import org.scalatest.flatspec.AnyFlatSpec +import org.scalatest.matchers.should.Matchers -class ChecksSpec extends FlatSpec with Matchers { +class ChecksSpec extends AnyFlatSpec with Matchers { val targetDir = TargetDirAnnotation("foo") val annoOut = OutputAnnotationFileAnnotation("bar") diff --git a/src/test/scala/firrtlTests/options/phases/GetIncludesSpec.scala b/src/test/scala/firrtlTests/options/phases/GetIncludesSpec.scala index defda6c0..7d20ac89 100644 --- a/src/test/scala/firrtlTests/options/phases/GetIncludesSpec.scala +++ b/src/test/scala/firrtlTests/options/phases/GetIncludesSpec.scala @@ -2,7 +2,6 @@ package firrtlTests.options.phases -import org.scalatest.{FlatSpec, Matchers} import java.io.{File, PrintWriter} @@ -12,6 +11,8 @@ import firrtl.annotations.{AnnotationFileNotFoundException, JsonProtocol, import firrtl.options.phases.GetIncludes import firrtl.options.{InputAnnotationFileAnnotation, Phase} import firrtl.util.BackendCompilationUtilities +import org.scalatest.flatspec.AnyFlatSpec +import org.scalatest.matchers.should.Matchers case object A extends NoTargetAnnotation case object B extends NoTargetAnnotation @@ -19,7 +20,7 @@ case object C extends NoTargetAnnotation case object D extends NoTargetAnnotation case object E extends NoTargetAnnotation -class GetIncludesSpec extends FlatSpec with Matchers with BackendCompilationUtilities with firrtl.testutils.Utils { +class GetIncludesSpec extends AnyFlatSpec with Matchers with BackendCompilationUtilities with firrtl.testutils.Utils { val dir = new File("test_run_dir/GetIncludesSpec") dir.mkdirs() diff --git a/src/test/scala/firrtlTests/options/phases/WriteOutputAnnotationsSpec.scala b/src/test/scala/firrtlTests/options/phases/WriteOutputAnnotationsSpec.scala index 176362cc..e71eaedf 100644 --- a/src/test/scala/firrtlTests/options/phases/WriteOutputAnnotationsSpec.scala +++ b/src/test/scala/firrtlTests/options/phases/WriteOutputAnnotationsSpec.scala @@ -2,7 +2,6 @@ package firrtlTests.options.phases -import org.scalatest.{FlatSpec, Matchers} import java.io.File @@ -10,8 +9,10 @@ import firrtl.AnnotationSeq import firrtl.annotations.{DeletedAnnotation, NoTargetAnnotation} import firrtl.options.{InputAnnotationFileAnnotation, OutputAnnotationFileAnnotation, Phase, WriteDeletedAnnotation} import firrtl.options.phases.{GetIncludes, WriteOutputAnnotations} +import org.scalatest.flatspec.AnyFlatSpec +import org.scalatest.matchers.should.Matchers -class WriteOutputAnnotationsSpec extends FlatSpec with Matchers with firrtl.testutils.Utils { +class WriteOutputAnnotationsSpec extends AnyFlatSpec with Matchers with firrtl.testutils.Utils { val dir = "test_run_dir/WriteOutputAnnotationSpec" diff --git a/src/test/scala/firrtlTests/stage/FirrtlCliSpec.scala b/src/test/scala/firrtlTests/stage/FirrtlCliSpec.scala index f13a498f..157520ea 100644 --- a/src/test/scala/firrtlTests/stage/FirrtlCliSpec.scala +++ b/src/test/scala/firrtlTests/stage/FirrtlCliSpec.scala @@ -2,13 +2,14 @@ package firrtlTests.stage -import org.scalatest.{FlatSpec, Matchers} import firrtl.stage.RunFirrtlTransformAnnotation import firrtl.options.Shell import firrtl.stage.FirrtlCli +import org.scalatest.flatspec.AnyFlatSpec +import org.scalatest.matchers.should.Matchers -class FirrtlCliSpec extends FlatSpec with Matchers { +class FirrtlCliSpec extends AnyFlatSpec with Matchers { behavior of "FirrtlCli for RunFirrtlTransformAnnotation / -fct / --custom-transforms" diff --git a/src/test/scala/firrtlTests/stage/FirrtlMainSpec.scala b/src/test/scala/firrtlTests/stage/FirrtlMainSpec.scala index 39b25dc2..15f7a021 100644 --- a/src/test/scala/firrtlTests/stage/FirrtlMainSpec.scala +++ b/src/test/scala/firrtlTests/stage/FirrtlMainSpec.scala @@ -2,7 +2,9 @@ package firrtlTests.stage -import org.scalatest.{FeatureSpec, GivenWhenThen, Matchers} +import org.scalatest.GivenWhenThen +import org.scalatest.featurespec.AnyFeatureSpec +import org.scalatest.matchers.should.Matchers import java.io.{File, PrintWriter} @@ -16,7 +18,7 @@ import firrtl.util.BackendCompilationUtilities * This test uses the [[org.scalatest.FeatureSpec FeatureSpec]] intentionally as this test exercises the top-level * interface and is more suitable to an Acceptance Testing style. */ -class FirrtlMainSpec extends FeatureSpec with GivenWhenThen with Matchers with firrtl.testutils.Utils +class FirrtlMainSpec extends AnyFeatureSpec with GivenWhenThen with Matchers with firrtl.testutils.Utils with BackendCompilationUtilities { /** Parameterizes one test of [[FirrtlMain]]. Running the [[FirrtlMain]] `main` with certain args should produce @@ -48,7 +50,7 @@ class FirrtlMainSpec extends FeatureSpec with GivenWhenThen with Matchers with f * @param p some test parameters */ def runStageExpectFiles(p: FirrtlMainTest): Unit = { - scenario(s"""User runs FIRRTL Stage with '${p.argsString}'""") { + Scenario(s"""User runs FIRRTL Stage with '${p.argsString}'""") { val f = new FirrtlMainFixture val td = new TargetDirectoryFixture(p.testName) @@ -148,8 +150,8 @@ class FirrtlMainSpec extends FeatureSpec with GivenWhenThen with Matchers with f info("As a FIRRTL command line user") info("I want to compile some FIRRTL") - feature("FirrtlMain command line interface") { - scenario("User tries to discover available options") { + Feature("FirrtlMain command line interface") { + Scenario("User tries to discover available options") { val f = new FirrtlMainFixture When("the user passes '--help'") @@ -222,7 +224,7 @@ class FirrtlMainSpec extends FeatureSpec with GivenWhenThen with Matchers with f ) .foreach(runStageExpectFiles) - scenario("User doesn't specify a target directory") { + Scenario("User doesn't specify a target directory") { val f = new FirrtlMainFixture When("the user doesn't specify a target directory") @@ -241,7 +243,7 @@ class FirrtlMainSpec extends FeatureSpec with GivenWhenThen with Matchers with f result shouldBe a [Right[_,_]] } - scenario("User provides Protocol Buffer input") { + Scenario("User provides Protocol Buffer input") { val f = new FirrtlMainFixture val td = new TargetDirectoryFixture("protobuf-works") @@ -261,8 +263,8 @@ class FirrtlMainSpec extends FeatureSpec with GivenWhenThen with Matchers with f info("As a FIRRTL command line user") info("I want to receive error messages when I do not specify mandatory inputs") - feature("FirrtlMain input validation of mandatory options") { - scenario("User gives no command line options (no input circuit specified)") { + Feature("FirrtlMain input validation of mandatory options") { + Scenario("User gives no command line options (no input circuit specified)") { val f = new FirrtlMainFixture When("the user passes no arguments") @@ -284,12 +286,12 @@ class FirrtlMainSpec extends FeatureSpec with GivenWhenThen with Matchers with f info("As a FIRRTL command line user") info("I want to receive helpful error and warnings message") - feature("FirrtlMain input validation") { + Feature("FirrtlMain input validation") { /* Note: most input validation occurs inside firrtl.stage.phases.Checks. This seeks to validate command line * behavior. */ - scenario("User tries to use an implicit annotation file") { + Scenario("User tries to use an implicit annotation file") { val f = new FirrtlMainFixture val td = new TargetDirectoryFixture("implict-annotation-file") val circuit = new SimpleFirrtlCircuitFixture @@ -325,7 +327,7 @@ class FirrtlMainSpec extends FeatureSpec with GivenWhenThen with Matchers with f result shouldBe a [Right[_,_]] } - scenario("User provides unsupported legacy annotations") { + Scenario("User provides unsupported legacy annotations") { val f = new FirrtlMainFixture val td = new TargetDirectoryFixture("legacy-annotation-file") val circuit = new SimpleFirrtlCircuitFixture @@ -377,8 +379,8 @@ class FirrtlMainSpec extends FeatureSpec with GivenWhenThen with Matchers with f info("As a FIRRTL transform developer") info("I want to register my custom transforms with FIRRTL") - feature("FirrtlMain transform registration") { - scenario("User doesn't know if their transforms were registered") { + Feature("FirrtlMain transform registration") { + Scenario("User doesn't know if their transforms were registered") { val f = new FirrtlMainFixture When("the user passes '--show-registrations'") @@ -397,7 +399,7 @@ class FirrtlMainSpec extends FeatureSpec with GivenWhenThen with Matchers with f info("As a longtime FIRRTL user") info("I migrate from Driver to FirrtlMain") - feature("FirrtlMain migration helpers") { + Feature("FirrtlMain migration helpers") { def optionRemoved(a: String): Option[String] = Some(s"Option '$a' was removed as part of the FIRRTL Stage refactor") Seq( /* Removed --top-name/-tn handling */ diff --git a/src/test/scala/firrtlTests/stage/FirrtlOptionsViewSpec.scala b/src/test/scala/firrtlTests/stage/FirrtlOptionsViewSpec.scala index 389e96b4..95c2ee93 100644 --- a/src/test/scala/firrtlTests/stage/FirrtlOptionsViewSpec.scala +++ b/src/test/scala/firrtlTests/stage/FirrtlOptionsViewSpec.scala @@ -2,19 +2,20 @@ package firrtlTests.stage -import org.scalatest.{FlatSpec, Matchers} import firrtl.stage._ import firrtl.{ir, NoneCompiler, Parser} import firrtl.options.Viewer.view import firrtl.stage.{FirrtlOptions, FirrtlOptionsView} +import org.scalatest.flatspec.AnyFlatSpec +import org.scalatest.matchers.should.Matchers class BazCompiler extends NoneCompiler class Baz_Compiler extends NoneCompiler -class FirrtlOptionsViewSpec extends FlatSpec with Matchers { +class FirrtlOptionsViewSpec extends AnyFlatSpec with Matchers { behavior of FirrtlOptionsView.getClass.getName diff --git a/src/test/scala/firrtlTests/stage/phases/AddCircuitSpec.scala b/src/test/scala/firrtlTests/stage/phases/AddCircuitSpec.scala index ea4d8d72..58026ecd 100644 --- a/src/test/scala/firrtlTests/stage/phases/AddCircuitSpec.scala +++ b/src/test/scala/firrtlTests/stage/phases/AddCircuitSpec.scala @@ -2,7 +2,6 @@ package firrtlTests.stage.phases -import org.scalatest.{FlatSpec, Matchers} import firrtl.Parser import firrtl.annotations.NoTargetAnnotation @@ -12,8 +11,10 @@ import firrtl.stage.{CircuitOption, FirrtlCircuitAnnotation, FirrtlSourceAnnotat import firrtl.stage.phases.AddCircuit import java.io.{File, FileWriter} +import org.scalatest.flatspec.AnyFlatSpec +import org.scalatest.matchers.should.Matchers -class AddCircuitSpec extends FlatSpec with Matchers { +class AddCircuitSpec extends AnyFlatSpec with Matchers { case class FooAnnotation(x: Int) extends NoTargetAnnotation case class BarAnnotation(x: String) extends NoTargetAnnotation diff --git a/src/test/scala/firrtlTests/stage/phases/AddDefaultsSpec.scala b/src/test/scala/firrtlTests/stage/phases/AddDefaultsSpec.scala index c4566dd5..89f5193c 100644 --- a/src/test/scala/firrtlTests/stage/phases/AddDefaultsSpec.scala +++ b/src/test/scala/firrtlTests/stage/phases/AddDefaultsSpec.scala @@ -2,7 +2,6 @@ package firrtlTests.stage.phases -import org.scalatest.{FlatSpec, Matchers} import firrtl.NoneCompiler import firrtl.annotations.Annotation @@ -10,8 +9,10 @@ import firrtl.stage.phases.AddDefaults import firrtl.transforms.BlackBoxTargetDirAnno import firrtl.stage.{CompilerAnnotation, InfoModeAnnotation} import firrtl.options.{Phase, TargetDirAnnotation} +import org.scalatest.flatspec.AnyFlatSpec +import org.scalatest.matchers.should.Matchers -class AddDefaultsSpec extends FlatSpec with Matchers { +class AddDefaultsSpec extends AnyFlatSpec with Matchers { class Fixture { val phase: Phase = new AddDefaults } diff --git a/src/test/scala/firrtlTests/stage/phases/AddImplicitEmitterSpec.scala b/src/test/scala/firrtlTests/stage/phases/AddImplicitEmitterSpec.scala index 117e9c5f..941f1883 100644 --- a/src/test/scala/firrtlTests/stage/phases/AddImplicitEmitterSpec.scala +++ b/src/test/scala/firrtlTests/stage/phases/AddImplicitEmitterSpec.scala @@ -2,15 +2,16 @@ package firrtlTests.stage.phases -import org.scalatest.{FlatSpec, Matchers} import firrtl.{EmitAllModulesAnnotation, EmitCircuitAnnotation, HighFirrtlEmitter, VerilogCompiler} import firrtl.annotations.NoTargetAnnotation import firrtl.options.Phase import firrtl.stage.{CompilerAnnotation, RunFirrtlTransformAnnotation} import firrtl.stage.phases.AddImplicitEmitter +import org.scalatest.flatspec.AnyFlatSpec +import org.scalatest.matchers.should.Matchers -class AddImplicitEmitterSpec extends FlatSpec with Matchers { +class AddImplicitEmitterSpec extends AnyFlatSpec with Matchers { case class FooAnnotation(x: Int) extends NoTargetAnnotation case class BarAnnotation(x: String) extends NoTargetAnnotation diff --git a/src/test/scala/firrtlTests/stage/phases/AddImplicitOutputFileSpec.scala b/src/test/scala/firrtlTests/stage/phases/AddImplicitOutputFileSpec.scala index 72d186b5..5ec051f4 100644 --- a/src/test/scala/firrtlTests/stage/phases/AddImplicitOutputFileSpec.scala +++ b/src/test/scala/firrtlTests/stage/phases/AddImplicitOutputFileSpec.scala @@ -2,14 +2,15 @@ package firrtlTests.stage.phases -import org.scalatest.{FlatSpec, Matchers} import firrtl.{ChirrtlEmitter, EmitAllModulesAnnotation, Parser} import firrtl.options.Phase import firrtl.stage.{FirrtlCircuitAnnotation, OutputFileAnnotation} import firrtl.stage.phases.AddImplicitOutputFile +import org.scalatest.flatspec.AnyFlatSpec +import org.scalatest.matchers.should.Matchers -class AddImplicitOutputFileSpec extends FlatSpec with Matchers { +class AddImplicitOutputFileSpec extends AnyFlatSpec with Matchers { class Fixture { val phase: Phase = new AddImplicitOutputFile } diff --git a/src/test/scala/firrtlTests/stage/phases/ChecksSpec.scala b/src/test/scala/firrtlTests/stage/phases/ChecksSpec.scala index 7eb1312d..e10bbe6d 100644 --- a/src/test/scala/firrtlTests/stage/phases/ChecksSpec.scala +++ b/src/test/scala/firrtlTests/stage/phases/ChecksSpec.scala @@ -2,15 +2,16 @@ package firrtlTests.stage.phases -import org.scalatest.{FlatSpec, Matchers} import firrtl.stage._ import firrtl.{AnnotationSeq, ChirrtlEmitter, EmitAllModulesAnnotation, NoneCompiler} import firrtl.options.{OptionsException, OutputAnnotationFileAnnotation, Phase} import firrtl.stage.phases.Checks +import org.scalatest.flatspec.AnyFlatSpec +import org.scalatest.matchers.should.Matchers -class ChecksSpec extends FlatSpec with Matchers { +class ChecksSpec extends AnyFlatSpec with Matchers { class Fixture { val phase: Phase = new Checks } diff --git a/src/test/scala/firrtlTests/stage/phases/CompilerSpec.scala b/src/test/scala/firrtlTests/stage/phases/CompilerSpec.scala index f2620051..0582cb21 100644 --- a/src/test/scala/firrtlTests/stage/phases/CompilerSpec.scala +++ b/src/test/scala/firrtlTests/stage/phases/CompilerSpec.scala @@ -2,7 +2,6 @@ package firrtlTests.stage.phases -import org.scalatest.{FlatSpec, Matchers} import scala.collection.mutable @@ -10,8 +9,10 @@ import firrtl.{Compiler => _, _} import firrtl.options.{Phase, PreservesAll} import firrtl.stage.{CompilerAnnotation, FirrtlCircuitAnnotation, Forms, RunFirrtlTransformAnnotation} import firrtl.stage.phases.Compiler +import org.scalatest.flatspec.AnyFlatSpec +import org.scalatest.matchers.should.Matchers -class CompilerSpec extends FlatSpec with Matchers { +class CompilerSpec extends AnyFlatSpec with Matchers { class Fixture { val phase: Phase = new Compiler } diff --git a/src/test/scala/firrtlTests/stage/phases/WriteEmittedSpec.scala b/src/test/scala/firrtlTests/stage/phases/WriteEmittedSpec.scala index 4f7ad92a..bbec32fe 100644 --- a/src/test/scala/firrtlTests/stage/phases/WriteEmittedSpec.scala +++ b/src/test/scala/firrtlTests/stage/phases/WriteEmittedSpec.scala @@ -2,7 +2,6 @@ package firrtlTests.stage.phases -import org.scalatest.{FlatSpec, Matchers} import java.io.File @@ -11,8 +10,10 @@ import firrtl._ import firrtl.options.{Phase, TargetDirAnnotation} import firrtl.stage.OutputFileAnnotation import firrtl.stage.phases.WriteEmitted +import org.scalatest.flatspec.AnyFlatSpec +import org.scalatest.matchers.should.Matchers -class WriteEmittedSpec extends FlatSpec with Matchers { +class WriteEmittedSpec extends AnyFlatSpec with Matchers { def removeEmitted(a: AnnotationSeq): AnnotationSeq = a.flatMap { case a: EmittedAnnotation[_] => None diff --git a/src/test/scala/loggertests/LoggerSpec.scala b/src/test/scala/loggertests/LoggerSpec.scala index 06076fab..c8aae949 100644 --- a/src/test/scala/loggertests/LoggerSpec.scala +++ b/src/test/scala/loggertests/LoggerSpec.scala @@ -4,7 +4,9 @@ package loggertests import logger.Logger.OutputCaptor import logger.{LazyLogging, LogLevel, Logger} -import org.scalatest.{FreeSpec, Matchers, OneInstancePerTest} +import org.scalatest.OneInstancePerTest +import org.scalatest.freespec.AnyFreeSpec +import org.scalatest.matchers.should.Matchers object LoggerSpec { val ErrorMsg = "message error" @@ -35,7 +37,7 @@ class LogsInfo3 extends LazyLogging { logger.info("logger3") } } -class LoggerSpec extends FreeSpec with Matchers with OneInstancePerTest with LazyLogging { +class LoggerSpec extends AnyFreeSpec with Matchers with OneInstancePerTest with LazyLogging { "Logger is a simple but powerful logging system" - { "Following tests show how global level can control logging" - { |
