summaryrefslogtreecommitdiff
path: root/src/test/scala/chiselTests
diff options
context:
space:
mode:
authorSchuyler Eldridge2019-11-02 14:50:29 +0800
committerGitHub2019-11-02 14:50:29 +0800
commitdc7c4c619c677cc6a563bd27dbf55ba26f4c9f95 (patch)
treebc3584e856a3336f8f91d110d949f26e0a44604c /src/test/scala/chiselTests
parent2e891a4e2a638a00cb836736c72eb87673dffba3 (diff)
parent77d2455a5a9cd1e3baad460d1bf5ce950b58788a (diff)
Merge pull request #1224 from freechipsproject/issue-1223
Improve naming of anonymous/class-in-function Modules
Diffstat (limited to 'src/test/scala/chiselTests')
-rw-r--r--src/test/scala/chiselTests/Module.scala15
1 files changed, 15 insertions, 0 deletions
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)
+ }
}