summaryrefslogtreecommitdiff
path: root/test/files/run
diff options
context:
space:
mode:
Diffstat (limited to 'test/files/run')
-rw-r--r--test/files/run/nonlocalreturn.check1
-rw-r--r--test/files/run/nonlocalreturn.scala15
-rw-r--r--test/files/run/t5514.check19
-rw-r--r--test/files/run/t5514.scala35
-rw-r--r--test/files/run/t5577.check11
-rw-r--r--test/files/run/t5577.scala27
-rw-r--r--test/files/run/t5590.check4
-rw-r--r--test/files/run/t5590.scala31
-rw-r--r--test/files/run/t5612.check4
-rw-r--r--test/files/run/t5612.scala28
-rw-r--r--test/files/run/t5656.check1
-rw-r--r--test/files/run/t5656.scala11
12 files changed, 187 insertions, 0 deletions
diff --git a/test/files/run/nonlocalreturn.check b/test/files/run/nonlocalreturn.check
new file mode 100644
index 0000000000..aeb2d5e239
--- /dev/null
+++ b/test/files/run/nonlocalreturn.check
@@ -0,0 +1 @@
+Some(1)
diff --git a/test/files/run/nonlocalreturn.scala b/test/files/run/nonlocalreturn.scala
new file mode 100644
index 0000000000..3c1e7420ed
--- /dev/null
+++ b/test/files/run/nonlocalreturn.scala
@@ -0,0 +1,15 @@
+object Test {
+ def wrap[K](body: => K): K = body
+
+ def f(): Option[Int] = {
+ wrap({ return Some(1) ; None })
+ }
+
+ def main(args: Array[String]) {
+ println(f())
+ }
+}
+// java.lang.ClassCastException: scala.Some cannot be cast to scala.None$
+// at Test$$anonfun$f$1.apply(nonlocalreturn.scala:5)
+// at Test$$anonfun$f$1.apply(nonlocalreturn.scala:5)
+// at Test$.wrap(nonlocalreturn.scala:2)
diff --git a/test/files/run/t5514.check b/test/files/run/t5514.check
new file mode 100644
index 0000000000..c68f7c9029
--- /dev/null
+++ b/test/files/run/t5514.check
@@ -0,0 +1,19 @@
+constructed reader: 10
+constructed reader: 9
+constructed reader: 8
+constructed reader: 7
+constructed reader: 6
+constructed reader: 5
+constructed reader: 4
+constructed reader: 3
+constructed reader: 2
+constructed reader: 1
+constructed reader: 0
+[0.0] parsed: List(s10, s9, s8, s7, s6, s5, s4, s3, s2, s1)
+constructed reader: 10
+constructed reader: 9
+constructed reader: 8
+constructed reader: 7
+constructed reader: 6
+constructed reader: 5
+[0.0] parsed: List(s10, s9, s8, s7, s6) \ No newline at end of file
diff --git a/test/files/run/t5514.scala b/test/files/run/t5514.scala
new file mode 100644
index 0000000000..efd5ba6cb9
--- /dev/null
+++ b/test/files/run/t5514.scala
@@ -0,0 +1,35 @@
+
+
+
+import scala.io.Source
+import scala.util.parsing.combinator.Parsers
+import scala.util.parsing.input.Reader
+import scala.util.parsing.input.Position
+
+
+
+class DemoReader(n: Int) extends Reader[String] {
+ def atEnd = n == 0
+ def first = if (n >= 0) "s" + n else throw new IllegalArgumentException("No more input.")
+ def rest = new DemoReader(n - 1)
+ def pos = new Position {
+ def line = 0
+ def column = 0
+ def lineContents = first
+ }
+ println("constructed reader: " + n)
+}
+
+
+object Test extends App with Parsers {
+ type Elem = String
+ def startsWith(prefix: String) = acceptIf(_ startsWith prefix)("Error: " + _)
+
+ val resrep = startsWith("s").*(new DemoReader(10))
+ Console println resrep
+
+ val resrep5 = repN(5, startsWith("s"))(new DemoReader(10))
+ Console println resrep5
+}
+
+
diff --git a/test/files/run/t5577.check b/test/files/run/t5577.check
new file mode 100644
index 0000000000..3eca387955
--- /dev/null
+++ b/test/files/run/t5577.check
@@ -0,0 +1,11 @@
+Received a size hint: 10
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9 \ No newline at end of file
diff --git a/test/files/run/t5577.scala b/test/files/run/t5577.scala
new file mode 100644
index 0000000000..b5d6d8c5b6
--- /dev/null
+++ b/test/files/run/t5577.scala
@@ -0,0 +1,27 @@
+
+
+
+import collection._
+
+
+
+object Test {
+
+ class AlarmingBuffer[T] extends mutable.ArrayBuffer[T] {
+ override def sizeHint(x: Int) {
+ println("Received a size hint: " + x)
+ super.sizeHint(x)
+ }
+ }
+
+ def main(args: Array[String]) {
+ val iteratorBuilder = (new AlarmingBuffer[Int]) mapResult {
+ res => res.iterator
+ }
+
+ iteratorBuilder.sizeHint(10)
+ iteratorBuilder ++= (0 until 10)
+ iteratorBuilder.result.foreach(println)
+ }
+
+}
diff --git a/test/files/run/t5590.check b/test/files/run/t5590.check
new file mode 100644
index 0000000000..ad4a2eee64
--- /dev/null
+++ b/test/files/run/t5590.check
@@ -0,0 +1,4 @@
+Map(a -> a, b -> b, c -> c)
+Map(a -> a, b -> b, c -> c)
+Set(a, b, c, d, e)
+Set(a, b, c, d, e) \ No newline at end of file
diff --git a/test/files/run/t5590.scala b/test/files/run/t5590.scala
new file mode 100644
index 0000000000..9c806e0b7d
--- /dev/null
+++ b/test/files/run/t5590.scala
@@ -0,0 +1,31 @@
+
+
+
+import java.io._
+import collection._
+
+
+
+object Test {
+
+ def check(obj: AnyRef) {
+ println(obj)
+
+ val bos = new ByteArrayOutputStream()
+ val out = new ObjectOutputStream(bos)
+ out.writeObject(obj)
+ val arr = bos.toByteArray()
+ val in = new ObjectInputStream(new ByteArrayInputStream(arr))
+ val deser = in.readObject()
+
+ println(deser)
+ }
+
+ def main(args: Array[String]) {
+ val lhm = mutable.LinkedHashMap("a" -> "a", "b" -> "b", "c" -> "c")
+ val lhs = mutable.LinkedHashSet("a", "b", "c", "d", "e")
+ check(lhm)
+ check(lhs)
+ }
+
+}
diff --git a/test/files/run/t5612.check b/test/files/run/t5612.check
new file mode 100644
index 0000000000..9d19cca292
--- /dev/null
+++ b/test/files/run/t5612.check
@@ -0,0 +1,4 @@
+START for List(Two, Two, One, Three)
+TWO
+TWO
+ONE
diff --git a/test/files/run/t5612.scala b/test/files/run/t5612.scala
new file mode 100644
index 0000000000..48b3093548
--- /dev/null
+++ b/test/files/run/t5612.scala
@@ -0,0 +1,28 @@
+object L extends Enumeration {
+ val One, Two, Three = Value
+}
+
+class Foo {
+ def foo(xs: List[L.Value]) {
+ import scala.util.control.Breaks.{break, breakable}
+ println("START for " + xs)
+ breakable {
+ for (x <- xs) {
+ x match {
+ case L.One => println("ONE"); return
+ case L.Two => println("TWO")
+ case L.Three => println("THREE"); break
+ }
+ }
+ }
+ println("FINISH")
+ }
+}
+
+object Test {
+ def main(args: Array[String]) {
+ val f = new Foo()
+ val l = List(L.Two, L.Two, L.One, L.Three)
+ f.foo(l)
+ }
+}
diff --git a/test/files/run/t5656.check b/test/files/run/t5656.check
new file mode 100644
index 0000000000..9543ee799e
--- /dev/null
+++ b/test/files/run/t5656.check
@@ -0,0 +1 @@
+List(1, 2, 3)_List(a, b, c) \ No newline at end of file
diff --git a/test/files/run/t5656.scala b/test/files/run/t5656.scala
new file mode 100644
index 0000000000..f5ea147a4e
--- /dev/null
+++ b/test/files/run/t5656.scala
@@ -0,0 +1,11 @@
+
+
+
+
+object Test {
+
+ def main(args: Array[String]) {
+ println(Seq(List('1', '2', '3'), List('a', 'b', 'c')).view.addString(new StringBuilder, "_"))
+ }
+
+}