From a017bf38f72e1d7dd1bd59e7cd7beb77a50e4259 Mon Sep 17 00:00:00 2001 From: Jim Lawson Date: Wed, 1 Feb 2017 11:39:15 -0800 Subject: 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.--- src/test/scala/firrtlTests/AnnotationTests.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') 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") -- cgit v1.2.3