summaryrefslogtreecommitdiff
path: root/test/files/run/lists.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2009-05-27 16:19:05 +0000
committerMartin Odersky <odersky@gmail.com>2009-05-27 16:19:05 +0000
commit2039b7fec7b902e3cef0a9c31a94ea96c2e469c8 (patch)
treecfa00f45f4f0fe0a502aab23e50088783851fa1f /test/files/run/lists.scala
parentb22342e78a3134d186f82dac5e1c7be01ece7c17 (diff)
downloadscala-2039b7fec7b902e3cef0a9c31a94ea96c2e469c8.tar.gz
scala-2039b7fec7b902e3cef0a9c31a94ea96c2e469c8.tar.bz2
scala-2039b7fec7b902e3cef0a9c31a94ea96c2e469c8.zip
Fixed problem that spurious caused exhaustivene...
Fixed problem that spurious caused exhaustiveness warning for RefChecks. Enriched positions and worked on the interactive compiler.
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)")
+ }
+}