summaryrefslogtreecommitdiff
path: root/test/files/run/lists.scala
diff options
context:
space:
mode:
Diffstat (limited to 'test/files/run/lists.scala')
-rw-r--r--test/files/run/lists.scala16
1 files changed, 15 insertions, 1 deletions
diff --git a/test/files/run/lists.scala b/test/files/run/lists.scala
index 19da548d61..9e62fd72be 100644
--- a/test/files/run/lists.scala
+++ b/test/files/run/lists.scala
@@ -17,7 +17,8 @@ object Test extends TestConsoleMain {
Test1, //count, exists, filter, ..
Test2, //#468
Test3, //#1691
- Test4 //#1721
+ Test4, //#1721
+ Test5
)
}
@@ -195,3 +196,16 @@ object Test4 extends TestCase("t1721") with Assert {
assertTrue(List().endsWith(List()))
}
}
+
+object Test5 extends TestCase("list pattern matching") {
+ def show(xs: List[String]) = xs match {
+ case "foo" :: args => args.toString
+ case List(x) => x.toString
+ case Nil => "Nil"
+ }
+ override def runTest {
+ assert(show(List()) == "Nil")
+ assert(show(List("a")) == "a")
+ assert(show(List("foo", "b")) == "List(b)")
+ }
+}