aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorSchuyler Eldridge2018-11-15 21:50:29 -0500
committerSchuyler Eldridge2018-11-21 23:22:11 -0500
commit696bc256a90cc80bcb094aaeada8eea51a643ae0 (patch)
tree8435ab570e88b60ca6af127e607794c64565bb9c /src/test
parent4a2211c1602b37a65b4e44c3b7ebe82e8bfeedc0 (diff)
Change firrtl.options API, add Phase
This breaks firrtl.options.Stage into a small type hierarchy: * Phase: something that transforms an AnnotationSeq * Stage extends Phase: a Phase with a Command Line Interface Some of the old "common options" (input annotation file and target directory) are moved into firrtl.options and provided as part of the Stage class. Stage will automatically preprocess an input annotation sequence to resolve all input annotation files and add a default target directory. Minor changes: * Adds ViewException * Stops mixing in the DoNotTerminateOnExit trait into the default Shell parser * Add StageOptionsView Signed-off-by: Schuyler Eldridge <schuyler.eldridge@ibm.com>
Diffstat (limited to 'src/test')
-rw-r--r--src/test/scala/firrtlTests/options/OptionsViewSpec.scala18
1 files changed, 6 insertions, 12 deletions
diff --git a/src/test/scala/firrtlTests/options/OptionsViewSpec.scala b/src/test/scala/firrtlTests/options/OptionsViewSpec.scala
index dec6a99f..0953027f 100644
--- a/src/test/scala/firrtlTests/options/OptionsViewSpec.scala
+++ b/src/test/scala/firrtlTests/options/OptionsViewSpec.scala
@@ -26,10 +26,7 @@ class OptionsViewSpec extends FlatSpec with Matchers {
case _ => foo
}
- def view(options: AnnotationSeq): Option[Foo] = {
- val annoSeq = options.foldLeft(Foo())(append)
- Some(annoSeq)
- }
+ def view(options: AnnotationSeq): Foo = options.foldLeft(Foo())(append)
}
/* An OptionsView that converts an AnnotationSeq to Option[Bar] */
@@ -39,10 +36,7 @@ class OptionsViewSpec extends FlatSpec with Matchers {
case _ => bar
}
- def view(options: AnnotationSeq): Option[Bar] = {
- val annoSeq = options.foldLeft(Bar())(append)
- Some(annoSeq)
- }
+ def view(options: AnnotationSeq): Bar = options.foldLeft(Bar())(append)
}
behavior of "OptionsView"
@@ -52,10 +46,10 @@ class OptionsViewSpec extends FlatSpec with Matchers {
val annos = Seq(NameAnnotation("foo"), ValueAnnotation(42))
info("Foo conversion okay")
- FooView.view(annos) should be (Some(Foo(Some("foo"), Some(42))))
+ FooView.view(annos) should be (Foo(Some("foo"), Some(42)))
info("Bar conversion okay")
- BarView.view(annos) should be (Some(Bar("foo")))
+ BarView.view(annos) should be (Bar("foo"))
}
behavior of "Viewer"
@@ -67,9 +61,9 @@ class OptionsViewSpec extends FlatSpec with Matchers {
val annos = Seq[Annotation]()
info("Foo view okay")
- view[Foo](annos) should be (Some(Foo(None, None)))
+ view[Foo](annos) should be (Foo(None, None))
info("Bar view okay")
- view[Bar](annos) should be (Some(Bar()))
+ view[Bar](annos) should be (Bar())
}
}