diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/files/run/regularpatmat.check | 6 | ||||
-rw-r--r-- | test/files/run/regularpatmat.scala | 24 |
2 files changed, 30 insertions, 0 deletions
diff --git a/test/files/run/regularpatmat.check b/test/files/run/regularpatmat.check index 97e689710d..cefc159c2c 100644 --- a/test/files/run/regularpatmat.check +++ b/test/files/run/regularpatmat.check @@ -99,3 +99,9 @@ passed ok passed ok passed ok passed ok +testMZ - bug#132 +passed ok +passed ok +passed ok +passed ok +passed ok diff --git a/test/files/run/regularpatmat.scala b/test/files/run/regularpatmat.scala index df0d55707f..b9db627de7 100644 --- a/test/files/run/regularpatmat.scala +++ b/test/files/run/regularpatmat.scala @@ -568,6 +568,29 @@ object testWW { } +object testMZ { + import scala.testing.UnitTest.test ; + class Expr; + case class One(xs: List[Expr]) extends Expr; + case class Two() extends Expr; + def testFoo(xs: List[Expr]) = xs match { + case List(Two()?,a,Two()?) => "a = " + a; + case List(Two()*,b,Two()*) => "b = " + b; + case List(_*) => "no match"; + } + + def main:Unit = { + System.out.println("testMZ - bug#132"); + test[List[Expr],String](testFoo, List(Two(),Two(),Two(),Two()), "b = Two"); + test[List[Expr],String](testFoo, List(Two(),Two(),Two()), "a = Two"); + test[List[Expr],String](testFoo, List(Two(),Two()), "a = Two"); + test[List[Expr],String](testFoo, List(Two()), "a = Two"); + test[List[Expr],String](testFoo, List(), "no match"); + () + } + +} + object Test { def main(args: Array[String]): Unit = { testWR.main( args ); @@ -580,6 +603,7 @@ object Test { testBM.main( args ); testBN.main( args ); testBO.main( args ); + testMZ.main; () } } |