diff options
| author | Schuyler Eldridge | 2019-08-05 18:13:08 -0400 |
|---|---|---|
| committer | Schuyler Eldridge | 2019-08-05 18:13:08 -0400 |
| commit | 8f3d510c27be7fe9dd6cca7f09803113d1ce6bf2 (patch) | |
| tree | afc9cfb9bc11c67a4a61253959c0223669baa3da | |
| parent | 19f7a42c0809074aebcbc8a341f8c8ccda812799 (diff) | |
Add FileUtilsSpec
Signed-off-by: Schuyler Eldridge <schuyler.eldridge@ibm.com>
| -rw-r--r-- | src/test/scala/firrtlTests/FileUtilsSpec.scala | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/test/scala/firrtlTests/FileUtilsSpec.scala b/src/test/scala/firrtlTests/FileUtilsSpec.scala new file mode 100644 index 00000000..1a23fb48 --- /dev/null +++ b/src/test/scala/firrtlTests/FileUtilsSpec.scala @@ -0,0 +1,46 @@ +// See LICENSE for license details. + +package firrtlTests + +import org.scalatest.{FlatSpec, Matchers} + +import firrtl.FileUtils + +class FileUtilsSpec extends FlatSpec with Matchers { + + private val sampleAnnotations: String = "annotations/SampleAnnotations.anno" + private val sampleAnnotationsFileName: String = s"src/test/resources/$sampleAnnotations" + + behavior of "FileUtils.getLines" + + it should "read from a string filename" in { + FileUtils.getLines(sampleAnnotationsFileName).size should be > 0 + } + + it should "read from a Java file" in { + FileUtils.getLines(new java.io.File(sampleAnnotationsFileName)).size should be > 0 + } + + behavior of "FileUtils.getText" + + it should "read from a string filename" in { + FileUtils.getText(sampleAnnotationsFileName).size should be > 0 + } + + it should "read from a Java file" in { + FileUtils.getText(new java.io.File(sampleAnnotationsFileName)).size should be > 0 + } + + behavior of "FileUtils.getLinesResource" + + it should "read from a resource" in { + FileUtils.getLinesResource(s"/$sampleAnnotations").size should be > 0 + } + + behavior of "FileUtils.getTextResource" + + it should "read from a resource" in { + FileUtils.getTextResource(s"/$sampleAnnotations").split("\n").size should be > 0 + } + +} |
