aboutsummaryrefslogtreecommitdiff
path: root/src/test/scala/firrtlTests/InfoSpec.scala
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/scala/firrtlTests/InfoSpec.scala')
-rw-r--r--src/test/scala/firrtlTests/InfoSpec.scala23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/test/scala/firrtlTests/InfoSpec.scala b/src/test/scala/firrtlTests/InfoSpec.scala
index 48567d69..01e0a0ac 100644
--- a/src/test/scala/firrtlTests/InfoSpec.scala
+++ b/src/test/scala/firrtlTests/InfoSpec.scala
@@ -172,4 +172,27 @@ class InfoSpec extends FirrtlFlatSpec with FirrtlMatchers {
val expectedInfos = Seq(FileInfo(StringLit("Top.scala 15:14")), FileInfo(StringLit("myfile.fir 6:4")))
circuitState should containTree { case MultiInfo(`expectedInfos`) => true }
}
+
+ "FileInfo" should "be able to contain a escaped characters" in {
+ def input(info: String): String =
+ s"""circuit m: @[$info]
+ | module m:
+ | skip
+ |""".stripMargin
+ def parseInfo(info: String): FileInfo = {
+ firrtl.Parser.parse(input(info)).info.asInstanceOf[FileInfo]
+ }
+
+ parseInfo("test\\ntest").escaped should be ("test\\ntest")
+ parseInfo("test\\ntest").unescaped should be ("test\ntest")
+ parseInfo("test\\ttest").escaped should be ("test\\ttest")
+ parseInfo("test\\ttest").unescaped should be ("test\ttest")
+ parseInfo("test\\\\test").escaped should be ("test\\\\test")
+ parseInfo("test\\\\test").unescaped should be ("test\\test")
+ parseInfo("test\\]test").escaped should be ("test\\]test")
+ parseInfo("test\\]test").unescaped should be ("test]test")
+ parseInfo("test[\\][\\]test").escaped should be ("test[\\][\\]test")
+ parseInfo("test[\\][\\]test").unescaped should be ("test[][]test")
+ }
+
}