summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorLukas Rytz <lukas.rytz@gmail.com>2016-11-18 09:00:30 +0100
committerGitHub <noreply@github.com>2016-11-18 09:00:30 +0100
commit40f8df19ced57637a795c705080e528d82303248 (patch)
treed791ddfd964b8eea8dfd170f5b86dff9d0e66a49 /test
parent4fe94a2ded7bf64b3d665e32f95978f5c0927805 (diff)
parentfbcfba212fff76272c509c6781ea2a2897d84bff (diff)
downloadscala-40f8df19ced57637a795c705080e528d82303248.tar.gz
scala-40f8df19ced57637a795c705080e528d82303248.tar.bz2
scala-40f8df19ced57637a795c705080e528d82303248.zip
Merge pull request #5481 from som-snytt/issue/10007-process
SI-10007 sys.process thread sync
Diffstat (limited to 'test')
-rw-r--r--test/junit/scala/sys/process/PipedProcessTest.scala (renamed from test/junit/scala/sys/process/t7350.scala)1
-rw-r--r--test/junit/scala/sys/process/ProcessTest.scala25
2 files changed, 26 insertions, 0 deletions
diff --git a/test/junit/scala/sys/process/t7350.scala b/test/junit/scala/sys/process/PipedProcessTest.scala
index 9fdcac8ccc..53f053e9aa 100644
--- a/test/junit/scala/sys/process/t7350.scala
+++ b/test/junit/scala/sys/process/PipedProcessTest.scala
@@ -12,6 +12,7 @@ import scala.concurrent.ExecutionContext.Implicits.global
import scala.util.control.Exception.ignoring
// Each test normally ends in a moment, but for failure cases, waits until one second.
+// SI-7350, SI-8768
@RunWith(classOf[JUnit4])
class PipedProcessTest {
diff --git a/test/junit/scala/sys/process/ProcessTest.scala b/test/junit/scala/sys/process/ProcessTest.scala
new file mode 100644
index 0000000000..f6d779c2c8
--- /dev/null
+++ b/test/junit/scala/sys/process/ProcessTest.scala
@@ -0,0 +1,25 @@
+package scala.sys.process
+
+import java.io.ByteArrayInputStream
+// should test from outside the package to ensure implicits work
+//import scala.sys.process._
+import scala.util.Properties._
+
+import org.junit.runner.RunWith
+import org.junit.runners.JUnit4
+import org.junit.Test
+import org.junit.Assert.assertEquals
+
+@RunWith(classOf[JUnit4])
+class ProcessTest {
+ private def testily(body: => Unit) = if (!isWin) body
+ @Test def t10007(): Unit = testily {
+ val res = ("cat" #< new ByteArrayInputStream("lol".getBytes)).!!
+ assertEquals("lol\n", res)
+ }
+ // test non-hanging
+ @Test def t10055(): Unit = testily {
+ val res = ("cat" #< ( () => -1 ) ).!
+ assertEquals(0, res)
+ }
+}