From 696bc256a90cc80bcb094aaeada8eea51a643ae0 Mon Sep 17 00:00:00 2001 From: Schuyler Eldridge Date: Thu, 15 Nov 2018 21:50:29 -0500 Subject: 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 --- .../scala/firrtlTests/options/OptionsViewSpec.scala | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) (limited to 'src/test') 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()) } } -- cgit v1.2.3