aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJim Lawson2017-02-01 11:39:15 -0800
committerGitHub2017-02-01 11:39:15 -0800
commita017bf38f72e1d7dd1bd59e7cd7beb77a50e4259 (patch)
treea08cdcf7f9b2420daa56614a17d5ec9cd9c1cf97 /src
parentae6b0ed3b42ee108d32972956cfb2744176f3101 (diff)
Fetch resource files as resources. (#399)
This is similar to pr #392 - fetch the resource as a resource, not as a random file otherwise the test will fail if it is executed anywhere outside of the actual source directory.
Diffstat (limited to 'src')
-rw-r--r--src/test/scala/firrtlTests/AnnotationTests.scala4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/test/scala/firrtlTests/AnnotationTests.scala b/src/test/scala/firrtlTests/AnnotationTests.scala
index 7e1a35dc..8acada93 100644
--- a/src/test/scala/firrtlTests/AnnotationTests.scala
+++ b/src/test/scala/firrtlTests/AnnotationTests.scala
@@ -59,8 +59,8 @@ class AnnotationTests extends AnnotationSpec with Matchers {
}
"Annotations" should "be readable from file" in {
- val annotationFile = new File("src/test/resources/annotations/SampleAnnotations.anno")
- val annotationsYaml = io.Source.fromFile(annotationFile).getLines().mkString("\n").parseYaml
+ val annotationStream = getClass.getResourceAsStream("/annotations/SampleAnnotations.anno")
+ val annotationsYaml = scala.io.Source.fromInputStream(annotationStream).getLines().mkString("\n").parseYaml
val annotationArray = annotationsYaml.convertTo[Array[Annotation]]
annotationArray.length should be (9)
annotationArray(0).targetString should be ("ModC")