diff options
author | Jakob Odersky <jakob@odersky.com> | 2017-04-09 16:32:19 -0700 |
---|---|---|
committer | Jakob Odersky <jakob@odersky.com> | 2017-04-09 16:32:19 -0700 |
commit | b492dcf46718f50ca051017bddd4551faa867339 (patch) | |
tree | 30ec6c2494b3c9c97d5e476d360168ad5ddac6b6 /crashboxd/src/test/scala/io/crashbox/ci/TestUtil.scala | |
parent | 382152098459a5783e3a794161ed2da2a321af37 (diff) | |
download | crashbox-ci-b492dcf46718f50ca051017bddd4551faa867339.tar.gz crashbox-ci-b492dcf46718f50ca051017bddd4551faa867339.tar.bz2 crashbox-ci-b492dcf46718f50ca051017bddd4551faa867339.zip |
Refactor testing utilities
Diffstat (limited to 'crashboxd/src/test/scala/io/crashbox/ci/TestUtil.scala')
-rw-r--r-- | crashboxd/src/test/scala/io/crashbox/ci/TestUtil.scala | 26 |
1 files changed, 0 insertions, 26 deletions
diff --git a/crashboxd/src/test/scala/io/crashbox/ci/TestUtil.scala b/crashboxd/src/test/scala/io/crashbox/ci/TestUtil.scala deleted file mode 100644 index b5bacf2..0000000 --- a/crashboxd/src/test/scala/io/crashbox/ci/TestUtil.scala +++ /dev/null @@ -1,26 +0,0 @@ -package io.crashbox.ci - -import java.io.{ ByteArrayOutputStream, File } -import java.nio.file.Files - - -object TestUtil { - - def withTempFile[A](action: File => A): A = { - def rm(parent: File): Unit = if (parent.isDirectory) { - parent.listFiles.foreach{ child => - rm(child) - } - } - val dir = Files.createTempDirectory("crashbox-test").toFile - try action(dir) - finally rm(dir) - } - - def withTempStream[A](action: ByteArrayOutputStream => A, size: Int = 1024): A = { - val out = new ByteArrayOutputStream(size) - try action(out) - finally out.close() - } - -} |