diff options
| author | Jack Koenig | 2017-06-28 17:00:13 -0700 |
|---|---|---|
| committer | Jack Koenig | 2017-06-28 17:00:13 -0700 |
| commit | dbb4de2a4e6c2122e7c0def7d1c4ff38a79e1558 (patch) | |
| tree | 694faae388d2353da211dd0e5df06a286536a73a /src | |
| parent | 8eb69dd91e58915f8dad5e42da0a3fe686c628d8 (diff) | |
[Testing] Have SimpleTransformSpec mix in FirrtlMatchers
Gives all transform specs access to useful utilities (like dontTouch).
Deletes some duplicate code. Parsing mode UseInfo is fine for
everything, only matters if the test actually uses info.
Diffstat (limited to 'src')
| -rw-r--r-- | src/test/scala/firrtlTests/AnnotationTests.scala | 7 | ||||
| -rw-r--r-- | src/test/scala/firrtlTests/FirrtlSpec.scala | 4 | ||||
| -rw-r--r-- | src/test/scala/firrtlTests/PassTests.scala | 3 |
3 files changed, 3 insertions, 11 deletions
diff --git a/src/test/scala/firrtlTests/AnnotationTests.scala b/src/test/scala/firrtlTests/AnnotationTests.scala index 3e93081e..c8b83bd2 100644 --- a/src/test/scala/firrtlTests/AnnotationTests.scala +++ b/src/test/scala/firrtlTests/AnnotationTests.scala @@ -49,13 +49,6 @@ class AnnotationTests extends AnnotationSpec with Matchers { Annotation(ComponentName(s, ModuleName(mod, CircuitName("Top"))), classOf[Transform], value) def manno(mod: String): Annotation = Annotation(ModuleName(mod, CircuitName("Top")), classOf[Transform], "some value") - // TODO unify with FirrtlMatchers, problems with multiple definitions of parse - def dontTouch(path: String): Annotation = { - val parts = path.split('.') - require(parts.size >= 2, "Must specify both module and component!") - val name = ComponentName(parts.tail.mkString("."), ModuleName(parts.head, CircuitName("Top"))) - DontTouchAnnotation(name) - } "Loose and Sticky annotation on a node" should "pass through" in { val input: String = diff --git a/src/test/scala/firrtlTests/FirrtlSpec.scala b/src/test/scala/firrtlTests/FirrtlSpec.scala index a45af8c7..07f83142 100644 --- a/src/test/scala/firrtlTests/FirrtlSpec.scala +++ b/src/test/scala/firrtlTests/FirrtlSpec.scala @@ -11,7 +11,7 @@ import org.scalatest.prop._ import scala.io.Source import firrtl._ -import firrtl.Parser.IgnoreInfo +import firrtl.Parser.UseInfo import firrtl.annotations._ import firrtl.transforms.{DontTouchAnnotation, NoDedupAnnotation} import firrtl.util.BackendCompilationUtilities @@ -100,7 +100,7 @@ trait FirrtlMatchers extends Matchers { require(!s.contains("\n")) s.replaceAll("\\s+", " ").trim } - def parse(str: String) = Parser.parse(str.split("\n").toIterator, IgnoreInfo) + def parse(str: String) = Parser.parse(str.split("\n").toIterator, UseInfo) /** Helper for executing tests * compiler will be run on input then emitted result will each be split into * lines and normalized. diff --git a/src/test/scala/firrtlTests/PassTests.scala b/src/test/scala/firrtlTests/PassTests.scala index e22fd513..7fa7e8ef 100644 --- a/src/test/scala/firrtlTests/PassTests.scala +++ b/src/test/scala/firrtlTests/PassTests.scala @@ -13,9 +13,8 @@ import logger._ // An example methodology for testing Firrtl Passes // Spec class should extend this class -abstract class SimpleTransformSpec extends FlatSpec with Matchers with Compiler with LazyLogging { +abstract class SimpleTransformSpec extends FlatSpec with FirrtlMatchers with Compiler with LazyLogging { // Utility function - def parse(s: String): Circuit = Parser.parse(s.split("\n").toIterator, infoMode = UseInfo) def squash(c: Circuit): Circuit = RemoveEmpty.run(c) // Executes the test. Call in tests. |
