diff options
Diffstat (limited to 'test/files')
-rw-r--r-- | test/files/jvm/serialization.check | 42 | ||||
-rw-r--r-- | test/files/neg/bug85.scala (renamed from test/files/pos/bug85.scala) | 0 | ||||
-rw-r--r-- | test/files/pos/bug210.scala | 4 | ||||
-rw-r--r-- | test/files/pos/context.scala | 4 | ||||
-rw-r--r-- | test/files/pos/expressions-current.scala | 6 | ||||
-rw-r--r-- | test/files/run/regularpatmat.scala.disabled (renamed from test/files/run/regularpatmat.scala) | 78 |
6 files changed, 86 insertions, 48 deletions
diff --git a/test/files/jvm/serialization.check b/test/files/jvm/serialization.check index c2728a5401..8675b01ceb 100644 --- a/test/files/jvm/serialization.check +++ b/test/files/jvm/serialization.check @@ -74,8 +74,46 @@ x = <html><title>title</title><body></body></html> y = <html><title>title</title><body></body></html> x equals y: true - y equals x: true -x = <html><body><table cellspacing="0" cellpadding="2"><tr><th>Last Name</th><th>First Name</th></tr><tr><td>Tom</td><td>20</td></tr><tr><td>Bob</td><td>22</td></tr><tr><td>James</td><td>19</td></tr></table></body></html> -y = <html><body><table cellspacing="0" cellpadding="2"><tr><th>Last Name</th><th>First Name</th></tr><tr><td>Tom</td><td>20</td></tr><tr><td>Bob</td><td>22</td></tr><tr><td>James</td><td>19</td></tr></table></body></html> +x = <html> + <body> + <table cellpadding="2" cellspacing="0"> + <tr> + <th>Last Name</th> + <th>First Name</th> + </tr> + <tr> + <td> Tom </td> + <td> 20 </td> + </tr> <tr> + <td> Bob </td> + <td> 22 </td> + </tr> <tr> + <td> James </td> + <td> 19 </td> + </tr> + </table> + </body> + </html> +y = <html> + <body> + <table cellpadding="2" cellspacing="0"> + <tr> + <th>Last Name</th> + <th>First Name</th> + </tr> + <tr> + <td> Tom </td> + <td> 20 </td> + </tr> <tr> + <td> Bob </td> + <td> 22 </td> + </tr> <tr> + <td> James </td> + <td> 19 </td> + </tr> + </table> + </body> + </html> x equals y: true - y equals x: true x = Tim diff --git a/test/files/pos/bug85.scala b/test/files/neg/bug85.scala index e018afb6ee..e018afb6ee 100644 --- a/test/files/pos/bug85.scala +++ b/test/files/neg/bug85.scala diff --git a/test/files/pos/bug210.scala b/test/files/pos/bug210.scala index 20450335f4..efcad531d9 100644 --- a/test/files/pos/bug210.scala +++ b/test/files/pos/bug210.scala @@ -1,13 +1,13 @@ trait Lang1 { trait Exp; trait Visitor { def f(left: Exp): unit; } - class Eval1: Visitor extends Visitor { + class Eval1 requires Visitor extends Visitor { def f(left: Exp) = (); } } trait Lang2 extends Lang1 { - class Eval2: Visitor extends Eval1; + class Eval2 requires Visitor extends Eval1; } /* object Main with Application { diff --git a/test/files/pos/context.scala b/test/files/pos/context.scala index ada6a57463..327f3261be 100644 --- a/test/files/pos/context.scala +++ b/test/files/pos/context.scala @@ -13,7 +13,7 @@ abstract class SymbolWrapper { val context: Context; import context._; - class Symbols: context.symbols.type { + class Symbols requires context.symbols.type { abstract class Symbol { def typ: types.Type; def sym: Symbol = typ.sym; @@ -25,7 +25,7 @@ abstract class TypeWrapper { val context: Context; import context._; - class Types: context.types.type { + class Types requires context.types.type { abstract class Type { def sym: symbols.Symbol; def typ: Type = sym.typ; diff --git a/test/files/pos/expressions-current.scala b/test/files/pos/expressions-current.scala index b343dbf68b..b383ad949d 100644 --- a/test/files/pos/expressions-current.scala +++ b/test/files/pos/expressions-current.scala @@ -15,7 +15,7 @@ abstract class Lang { def visit(v: visitor): unit = v.caseNum(n); } - class Eval(result: Ref[int]): visitor extends Visitor { + class Eval(result: Ref[int]) requires visitor extends Visitor { def caseNum(n: int) = result.elem = n; } } @@ -31,12 +31,12 @@ abstract class Lang2 extends Lang { def visit(v: visitor): unit = v.casePlus(l, r); } - class Eval2(result: Ref[int]): visitor extends Eval(result) with Visitor2 { + class Eval2(result: Ref[int]) requires visitor extends Eval(result) with Visitor2 { def casePlus(l: Exp, r: Exp) = result.elem = { l.visit(this); result.elem } + { r.visit(this); result.elem } } - class Show2(result: Ref[String]): visitor extends Visitor2 { + class Show2(result: Ref[String]) requires visitor extends Visitor2 { def caseNum(n: int) = result.elem = n.toString(); def casePlus(l: Exp, r: Exp) = result.elem = diff --git a/test/files/run/regularpatmat.scala b/test/files/run/regularpatmat.scala.disabled index b762873bca..d8e244d03b 100644 --- a/test/files/run/regularpatmat.scala +++ b/test/files/run/regularpatmat.scala.disabled @@ -101,18 +101,18 @@ object testBL { import scala.testing.UnitTest._ ; def preTest(a:String,b:String):boolean = (a==b); - + def doit(x: List[String]): String = x match { case List( z @ "John" ) => z } - - // BEWARE: main type should be specified... + + // BEWARE: main type should be specified... // often, last thing is not () then you have a problem def main(args: Array[String]): Unit = { - val a = "John"; + val a = "John"; val b = "John"; - + assertEquals(a == b, true); assertEquals(doit(List(b)), "John") } @@ -138,7 +138,7 @@ object testBM { Console.println("testBM"); assertEquals( doit1( s0 ), Nil); assertEquals( doit1( s1 ), s1); - assertEquals( doit1( s2 ), s2); + assertEquals( doit1( s2 ), s2); assertEquals( doit1( s3 ), List('a')); assertEquals( doit1( s4 ), Nil); @@ -161,7 +161,7 @@ object testBN { import scala.testing.UnitTest._ ; import values._ ; - + class testClass; case class testA(arg: List[Char]) extends testClass; @@ -198,7 +198,7 @@ object testBO { case class Person(firstname: String, lastname: String); - def onlyJohn(db: List[Person]): List[String] = db match { + def onlyJohn(db: List[Person]): List[String] = db match { case List(Person("John", lastname)) => lastname::Nil case _ => Nil } @@ -291,7 +291,7 @@ object testWR { assertEquals(doit3(s0), "ok"); assertEquals(doit3(s1), "fail"); assertEquals(doit3(s2), "fail"); - assertEquals(doit3(s3), "ok"); + assertEquals(doit3(s3), "ok"); assertEquals(doit3(s4), "fail"); assertEquals(doit3(s5), "fail"); assertEquals(doit3(s6), "fail"); @@ -323,7 +323,7 @@ object testWR { assertEquals( doit5( s7 ), "not binary"); assertEquals( doit5( s8 ), "binary"); assertEquals( doit5( s9 ), "not binary"); - } + } // { ('0'..'9')*;'.';('0'..'9');('0'..'9')* ] def doit6(e: List[Char]): String = e match { @@ -340,11 +340,11 @@ object testWR { Console.println("testWR_6"); assertEquals(doit6(s3), "not decimal"); assertEquals(doit6(s10), "decimal number"); - } + } def test8: Unit = { Console.println("testWR_8"); - + assertTrue( List('d','c') match { case List('a'*, 'd'|'e', 'c'*) => true case _ => false @@ -390,14 +390,14 @@ object testWS { case [ ... ; _isIdentifierStart_ ; ... ] calls method is..., needs to have type (elementType)Boolean - + translated to pattern - + [ ... ; Apply(is..., Tree.Empty) ; ... ] */ - /* for tree automata: + /* for tree automata: [ t0; t1; ...; tn ] with ti = labeli ( argsi ) @@ -413,10 +413,10 @@ object testWS { gets translated to - [ ...; _seq$0_ ; ...] with seq$0( s ) = t.is[ Sequence ] and + [ ...; _seq$0_ ; ...] with seq$0( s ) = t.is[ Sequence ] and seq$0match( s.newIterator ) - subroutines return + subroutines return 1) d'abord true or false, 2) later ( true|false, environment ) assume order on variables, enviroment is a tuple/sequence @@ -428,7 +428,7 @@ object testWS { case List( ('a', 'a','a')? ) => 50 case List( ('a'|'b')*,('a'|'b') ) => 700 case _ => 321 - }; + }; def test1: Unit = { Console.println("testWS"); @@ -478,7 +478,7 @@ object testWV { import values._ ; import scala.testing.UnitTest._ ; - + class testClass; case class testA( arg:List[Char] ) extends testClass; @@ -513,16 +513,16 @@ object testWW { import values._ ; import scala.testing.UnitTest._ ; - + class testClass; case class testA( arg:List[Char] ) extends testClass; def doit1(e: List[testClass]):Int = e match { - + case List( testA(List()), testA( List( 'a', 'b' )) ) => 100 case _ => 321 - }; + }; def test1:Unit = { val x1 = List( testA(s0) ); @@ -532,7 +532,7 @@ object testWW { assertEquals( doit1( x1 ), 321 ); val x2 = List( testA(Nil), testA('a'::'b'::Nil) ); - + assertEquals( doit1( x2 ), 100 ); } @@ -566,7 +566,7 @@ object testMZ { } - def mat195(x:Expr) = x match { // bug#195 + def mat195(x:Expr) = x match { // bug#195 case One(x@List(_*)) => "x = " + x; @@ -574,7 +574,7 @@ object testMZ { } - def mat196(xs: List[Any]) = xs match { // bug#196 + def mat196(xs: List[Any]) = xs match { // bug#196 case List(b@(()|())) => "case, b = " + b; @@ -592,18 +592,18 @@ object testMZ { 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()) + 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()) } @@ -632,7 +632,7 @@ object testMZ { } */ - def main:Unit = { + def main:Unit = { 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"); @@ -657,7 +657,7 @@ object testMZ { assertEquals(mat441(), "b"); () } - + } /* object testNN { @@ -674,9 +674,9 @@ object testNN { def main:Unit = { Console.println("testNN"); assertEquals(mtch( F(F(G()),G(),F(G()))), true); - assertEquals(mtch( F(F(),G(),F(G(),G(),G(),G())) ), true); - assertEquals(mtch( G() ), false); - assertEquals(mtch( F(G()) ), false); + assertEquals(mtch( F(F(),G(),F(G(),G(),G(),G())) ), true); + assertEquals(mtch( G() ), false); + assertEquals(mtch( F(G()) ), false); } } */ @@ -685,14 +685,14 @@ object testNO { // this does not need to be run, only compiled trait Operator; case class Increment() extends Operator; case class Decrement() extends Operator; - + trait Expression { def eval = this match { case Operation (v: Value, o: Increment) => v case Operation (v: Value, d: Decrement) => v } } - + case class Value() extends Expression; case class Operation (e: Expression, o: Operator) extends Expression; @@ -714,13 +714,13 @@ object testBugSequenceApply { } // this works - def main:Unit = { + def main:Unit = { Console.print("testBugSequenceApply "); val z: Seq[Int] = new ThreeBars(); Console.print(z match { case Seq(1,2,3) => "hello" // but ThreeBars is a case class... }); - + Console.print(ThreeBars() match { case Seq(1,2,3) => " hello" // but ThreeBars is a case class... }); |