diff options
author | Burak Emir <emir@epfl.ch> | 2006-07-12 12:23:42 +0000 |
---|---|---|
committer | Burak Emir <emir@epfl.ch> | 2006-07-12 12:23:42 +0000 |
commit | b53dced1215bffa82ae3f4aa38f614e4a0f48a7d (patch) | |
tree | 088a69bfcb55988b9bd980cef71f660566d9eba2 /test/files/run | |
parent | e4fc9bd2fc3f14e603ff9000fde78fef021c1090 (diff) | |
download | scala-b53dced1215bffa82ae3f4aa38f614e4a0f48a7d.tar.gz scala-b53dced1215bffa82ae3f4aa38f614e4a0f48a7d.tar.bz2 scala-b53dced1215bffa82ae3f4aa38f614e4a0f48a7d.zip |
fixed bug #654 and removed generation of an unn...
fixed bug #654 and removed generation of an unnecessary duplicate cast
Diffstat (limited to 'test/files/run')
-rw-r--r-- | test/files/run/regularpatmatnew.scala | 33 |
1 files changed, 29 insertions, 4 deletions
diff --git a/test/files/run/regularpatmatnew.scala b/test/files/run/regularpatmatnew.scala index af2dd65d2e..444b36e32f 100644 --- a/test/files/run/regularpatmatnew.scala +++ b/test/files/run/regularpatmatnew.scala @@ -7,7 +7,8 @@ object Test { new Test01, new Test02, - new Test03 + new Test03, + new Test04 ).run(tr) @@ -15,7 +16,7 @@ object Test { Console println f } - class Test01 extends TestCase("numero uno (all ignoring patterns on List)") { + class Test01 extends TestCase("uno (all ignoring patterns on List)") { def doMatch(l:List[String]):String = l match { case List(_*) => "ok" } @@ -40,7 +41,7 @@ object Test { } */ - class Test02 extends TestCase("numero due (all ignoring patterns on Seq)") { + class Test02 extends TestCase("due (all ignoring patterns on Seq)") { def doMatch(l:Seq[String]):String = l match { case Seq(_*) => "ok" } @@ -56,7 +57,7 @@ object Test { } } - class Test03 extends TestCase("numero tre (right-ignoring patterns on List, defaults)") { + class Test03 extends TestCase("tre (right-ignoring patterns on List, defaults)") { def doMatch(l:List[String]):String = l match { case List(_,_,_,_*) => "ok" case _ => "not ok" @@ -71,4 +72,28 @@ object Test { } } + + class Test04 extends TestCase("quattro (all- and right-ignoring pattern on case class w/ seq param)") { + case class Foo(i: Int, chars: Char*) + + override def runTest() = { + val a = Foo(0, 'a') match { + case Foo(i, c, chars @ _*) => + c + case _ => + null + } + assertEquals(a,'a') + + val b = Foo(0, 'a') match { + case Foo(i, chars @ _*) => + 'b' + case _ => + null + } + assertEquals(b,'b') + } + } + + } |