diff options
| author | Leway Colin | 2019-06-28 09:32:57 +0800 |
|---|---|---|
| committer | mergify[bot] | 2019-06-28 01:32:57 +0000 |
| commit | babc04f7960e04a2b1868e40ab204ca3a6d66332 (patch) | |
| tree | d8690c33920c55292ba7afb5a7250ff114bf8e55 /src | |
| parent | 20208967b3a39c0ef3c1af40b03dc8d5ee923f45 (diff) | |
Add Test for AddDefaults phase (#1106)
* Add Test for AddDefaults phase
* Refactor AddDefaultsSpec
Diffstat (limited to 'src')
| -rw-r--r-- | src/test/scala/firrtlTests/options/phases/AddDefaultsSpec.scala | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/test/scala/firrtlTests/options/phases/AddDefaultsSpec.scala b/src/test/scala/firrtlTests/options/phases/AddDefaultsSpec.scala new file mode 100644 index 00000000..362d139f --- /dev/null +++ b/src/test/scala/firrtlTests/options/phases/AddDefaultsSpec.scala @@ -0,0 +1,27 @@ +// See LICENSE for license details. + +package firrtlTests.options.phases + +import org.scalatest.{FlatSpec, Matchers} + +import firrtl.options.{Phase, TargetDirAnnotation} +import firrtl.options.phases.AddDefaults + +class AddDefaultsSpec extends FlatSpec with Matchers { + + class Fixture { + val phase: Phase = new AddDefaults + val targetDir = TargetDirAnnotation("foo") + val defaultDir = TargetDirAnnotation(".") + } + + behavior of classOf[AddDefaults].toString + + it should "add a TargetDirAnnotation if it does not exist" in new Fixture { + phase.transform(Seq.empty).toSeq should be (Seq(defaultDir)) + } + + it should "don't add a TargetDirAnnotation if it exists" in new Fixture { + phase.transform(Seq(targetDir)).toSeq should be (Seq(targetDir)) + } +} |
