aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorAlbert Magyar2020-03-09 20:00:27 -0700
committerAlbert Magyar2020-03-16 10:24:43 -0700
commitb3d4654935db38990d6cc4976eed7ddc14cf60fd (patch)
tree1583f9bffcc21399936ca73800e0a610458de6d2 /src/test
parent44f0112c7a9d9e9fa7f87fa6e5f68916e76a3b19 (diff)
Check for module name conflicts
* Fixes #1436
Diffstat (limited to 'src/test')
-rw-r--r--src/test/scala/firrtlTests/CheckSpec.scala26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/test/scala/firrtlTests/CheckSpec.scala b/src/test/scala/firrtlTests/CheckSpec.scala
index 9a384d21..f03b6611 100644
--- a/src/test/scala/firrtlTests/CheckSpec.scala
+++ b/src/test/scala/firrtlTests/CheckSpec.scala
@@ -307,6 +307,32 @@ class CheckSpec extends FlatSpec with Matchers {
}
}
}
+
+ s"Duplicate module names" should "throw an exception" in {
+ val input =
+ s"""|circuit bar :
+ | module bar :
+ | input i : UInt<8>
+ | output o : UInt<8>
+ | o <= i
+ | module dup :
+ | input i : UInt<8>
+ | output o : UInt<8>
+ | o <= i
+ | module dup :
+ | input i : UInt<8>
+ | output o : UInt<8>
+ | o <= not(i)
+ |""".stripMargin
+ assertThrows[CheckHighForm.ModuleNameNotUniqueException] {
+ try {
+ checkHighInput(input)
+ } catch {
+ case e: firrtl.passes.PassExceptions => throw e.exceptions.head
+ }
+ }
+ }
+
}
object CheckSpec {