aboutsummaryrefslogtreecommitdiff
path: root/src/test/scala/firrtlTests/options/ShellSpec.scala
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/scala/firrtlTests/options/ShellSpec.scala')
-rw-r--r--src/test/scala/firrtlTests/options/ShellSpec.scala20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/test/scala/firrtlTests/options/ShellSpec.scala b/src/test/scala/firrtlTests/options/ShellSpec.scala
index d87a9a30..50000550 100644
--- a/src/test/scala/firrtlTests/options/ShellSpec.scala
+++ b/src/test/scala/firrtlTests/options/ShellSpec.scala
@@ -2,12 +2,24 @@
package firrtlTests.options
-import org.scalatest._
+import org.scalatest.{FlatSpec, Matchers}
+import firrtl.annotations.NoTargetAnnotation
import firrtl.options.Shell
class ShellSpec extends FlatSpec with Matchers {
+ case object A extends NoTargetAnnotation
+ case object B extends NoTargetAnnotation
+ case object C extends NoTargetAnnotation
+ case object D extends NoTargetAnnotation
+ case object E extends NoTargetAnnotation
+
+ trait AlphabeticalCli { this: Shell =>
+ parser.opt[Unit]('c', "c-option").unbounded().action( (x, c) => C +: c )
+ parser.opt[Unit]('d', "d-option").unbounded().action( (x, c) => D +: c )
+ parser.opt[Unit]('e', "e-option").unbounded().action( (x, c) => E +: c ) }
+
behavior of "Shell"
it should "detect all registered libraries and transforms" in {
@@ -19,4 +31,10 @@ class ShellSpec extends FlatSpec with Matchers {
info("Found BarLibrary")
shell.registeredLibraries.map(_.getClass.getName) should contain ("firrtlTests.options.BarLibrary")
}
+
+ it should "correctly order annotations and options" in {
+ val shell = new Shell("foo") with AlphabeticalCli
+
+ shell.parse(Array("-c", "-d", "-e"), Seq(A, B)).toSeq should be (Seq(A, B, C, D, E))
+ }
}