aboutsummaryrefslogtreecommitdiff
path: root/src/test/scala
diff options
context:
space:
mode:
authorJared Barocsi2021-06-18 09:05:17 -0700
committerGitHub2021-06-18 16:05:17 +0000
commiteb0841d27f5cd077c5f27f339ef9eb86cbe64599 (patch)
tree3c090f231ee26d0e929e095f6134ce22c25c5b72 /src/test/scala
parentecd6d7a6af9785d00ef1020b19cb5707ae1d6398 (diff)
Fix MultiInfo parser + serialization bug (#2265)
* Restore parsed MultiInfo structure in firrtl parser * Change erroneous expected output in InfoSpec test FileInfo compression sorts the outputted entries alphabetically, but this test did not reflect that fact * Fix typo in comment * Add unit tests for file locator parsing * Fix syntax issues and typos * More redundant braces removed Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Diffstat (limited to 'src/test/scala')
-rw-r--r--src/test/scala/firrtlTests/InfoSpec.scala15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/test/scala/firrtlTests/InfoSpec.scala b/src/test/scala/firrtlTests/InfoSpec.scala
index 85b4efac..99000d37 100644
--- a/src/test/scala/firrtlTests/InfoSpec.scala
+++ b/src/test/scala/firrtlTests/InfoSpec.scala
@@ -288,7 +288,7 @@ class InfoSpec extends FirrtlFlatSpec with FirrtlMatchers {
" wire [31:0] a = c ? b : d; // @[A 1:{2,3,4} B 2:3 4:5]"
)
result("A 2:3", "B 1:{2,3,4}", "C 4:5") should containLine(
- " wire [31:0] a = c ? b : d; // @[B 1:{2,3,4} A 2:3 C 4:5]"
+ " wire [31:0] a = c ? b : d; // @[A 2:3 B 1:{2,3,4} C 4:5]"
)
}
@@ -321,4 +321,17 @@ class InfoSpec extends FirrtlFlatSpec with FirrtlMatchers {
for (line <- check)
result should containLine(line)
}
+
+ "Source Locators" should "not lose information when going through serialization + parsing" in {
+ def check(info: ir.Info): Unit = {
+ assert(Parser.parseInfo(info.serialize) == info)
+ }
+
+ check(ir.NoInfo)
+ check(ir.FileInfo("B"))
+ check(ir.FileInfo("A 4:5"))
+ check(ir.FileInfo("A 4:6"))
+ check(ir.MultiInfo(ir.FileInfo("A 4:5"), ir.FileInfo("B 5:5")))
+ check(ir.MultiInfo(ir.FileInfo("A 4:5"), ir.FileInfo("A 5:5")))
+ }
}