diff options
| author | Jack Koenig | 2019-11-15 15:45:29 -0800 |
|---|---|---|
| committer | GitHub | 2019-11-15 15:45:29 -0800 |
| commit | 5e6d985b27e283868bc2b990c8b6a5888c74422a (patch) | |
| tree | 5d8221340400fadc8742888d7b435d18ceeab7ba /src/test | |
| parent | 5373173d055e2916cd8867fd91dee7251192ebc9 (diff) | |
| parent | b076ac8fb482d2ef694f5b941cd8d72a2d9761ef (diff) | |
Merge pull request #1228 from freechipsproject/getSimpleName-considered-harmful
getSimpleName considered harmful
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/scala/firrtlTests/CustomTransformSpec.scala | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/src/test/scala/firrtlTests/CustomTransformSpec.scala b/src/test/scala/firrtlTests/CustomTransformSpec.scala index 1b0e8190..e0ed6fdb 100644 --- a/src/test/scala/firrtlTests/CustomTransformSpec.scala +++ b/src/test/scala/firrtlTests/CustomTransformSpec.scala @@ -6,6 +6,8 @@ import firrtl.ir.Circuit import firrtl._ import firrtl.passes.Pass import firrtl.ir._ +import firrtl.annotations.{Annotation, NoTargetAnnotation} +import firrtl.stage.{FirrtlSourceAnnotation, FirrtlStage, RunFirrtlTransformAnnotation} class CustomTransformSpec extends FirrtlFlatSpec { behavior of "Custom Transforms" @@ -71,5 +73,28 @@ class CustomTransformSpec extends FirrtlFlatSpec { Driver.execute(optionsManager) }).getMessage should include (errorString) } -} + object Foo { + class A extends Transform { + def inputForm = HighForm + def outputForm = HighForm + def execute(s: CircuitState) = { + println(name) + s + } + } + } + + they should "work if placed inside an object" in { + val input = + """|circuit Foo: + | module Foo: + | node a = UInt<1>(0) + |""".stripMargin + val annotations = Seq( + RunFirrtlTransformAnnotation(new Foo.A), + FirrtlSourceAnnotation(input) + ) + (new FirrtlStage).execute(Array.empty, annotations) + } +} |
