summaryrefslogtreecommitdiff
path: root/test/files/run/patmatnew.scala
diff options
context:
space:
mode:
Diffstat (limited to 'test/files/run/patmatnew.scala')
-rw-r--r--test/files/run/patmatnew.scala15
1 files changed, 14 insertions, 1 deletions
diff --git a/test/files/run/patmatnew.scala b/test/files/run/patmatnew.scala
index 46e980dff0..89b9afb32b 100644
--- a/test/files/run/patmatnew.scala
+++ b/test/files/run/patmatnew.scala
@@ -20,7 +20,8 @@ object Test extends TestConsoleMain {
def suite = new TestSuite(
new TestSimpleIntSwitch,
new Test717,
- new TestGuards
+ new TestGuards,
+ new TestStream
)
@@ -70,6 +71,18 @@ object Test extends TestConsoleMain {
}
}
+ class TestStream extends TestCase("unapply for Streams") {
+ def sum(stream: Stream[int]): int =
+ stream match {
+ case Stream.empty => 0
+ case Stream.cons(hd, tl) => hd + sum(tl)
+ }
+
+ val str: Stream[int] = Stream.fromIterator(List(1,2,3).elements)
+
+ def runTest() = assertEquals(sum(str), 6)
+ }
+
class Test806_818 { // #806, #811 compile only -- type of bind
// bug811
trait Core {