diff options
Diffstat (limited to 'test/files/jvm')
-rw-r--r-- | test/files/jvm/concurrent-future.check | 14 | ||||
-rw-r--r-- | test/files/jvm/concurrent-future.scala | 122 | ||||
-rw-r--r--[-rwxr-xr-x] | test/files/jvm/interpreter.check | 9 | ||||
-rw-r--r-- | test/files/jvm/interpreter.scala | 9 | ||||
-rw-r--r-- | test/files/jvm/manifests.check | 111 | ||||
-rw-r--r-- | test/files/jvm/manifests.scala | 19 |
6 files changed, 73 insertions, 211 deletions
diff --git a/test/files/jvm/concurrent-future.check b/test/files/jvm/concurrent-future.check deleted file mode 100644 index 715ac90ce7..0000000000 --- a/test/files/jvm/concurrent-future.check +++ /dev/null @@ -1,14 +0,0 @@ -test1: hai world -test1: kthxbye -test2: hai world -test2: awsum thx -test2: kthxbye -test3: hai world -test4: hai world -test4: kthxbye -test5: hai world -test5: kthxbye -test6: hai world -test6: kthxbye -test7: hai world -test7: kthxbye diff --git a/test/files/jvm/concurrent-future.scala b/test/files/jvm/concurrent-future.scala deleted file mode 100644 index eda05428c8..0000000000 --- a/test/files/jvm/concurrent-future.scala +++ /dev/null @@ -1,122 +0,0 @@ - - - -import scala.concurrent._ - - - -object Test extends App { - - def once(body: (() => Unit) => Unit) { - val sv = new SyncVar[Boolean] - body(() => sv put true) - sv.take() - } - - def output(num: Int, msg: String) { - println("test" + num + ": " + msg) - } - - def testOnSuccess(): Unit = once { - done => - val f = future { - output(1, "hai world") - } - f onSuccess { case _ => - output(1, "kthxbye") - done() - } - } - - def testOnSuccessWhenCompleted(): Unit = once { - done => - val f = future { - output(2, "hai world") - } - f onSuccess { case _ => - output(2, "awsum thx") - f onSuccess { case _ => - output(2, "kthxbye") - done() - } - } - } - - def testOnSuccessWhenFailed(): Unit = once { - done => - val f = future[Unit] { - output(3, "hai world") - done() - throw new Exception - } - f onSuccess { case _ => - output(3, "onoes") - } - } - - def testOnFailure(): Unit = once { - done => - val f = future[Unit] { - output(4, "hai world") - throw new Exception - } - f onSuccess { case _ => - output(4, "onoes") - done() - } - f onFailure { case _ => - output(4, "kthxbye") - done() - } - } - - def testOnFailureWhenSpecialThrowable(num: Int, cause: Throwable): Unit = once { - done => - val f = future[Unit] { - output(num, "hai world") - throw cause - } - f onSuccess { case _ => - output(num, "onoes") - done() - } - f onFailure { - case e: ExecutionException if (e.getCause == cause) => - output(num, "kthxbye") - done() - case _ => - output(num, "onoes") - done() - } - } - - // def testOnFailureWhenFutureTimeoutException(): Unit = once { - // done => - // val f = future[Unit] { - // output(8, "hai world") - // throw new FutureTimeoutException(null) - // } - // f onSuccess { case _ => - // output(8, "onoes") - // done() - // } - // f onFailure { - // case e: FutureTimeoutException => - // output(8, "im in yr loop") - // done() - // case other => - // output(8, "onoes: " + other) - // done() - // } - // } - - testOnSuccess() - testOnSuccessWhenCompleted() - testOnSuccessWhenFailed() - testOnFailure() - testOnFailureWhenSpecialThrowable(5, new Error) - testOnFailureWhenSpecialThrowable(6, new scala.util.control.ControlThrowable { }) - testOnFailureWhenSpecialThrowable(7, new InterruptedException) - // testOnFailureWhenFutureTimeoutException() - -} diff --git a/test/files/jvm/interpreter.check b/test/files/jvm/interpreter.check index 243c9aa3be..b9ff6afa2b 100755..100644 --- a/test/files/jvm/interpreter.check +++ b/test/files/jvm/interpreter.check @@ -73,7 +73,7 @@ fish: S = fish scala> // Test that arrays pretty print nicely. -scala> val arr = Array("What's", "up", "doc?") +scala> val arr = Array("What's", "up", "doc?") arr: Array[String] = Array(What's, up, doc?) scala> // Test that arrays pretty print nicely, even when we give them type Any @@ -97,6 +97,7 @@ scala> case class Bar(n: Int) defined class Bar scala> implicit def foo2bar(foo: Foo) = Bar(foo.n) +warning: there were 1 feature warnings; re-run with -feature for details foo2bar: (foo: Foo)Bar scala> val bar: Bar = Foo(3) @@ -270,6 +271,8 @@ scala> xs map (x => x) res6: scala.collection.mutable.ArraySeq[_] = ArraySeq(1, 2) scala> xs map (x => (x, x)) +warning: there were 1 feature warnings; re-run with -feature for details +warning: there were 1 feature warnings; re-run with -feature for details res7: Array[(_$1, _$1)] forSome { type _$1 } = Array((1,1), (2,2)) scala> @@ -338,10 +341,10 @@ You typed two blank lines. Starting a new command. scala> // defining and using quoted names should work (ticket #323) -scala> def `match` = 1 +scala> def `match` = 1 match: Int -scala> val x = `match` +scala> val x = `match` x: Int = 1 scala> diff --git a/test/files/jvm/interpreter.scala b/test/files/jvm/interpreter.scala index f0bc8b5818..755b2ac9ae 100644 --- a/test/files/jvm/interpreter.scala +++ b/test/files/jvm/interpreter.scala @@ -2,6 +2,7 @@ import scala.tools.nsc._ import scala.tools.partest.ReplTest object Test extends ReplTest { + override def extraSettings = "-deprecation -Xoldpatmat" def code = <code> // basics 3+4 @@ -29,7 +30,7 @@ val atom = new scala.xml.Atom() class S(override val toString : String) val fish = new S("fish") // Test that arrays pretty print nicely. -val arr = Array("What's", "up", "doc?") +val arr = Array("What's", "up", "doc?") // Test that arrays pretty print nicely, even when we give them type Any val arrInt : Any = Array(1,2,3) // Test that nested arrays are pretty-printed correctly @@ -132,8 +133,8 @@ there // defining and using quoted names should work (ticket #323) -def `match` = 1 -val x = `match` +def `match` = 1 +val x = `match` // multiple classes defined on one line sealed class Exp; class Fact extends Exp; class Term extends Exp @@ -153,6 +154,6 @@ def f(e: Exp) = e match {{ // non-exhaustive warning here interp.interpret("\"after reset\"") interp.interpret("plusOne(5) // should be undefined now") } - + appendix() } diff --git a/test/files/jvm/manifests.check b/test/files/jvm/manifests.check index 54f504b929..be8ec2bb5b 100644 --- a/test/files/jvm/manifests.check +++ b/test/files/jvm/manifests.check @@ -1,55 +1,56 @@ -x=(), m=Unit -x=true, m=Boolean -x=a, m=Char -x=1, m=Int -x=abc, m=java.lang.String -x='abc, m=scala.Symbol - -x=List(()), m=scala.collection.immutable.List[Unit] -x=List(true), m=scala.collection.immutable.List[Boolean] -x=List(1), m=scala.collection.immutable.List[Int] -x=List(abc), m=scala.collection.immutable.List[java.lang.String] -x=List('abc), m=scala.collection.immutable.List[scala.Symbol] - -x=[Z, m=Array[Boolean] -x=[C, m=Array[Char] -x=[I, m=Array[Int] -x=[Ljava.lang.String;, m=Array[java.lang.String] -x=[Lscala.Symbol;, m=Array[scala.Symbol] - -x=((),()), m=scala.Tuple2[Unit, Unit] -x=(true,false), m=scala.Tuple2[Boolean, Boolean] -x=(1,2), m=scala.Tuple2[Int, Int] -x=(abc,xyz), m=scala.Tuple2[java.lang.String, java.lang.String] -x=('abc,'xyz), m=scala.Tuple2[scala.Symbol, scala.Symbol] - - -x=Foo, m=Foo[Int] -x=Foo, m=Foo[scala.collection.immutable.List[Int]] -x=Foo, m=Foo[Foo[Int]] -x=Foo, m=Foo[scala.collection.immutable.List[Foo[Int]]] - -x=Test1$$anon$1, m=Object with Bar[java.lang.String] - -()=() -true=true -a=a -1=1 -'abc='abc - -List(())=List(()) -List(true)=List(true) -List('abc)=List('abc) - -Array()=Array() -Array(true)=Array(true) -Array(a)=Array(a) -Array(1)=Array(1) - -((),())=((),()) -(true,false)=(true,false) - -List(List(1), List(2))=List(List(1), List(2)) - -Array(Array(1), Array(2))=Array(Array(1), Array(2)) - +x=(), m=ConcreteTypeTag[Unit], k=TypeRef, s=class Unit
+x=true, m=ConcreteTypeTag[Boolean], k=TypeRef, s=class Boolean
+x=a, m=ConcreteTypeTag[Char], k=TypeRef, s=class Char
+x=1, m=ConcreteTypeTag[Int], k=TypeRef, s=class Int
+x=abc, m=ConcreteTypeTag[String], k=TypeRef, s=class String
+x='abc, m=ConcreteTypeTag[Symbol], k=TypeRef, s=class Symbol
+
+x=List(()), m=ConcreteTypeTag[List[Unit]], k=TypeRef, s=class List
+x=List(true), m=ConcreteTypeTag[List[Boolean]], k=TypeRef, s=class List
+x=List(1), m=ConcreteTypeTag[List[Int]], k=TypeRef, s=class List
+x=List(abc), m=ConcreteTypeTag[List[String]], k=TypeRef, s=class List
+x=List('abc), m=ConcreteTypeTag[List[Symbol]], k=TypeRef, s=class List
+
+x=[Z, m=ConcreteTypeTag[Array[Boolean]], k=TypeRef, s=class Array
+x=[C, m=ConcreteTypeTag[Array[Char]], k=TypeRef, s=class Array
+x=[I, m=ConcreteTypeTag[Array[Int]], k=TypeRef, s=class Array
+x=[Ljava.lang.String;, m=ConcreteTypeTag[Array[String]], k=TypeRef, s=class Array
+x=[Lscala.Symbol;, m=ConcreteTypeTag[Array[Symbol]], k=TypeRef, s=class Array
+
+x=((),()), m=ConcreteTypeTag[(Unit, Unit)], k=TypeRef, s=class Tuple2
+x=(true,false), m=ConcreteTypeTag[(Boolean, Boolean)], k=TypeRef, s=class Tuple2
+x=(1,2), m=ConcreteTypeTag[(Int, Int)], k=TypeRef, s=class Tuple2
+x=(abc,xyz), m=ConcreteTypeTag[(String, String)], k=TypeRef, s=class Tuple2
+x=('abc,'xyz), m=ConcreteTypeTag[(Symbol, Symbol)], k=TypeRef, s=class Tuple2
+
+
+x=Foo, m=ConcreteTypeTag[Foo[Int]], k=TypeRef, s=class Foo
+x=Foo, m=ConcreteTypeTag[Foo[List[Int]]], k=TypeRef, s=class Foo
+x=Foo, m=ConcreteTypeTag[Foo[Foo[Int]]], k=TypeRef, s=class Foo
+x=Foo, m=ConcreteTypeTag[Foo[List[Foo[Int]]]], k=TypeRef, s=class Foo
+
+x=Test1$$anon$1, m=ConcreteTypeTag[Bar[String]], k=RefinedType, s=<local Test1>
+x=Test1$$anon$2, m=ConcreteTypeTag[Bar[String]], k=RefinedType, s=<local Test1>
+
+()=()
+true=true
+a=a
+1=1
+'abc='abc
+
+List(())=List(())
+List(true)=List(true)
+List('abc)=List('abc)
+
+Array()=Array()
+Array(true)=Array(true)
+Array(a)=Array(a)
+Array(1)=Array(1)
+
+((),())=((),())
+(true,false)=(true,false)
+
+List(List(1), List(2))=List(List(1), List(2))
+
+Array(Array(1), Array(2))=Array(Array(1), Array(2))
+
diff --git a/test/files/jvm/manifests.scala b/test/files/jvm/manifests.scala index 6bbea4d052..935427f5d4 100644 --- a/test/files/jvm/manifests.scala +++ b/test/files/jvm/manifests.scala @@ -1,7 +1,6 @@ object Test extends App { Test1 Test2 - //Test3 // Java 1.5+ only } class Foo[T](x: T) @@ -51,7 +50,8 @@ object Test1 extends TestUtil { print(new Foo(List(new Foo(2)))) println() - print(new Bar[String] { def f = "abc" }) + print(new Bar[String] { def f = "abc" }); + {print(new Bar[String] { def f = "abc" })} println() } @@ -88,15 +88,6 @@ object Test2 { println() } -object Test3 extends TestUtil { - import scala.reflect.Manifest._ - val ct1 = classType(classOf[Char]) - val ct2 = classType(classOf[List[_]], ct1) - print(ct1) - //print(ct2) // ??? x=scala.List[char], m=scala.reflect.Manifest[scala.runtime.Nothing$] - println() -} - trait TestUtil { import java.io._ def write[A](o: A): Array[Byte] = { @@ -112,8 +103,10 @@ trait TestUtil { } import scala.reflect._ def print[T](x: T)(implicit m: Manifest[T]) { - val m1: Manifest[T] = read(write(m)) + // manifests are no longer serializable +// val m1: Manifest[T] = read(write(m)) + val m1: Manifest[T] = m val x1 = x.toString.replaceAll("@[0-9a-z]+$", "") - println("x="+x1+", m="+m1) + println("x="+x1+", m="+m1+", k="+m1.tpe.kind+", s="+m1.sym.toString) } } |