summaryrefslogtreecommitdiff
path: root/test/files
diff options
context:
space:
mode:
authorburaq <buraq@epfl.ch>2005-06-10 16:37:26 +0000
committerburaq <buraq@epfl.ch>2005-06-10 16:37:26 +0000
commit20e20196473e16ace8e29ad8f85a9ec79af043aa (patch)
treeded50283cf48cca4e52a758f84c12009f1ec695d /test/files
parent6ad31934e9c09b5523b3d7304e4014ff1c3037df (diff)
downloadscala-20e20196473e16ace8e29ad8f85a9ec79af043aa.tar.gz
scala-20e20196473e16ace8e29ad8f85a9ec79af043aa.tar.bz2
scala-20e20196473e16ace8e29ad8f85a9ec79af043aa.zip
fixed bugs #406 #440 #371
Diffstat (limited to 'test/files')
-rw-r--r--test/files/run/regularpatmat.check5
-rw-r--r--test/files/run/regularpatmat.scala39
2 files changed, 41 insertions, 3 deletions
diff --git a/test/files/run/regularpatmat.check b/test/files/run/regularpatmat.check
index 7c6f67ea71..3417d9a98a 100644
--- a/test/files/run/regularpatmat.check
+++ b/test/files/run/regularpatmat.check
@@ -102,7 +102,10 @@ passed ok
passed ok
passed ok
passed ok
-testMZ - bugs #132 #133b #180 #195 #196
+testMZ - bugs #132 #133b #180 #195 #196 #398 #406 #441
+passed ok
+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 6847861d4d..f6991cab5c 100644
--- a/test/files/run/regularpatmat.scala
+++ b/test/files/run/regularpatmat.scala
@@ -667,8 +667,41 @@ object testMZ {
case x::xs => "two"
}
+ def mat406() = {
+ class Type;
+ case class A() extends Type;
+ case class B() extends Type;
+ case class C() extends Type;
+
+ def foo(x: Type, y: Type): String = Pair(x, y) match {
+ case Pair(A(), A())
+ | Pair(A(), B())
+ | Pair(B(), A())
+ | Pair(B(), B()) => "3"
+ case Pair(C(), C()) => "4"
+ case Pair(A(), _)
+ | Pair(B(), _) => "7"
+ case _ => "8"
+ }
+
+ foo(A(), C())
+ }
+
+ def mat441() = {
+ val tata = 1;
+ val titi = 0.8 + Math.random();
+ try {
+ tata match {
+ case 1 if (titi < 0.5) => "a"
+ case 0 | 1 => "b"
+ }
+ } catch {
+ case _ => "c"
+ }
+ }
+
def main:Unit = {
- Console.println("testMZ - bugs #132 #133b #180 #195 #196");
+ Console.println("testMZ - bugs #132 #133b #180 #195 #196 #398 #406 #441");
assertEquals(testFoo( List(Two(),Two(),Two(),Two()) ),"b = Two");
assertEquals(testFoo( List(Two(),Two(),Two()) ),"a = Two");
assertEquals(testFoo( List(Two(),Two()) ),"a = Two");
@@ -687,7 +720,9 @@ object testMZ {
assertEquals(mat196( List(1) ),"default");
assertEquals(mat196( List() ),"case, b = List()");
assertEquals(mat398( List(2) ),"two");
-
+ assertEquals(mat398( List(2) ),"two");
+ assertEquals(mat406(), "7");
+ assertEquals(mat441(), "b");
()
}