diff options
author | Adriaan Moors <adriaan.moors@typesafe.com> | 2013-12-08 21:01:27 -0800 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@typesafe.com> | 2013-12-08 21:01:27 -0800 |
commit | 75cc6cf256df9e152eaec771121ce0db9f7039f8 (patch) | |
tree | 655acca49d7990fbc7c273d761ca942aa0ac651d /test/junit | |
parent | 9751d19471c8ab7c1cc2a618fe097af9dddbd03b (diff) | |
parent | 58eadc09527c2b6722ddd830c0d3f319f2967ef7 (diff) | |
download | scala-75cc6cf256df9e152eaec771121ce0db9f7039f8.tar.gz scala-75cc6cf256df9e152eaec771121ce0db9f7039f8.tar.bz2 scala-75cc6cf256df9e152eaec771121ce0db9f7039f8.zip |
Merge pull request #3226 from ziggystar/patch-1
add method dequeueOption to immutable.Queue
Diffstat (limited to 'test/junit')
-rw-r--r-- | test/junit/scala/collection/QueueTest.scala | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/test/junit/scala/collection/QueueTest.scala b/test/junit/scala/collection/QueueTest.scala new file mode 100644 index 0000000000..9a40d8fc90 --- /dev/null +++ b/test/junit/scala/collection/QueueTest.scala @@ -0,0 +1,28 @@ +package scala.collection.immutable + +import org.junit.runner.RunWith +import org.junit.runners.JUnit4 +import org.junit.Test + +@RunWith(classOf[JUnit4]) +/* Tests for collection.immutable.Queue */ +class QueueTest { + val emptyQueue = Queue.empty[Int] + val oneAdded = emptyQueue.enqueue(1) + val threeAdded = emptyQueue.enqueue(1 to 3) + + @Test + def dequeueOptionOnEmpty() { + assert( emptyQueue.dequeueOption == None ) + } + + @Test + def dequeueOptionOneAdded() { + assert( oneAdded.dequeueOption == Some((1,emptyQueue)) ) + } + + @Test + def dequeueOptionThreeAdded() { + assert( threeAdded.dequeueOption == Some((1,Queue(2 to 3:_*))) ) + } +} |