From 77d2455a5a9cd1e3baad460d1bf5ce950b58788a Mon Sep 17 00:00:00 2001 From: Schuyler Eldridge Date: Sat, 2 Nov 2019 02:03:35 -0400 Subject: Tests for anonymous/class-in-module desiredName Signed-off-by: Schuyler Eldridge --- src/test/scala/chiselTests/Module.scala | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/test/scala/chiselTests/Module.scala') diff --git a/src/test/scala/chiselTests/Module.scala b/src/test/scala/chiselTests/Module.scala index f730d08b..d8cae510 100644 --- a/src/test/scala/chiselTests/Module.scala +++ b/src/test/scala/chiselTests/Module.scala @@ -158,4 +158,19 @@ class ModuleSpec extends ChiselPropSpec { (the [Exception] thrownBy (Driver.elaborate(() => new NullModuleWrapper))) .getMessage should include ("desiredName of chiselTests.NullModuleWrapper is null") } + property("The name of a module in a function should be sane") { + def foo = { + class Foo1 extends RawModule { + assert(name == "Foo1") + } + new Foo1 + } + Driver.elaborate(() => foo) + } + property("The name of an anonymous module should include '_Anon'") { + trait Foo { this: RawModule => + assert(name.contains("_Anon")) + } + Driver.elaborate(() => new RawModule with Foo) + } } -- cgit v1.2.3