diff options
Diffstat (limited to 'test/files')
-rw-r--r-- | test/files/neg/t4271.check | 10 | ||||
-rw-r--r-- | test/files/neg/t4271.scala | 12 | ||||
-rw-r--r-- | test/files/pos/t4176.scala | 6 | ||||
-rw-r--r-- | test/files/pos/t5120.scala | 26 | ||||
-rw-r--r-- | test/files/run/Predef.readLine.check | 3 | ||||
-rw-r--r-- | test/files/run/Predef.readLine.scala | 10 | ||||
-rw-r--r-- | test/files/run/si5262.check | 2 | ||||
-rw-r--r-- | test/files/run/si5262.scala | 26 | ||||
-rw-r--r-- | test/files/run/si5374.check | 3 | ||||
-rw-r--r-- | test/files/run/si5374.scala | 42 | ||||
-rw-r--r-- | test/files/run/t4835.check | 7 | ||||
-rw-r--r-- | test/files/run/t4835.scala | 38 | ||||
-rw-r--r-- | test/files/run/t5072.check | 14 | ||||
-rw-r--r-- | test/files/run/t5072.scala | 8 | ||||
-rw-r--r-- | test/files/run/trait-renaming.check | 2 | ||||
-rw-r--r-- | test/files/run/trait-renaming/A_1.scala | 15 | ||||
-rw-r--r-- | test/files/run/trait-renaming/B_2.scala | 5 |
17 files changed, 229 insertions, 0 deletions
diff --git a/test/files/neg/t4271.check b/test/files/neg/t4271.check new file mode 100644 index 0000000000..91d9fbcfa1 --- /dev/null +++ b/test/files/neg/t4271.check @@ -0,0 +1,10 @@ +t4271.scala:9: error: value to is not a member of Int + 3 to 5 + ^ +t4271.scala:10: error: value ensuring is not a member of Int + 5 ensuring true + ^ +t4271.scala:11: error: value -> is not a member of Int + 3 -> 5 + ^ +three errors found diff --git a/test/files/neg/t4271.scala b/test/files/neg/t4271.scala new file mode 100644 index 0000000000..50526c8958 --- /dev/null +++ b/test/files/neg/t4271.scala @@ -0,0 +1,12 @@ +object foo { + object Donotuseme + implicit def any2Ensuring[A](x: A) = Donotuseme + implicit def doubleWrapper(x: Int) = Donotuseme + implicit def floatWrapper(x: Int) = Donotuseme + implicit def intWrapper(x: Int) = Donotuseme + implicit def longWrapper(x: Int) = Donotuseme + implicit def any2ArrowAssoc[A](x: A) = Donotuseme + 3 to 5 + 5 ensuring true + 3 -> 5 +} diff --git a/test/files/pos/t4176.scala b/test/files/pos/t4176.scala new file mode 100644 index 0000000000..b4f1e705b1 --- /dev/null +++ b/test/files/pos/t4176.scala @@ -0,0 +1,6 @@ +// a.scala +// Fri Jan 20 12:22:51 PST 2012 + +class A(xs: Int*) { def getXs = xs } + +class B extends A { override def getXs = Nil } diff --git a/test/files/pos/t5120.scala b/test/files/pos/t5120.scala new file mode 100644 index 0000000000..2c193d129d --- /dev/null +++ b/test/files/pos/t5120.scala @@ -0,0 +1,26 @@ +// An example extracted from SBT by Iulian +// that showed that the previous fix to t5120 +// was too strict. +class Test { + class ScopedKey[T] + class Value[T] + + class Compiled[T](val settings: Seq[Pair[T]]) + + case class Pair[T](k: ScopedKey[T], v: ScopedKey[T]) + + def transform[T](x: T) = x + + def test(compiledSettings: Seq[Compiled[_]]) = { + compiledSettings flatMap { cs => // cd: Compiled[_] in both versions + (cs.settings map { s => // cs.settings: Seq[Compiled[$1]] in trunk, Seq[Compiled[$1]] forSome $1 in 2.9.1 + // s: Pair[$1] in trunk, Pair[$1] in 2.9.1 + val t = transform(s.v) // t: ScopedKey[_] in trunk, ScopedKey[$1] in 2.9.1 + foo(s.k, t) + t + }) : Seq[ScopedKey[_]] + } + } + + def foo[T](x: ScopedKey[T], v: ScopedKey[T]) {} +} diff --git a/test/files/run/Predef.readLine.check b/test/files/run/Predef.readLine.check new file mode 100644 index 0000000000..4fb2bc4c6a --- /dev/null +++ b/test/files/run/Predef.readLine.check @@ -0,0 +1,3 @@ +prompt +fancy prompt +immensely fancy prompt
\ No newline at end of file diff --git a/test/files/run/Predef.readLine.scala b/test/files/run/Predef.readLine.scala new file mode 100644 index 0000000000..9f07936638 --- /dev/null +++ b/test/files/run/Predef.readLine.scala @@ -0,0 +1,10 @@ +import java.io.StringReader + +object Test extends App { + Console.withIn(new StringReader("")) { + readLine() + readLine("prompt\n") + readLine("%s prompt\n", "fancy") + readLine("%s %s prompt\n", "immensely", "fancy") + } +}
\ No newline at end of file diff --git a/test/files/run/si5262.check b/test/files/run/si5262.check new file mode 100644 index 0000000000..4c7a875de5 --- /dev/null +++ b/test/files/run/si5262.check @@ -0,0 +1,2 @@ +List(1, 2, 3, 4) +List(1, 2, null, 4)
\ No newline at end of file diff --git a/test/files/run/si5262.scala b/test/files/run/si5262.scala new file mode 100644 index 0000000000..fc4e57aa96 --- /dev/null +++ b/test/files/run/si5262.scala @@ -0,0 +1,26 @@ + + + + + + + +object Test { + + def serializationDeserialization(obj : Any) { + val bos = new java.io.ByteArrayOutputStream() + val out = new java.io.ObjectOutputStream(bos) + out.writeObject(obj) + + val arr = bos.toByteArray() + val in = new java.io.ObjectInputStream(new java.io.ByteArrayInputStream(arr)) + val o = in.readObject() + println(o) + } + + def main(args : Array[String]) { + serializationDeserialization(List(1,2,3,4)) + serializationDeserialization(List(1,2,null,4)) + } + +} diff --git a/test/files/run/si5374.check b/test/files/run/si5374.check new file mode 100644 index 0000000000..cdf0bc7e5b --- /dev/null +++ b/test/files/run/si5374.check @@ -0,0 +1,3 @@ +ListBuffer(1, 2, 3, 1) +ListBuffer(1, 2, 3, 1) +ListBuffer()
\ No newline at end of file diff --git a/test/files/run/si5374.scala b/test/files/run/si5374.scala new file mode 100644 index 0000000000..a5678c3a81 --- /dev/null +++ b/test/files/run/si5374.scala @@ -0,0 +1,42 @@ + + + +import collection.mutable.ListBuffer +import java.io._ + + + +object Test { + + def main(args: Array[String]) { + ticketExample() + emptyListBuffer() + } + + def ticketExample() { + val baos = new ByteArrayOutputStream + val oos = new ObjectOutputStream(baos) + oos.writeObject( ListBuffer(1,2,3) ) + val bais = new ByteArrayInputStream( baos.toByteArray ) + val ois = new ObjectInputStream(bais) + val lb = ois.readObject.asInstanceOf[ListBuffer[Int]] + val lb2 = ListBuffer[Int]() ++= lb + + lb2 ++= List(1) + lb ++= List(1) + println(lb) + println(lb2) + } + + def emptyListBuffer() { + val baos = new ByteArrayOutputStream + val oos = new ObjectOutputStream(baos) + oos.writeObject( ListBuffer() ) + val bais = new ByteArrayInputStream( baos.toByteArray ) + val ois = new ObjectInputStream(bais) + val lb = ois.readObject.asInstanceOf[ListBuffer[Int]] + + println(lb) + } + +} diff --git a/test/files/run/t4835.check b/test/files/run/t4835.check new file mode 100644 index 0000000000..531c3d7bb6 --- /dev/null +++ b/test/files/run/t4835.check @@ -0,0 +1,7 @@ +-1 0 1 2 3 4 5 6 7 8 9
+-1 1 3 5 7 9 11 13 15 17 19
+1 1
+2 1 2
+2 1 A 2
+3 1 2 3
+3 1 A 2 B 3
diff --git a/test/files/run/t4835.scala b/test/files/run/t4835.scala new file mode 100644 index 0000000000..50d161be40 --- /dev/null +++ b/test/files/run/t4835.scala @@ -0,0 +1,38 @@ +/*
+ * Test case for SI-4835. This tests confirm that the fix
+ * doesn't break laziness. To test memory consumption,
+ * I need to confirm that OutOfMemoryError doesn't occur.
+ * I could create such tests. However, such tests consume
+ * too much time and memory.
+ */
+object Test {
+ private final val INFINITE = -1
+ def testStreamIterator(num: Int, stream: Stream[Int]): Unit = {
+ val iter = stream.iterator
+ print(num)
+ // if num == -1, then steram is infinite sequence
+ if (num == INFINITE) {
+ for(i <- 0 until 10) {
+ print(" " + iter.next())
+ }
+ } else {
+ while(iter.hasNext) {
+ print(" " + iter.next())
+ }
+ }
+ println()
+ }
+
+ def main(args: Array[String]): Unit = {
+ import Stream.{from, cons, empty}
+ testStreamIterator(INFINITE, from(0))
+ testStreamIterator(INFINITE, from(0).filter(_ % 2 == 1))
+ testStreamIterator(1, Stream(1))
+ testStreamIterator(2, Stream(1, 2))
+ //Stream with side effect
+ testStreamIterator(2, cons(1, cons({ print(" A"); 2}, empty)))
+ testStreamIterator(3, Stream(1, 2, 3))
+ //Stream with side effect
+ testStreamIterator(3, cons(1, cons({ print(" A"); 2}, cons({ print(" B"); 3}, Stream.empty))))
+ }
+}
diff --git a/test/files/run/t5072.check b/test/files/run/t5072.check new file mode 100644 index 0000000000..8fe75f55d6 --- /dev/null +++ b/test/files/run/t5072.check @@ -0,0 +1,14 @@ +Type in expressions to have them evaluated. +Type :help for more information. + +scala> + +scala> class C +defined class C + +scala> Thread.currentThread.getContextClassLoader.loadClass(classOf[C].getName) +res0: Class[_] = class C + +scala> + +scala> diff --git a/test/files/run/t5072.scala b/test/files/run/t5072.scala new file mode 100644 index 0000000000..eef8604ef1 --- /dev/null +++ b/test/files/run/t5072.scala @@ -0,0 +1,8 @@ +import scala.tools.partest.ReplTest + +object Test extends ReplTest { + def code = """ +class C +Thread.currentThread.getContextClassLoader.loadClass(classOf[C].getName) + """ +} diff --git a/test/files/run/trait-renaming.check b/test/files/run/trait-renaming.check new file mode 100644 index 0000000000..b2e5affde5 --- /dev/null +++ b/test/files/run/trait-renaming.check @@ -0,0 +1,2 @@ +public static int bippy.A$B$1$class.f(bippy.A$B$1) +public static void bippy.A$B$1$class.$init$(bippy.A$B$1) diff --git a/test/files/run/trait-renaming/A_1.scala b/test/files/run/trait-renaming/A_1.scala new file mode 100644 index 0000000000..2c3d4f566f --- /dev/null +++ b/test/files/run/trait-renaming/A_1.scala @@ -0,0 +1,15 @@ +package bippy { + class A { + def f = { + trait B { + def f = 5 + } + trait C { + def g = 10 + } + new B with C { } + } + + def g = Class.forName("bippy.A$B$1$class") + } +} diff --git a/test/files/run/trait-renaming/B_2.scala b/test/files/run/trait-renaming/B_2.scala new file mode 100644 index 0000000000..174e929fe2 --- /dev/null +++ b/test/files/run/trait-renaming/B_2.scala @@ -0,0 +1,5 @@ +object Test { + def main(args: Array[String]): Unit = { + (new bippy.A).g.getDeclaredMethods.map(_.toString).sorted foreach println + } +} |