diff options
Diffstat (limited to 'test/files/run')
25 files changed, 28 insertions, 788 deletions
diff --git a/test/files/run/bitsets.check b/test/files/run/bitsets.check deleted file mode 100644 index 01bd685eeb..0000000000 --- a/test/files/run/bitsets.check +++ /dev/null @@ -1,33 +0,0 @@ -ms0 = Set(2) -ms1 = Set(2) -ms2 = Set(2) -mb0 = false -mb1 = true -mb2 = false -xs0 = List(2) -xs1 = List(2) -xs2 = List(2) -ma0 = List(4) -ma1 = List(4) -ma2 = List(4) -mi0 = Set(2) -mi1 = Set(2) -mi2 = Set(2) - -is0 = Set() -is1 = Set() -is2 = Set(2) -is3 = Set() -ib0 = false -ib1 = false -ib2 = true -ib3 = false -ys0 = List() -ys1 = List() -ys2 = List(2) -ys3 = List() -ia0 = List(0) -ia1 = List(0) -ia2 = List(4) -ia3 = List() - diff --git a/test/files/run/bitsets.scala b/test/files/run/bitsets.scala deleted file mode 100644 index 469dac31ee..0000000000 --- a/test/files/run/bitsets.scala +++ /dev/null @@ -1,78 +0,0 @@ -//############################################################################ -// Bitsets -//############################################################################ -// $Id$ - -//############################################################################ - -object TestMutable { - import scala.collection.mutable.BitSet - - val ms0 = new BitSet - val ms1 = new BitSet(8) - val ms2 = new BitSet(0) - ms0 += 2 - ms1 ++= List(1, 2) - ms1 -= 1 - ms1 --= List(1) - ms2(2) = true - ms2(3) = false - - Console.println("ms0 = " + ms0) - Console.println("ms1 = " + ms1) - Console.println("ms2 = " + ms2) - - Console.println("mb0 = " + ms0.contains(-1)) - Console.println("mb1 = " + ms1.contains(2)) - Console.println("mb2 = " + ms2.contains(3)) - - Console.println("xs0 = " + ms0.elements.toList) - Console.println("xs1 = " + ms1.elements.toList) - Console.println("xs2 = " + ms2.elements.toList) - - Console.println("ma0 = " + ms0.underlying.toList) - Console.println("ma1 = " + ms1.underlying.toList) - Console.println("ma2 = " + ms2.underlying.toList) - - Console.println("mi0 = " + ms0.toImmutable) - Console.println("mi1 = " + ms1.toImmutable) - Console.println("mi2 = " + ms2.toImmutable) - Console.println -} - -object TestImmutable { - import scala.collection.immutable.BitSet - - val is0 = new BitSet(8, 1, null, false) - val is1 = new BitSet(8, 1, Array(), false) - val is2 = new BitSet(8, 8, Array(4), false) - val is3 = new BitSet(0, 0, null, false) - - Console.println("is0 = " + is0) - Console.println("is1 = " + is1) - Console.println("is2 = " + is2) - Console.println("is3 = " + is3) - - Console.println("ib0 = " + is0.contains(-1)) - Console.println("ib1 = " + is1.contains(0)) - Console.println("ib2 = " + is2.contains(2)) - Console.println("ib3 = " + is3.contains(2)) - - Console.println("ys0 = " + is0.elements.toList) - Console.println("ys1 = " + is1.elements.toList) - Console.println("ys2 = " + is2.elements.toList) - Console.println("ys3 = " + is3.elements.toList) - - Console.println("ia0 = " + is0.underlying.toList) - Console.println("ia1 = " + is1.underlying.toList) - Console.println("ia2 = " + is2.underlying.toList) - Console.println("ia3 = " + is3.underlying.toList) - Console.println -} - -object Test extends Application { - TestMutable - TestImmutable -} - -//############################################################################ diff --git a/test/files/run/bug1074.check b/test/files/run/bug1074.check index 7dc074205c..ecff8510ed 100644 --- a/test/files/run/bug1074.check +++ b/test/files/run/bug1074.check @@ -1,3 +1,3 @@ -q0 = Set(kl, jk, fg, ef, gh, a, cd, de, hj, b, lm, mn) +q0 = Set(kl, jk, cd, fg, a, ef, gh, de, hj, b, lm, mn) q1 = Set() 0 q2 = Set() 0 diff --git a/test/files/run/classof.check b/test/files/run/classof.check index af7082f5b8..0d650b87c0 100644 --- a/test/files/run/classof.check +++ b/test/files/run/classof.check @@ -10,13 +10,13 @@ float double Class types class SomeClass -class scala.List +class scala.collection.immutable.List class scala.Tuple2 Arrays: class [Lscala.runtime.BoxedUnit; class [I class [D -class [Lscala.List; +class [Lscala.collection.immutable.List; Functions: interface scala.Function2 interface scala.Function1 diff --git a/test/files/run/collection-stacks.check b/test/files/run/collection-stacks.check deleted file mode 100644 index fcb39c460c..0000000000 --- a/test/files/run/collection-stacks.check +++ /dev/null @@ -1,14 +0,0 @@ -1-2-3: true -1-2-3: true -apply -1: true -1: true -3: true -3: true -top -3: true -3: true -pop -1-2: true -3: true -1-2: true diff --git a/test/files/run/collection-stacks.scala b/test/files/run/collection-stacks.scala deleted file mode 100644 index ec557cb91d..0000000000 --- a/test/files/run/collection-stacks.scala +++ /dev/null @@ -1,38 +0,0 @@ -import scala.collection._ - -object Test extends Application { - def mutableStack[T](xs: T*): mutable.Stack[T] = { - val s = new mutable.Stack[T] - s.push(xs: _*) - s - } - - def immutableStack[T](xs: T*): immutable.Stack[T] = { - immutable.Stack.Empty push xs - } - - def check[T](expected: T, got: T) { - println(got + ": " + (expected == got)) - } - - // check #957 - check("1-2-3", immutableStack(1, 2, 3).elements.mkString("-")) - check("1-2-3", mutableStack(1, 2, 3).elements.mkString("-")) - - println("apply") - check(1, immutableStack(1, 2, 3).apply(0)) - check(1, mutableStack(1, 2, 3).apply(0)) - check(3, immutableStack(1, 2, 3).apply(2)) - check(3, mutableStack(1, 2, 3).apply(2)) - - println("top") - check(3, immutableStack(1, 2, 3).top) - check(3, mutableStack(1, 2, 3).top) - - println("pop") - check("1-2", immutableStack(1, 2, 3).pop.mkString("-")) - check(3, mutableStack(1, 2, 3).pop()) - check("1-2", { val s = mutableStack(1, 2, 3); s.pop(); s.toList.mkString("-") }) -} - -// vim: set ts=2 sw=2 et: diff --git a/test/files/run/collections.check b/test/files/run/collections.check index 0442e48702..b87a5998c5 100644 --- a/test/files/run/collections.check +++ b/test/files/run/collections.check @@ -32,7 +32,3 @@ test4: 25005003 test1: 14005 test2: 9007003, iters = 3000 test3: 9007003 -***** immutable.UnBalancedTreeMap: -test1: 14005 -test2: 1013003, iters = 1000 -test3: 1013003 diff --git a/test/files/run/collections.scala b/test/files/run/collections.scala index 7c723c9fc7..f286123322 100644 --- a/test/files/run/collections.scala +++ b/test/files/run/collections.scala @@ -113,5 +113,4 @@ object Test extends Application { test("immutable.Map", immutable.Map[Int, Int](), 5000) test("immutable.TreeMap", new immutable.TreeMap[Int, Int], 5000) test("immutable.ListMap", new immutable.ListMap[Int, Int], 3000) - test("immutable.UnBalancedTreeMap", new immutable.UnbalancedTreeMap[Int, Int], 1000) } diff --git a/test/files/run/colltest.scala b/test/files/run/colltest.scala index 65c3676297..5809812838 100644 --- a/test/files/run/colltest.scala +++ b/test/files/run/colltest.scala @@ -46,5 +46,5 @@ class TestSet(s0: Set[Int], s1: Set[Int]) { Console.println("succeeded for "+Iterations+" iterations.") } object Test extends Application { - new TestSet(HashSet.empty, new scala.collection.jcl.LinkedHashSet) + new TestSet(HashSet.empty, new scala.collection.mutable.LinkedHashSet) } diff --git a/test/files/run/constrained-types.scala b/test/files/run/constrained-types.scala index b640db1d67..56fbd749c0 100644 --- a/test/files/run/constrained-types.scala +++ b/test/files/run/constrained-types.scala @@ -89,6 +89,7 @@ object Test { val settings = new Settings settings.Xexperimental.value = true settings.selfInAnnots.value = true + settings.deprecation.value = true val interp = new Interpreter(settings) diff --git a/test/files/run/deeps.check b/test/files/run/deeps.check deleted file mode 100644 index f1925fcbc1..0000000000 --- a/test/files/run/deeps.check +++ /dev/null @@ -1,83 +0,0 @@ -false -false -true - -false -false -true - -x=Array(1) -y=Array(1) -false -false -true - -x=Array(Array(1), Array(1)) -y=Array(Array(1), Array(1)) -false -false -true - -x=Array(Array(Array(1), Array(1)), Array(Array(1), Array(1))) -y=Array(Array(Array(1), Array(1)), Array(Array(1), Array(1))) -false -false -true - -false -false -true -false -false -true -Array(true, false) -Array(true, false) -[true;false] -true;false - -Array([Z@0000000, [Z@0000000) -Array(Array(true, false), Array(true, false)) -[[true;false];[true;false]] -true;false;true;false - -Array([[Z@0000000, [[Z@0000000) -Array(Array(Array(true, false), Array(true, false)), Array(Array(true, false), Array(true, false))) -[[[true;false];[true;false]];[[true;false];[true;false]]] -true;false;true;false;true;false;true;false - -Array(1.0, 0.0) -Array(1.0, 0.0) -[1.0;0.0] -1.0;0.0 - -Array([D@0000000, [D@0000000) -Array(Array(1.0, 0.0), Array(1.0, 0.0)) -[[1.0;0.0];[1.0;0.0]] -1.0;0.0;1.0;0.0 - -Array([[D@0000000, [[D@0000000) -Array(Array(Array(1.0, 0.0), Array(1.0, 0.0)), Array(Array(1.0, 0.0), Array(1.0, 0.0))) -[[[1.0;0.0];[1.0;0.0]];[[1.0;0.0];[1.0;0.0]]] -1.0;0.0;1.0;0.0;1.0;0.0;1.0;0.0 - -Array(a, b) -Array(a, b) -[a;b] -a;b - -Array([Ljava.lang.String;@0000000, [Ljava.lang.String;@0000000) -Array(Array(a, b), Array(a, b)) -[[a;b];[a;b]] -a;b;a;b - -Array([[Ljava.lang.String;@0000000, [[Ljava.lang.String;@0000000) -Array(Array(Array(a, b), Array(a, b)), Array(Array(a, b), Array(a, b))) -[[[a;b];[a;b]];[[a;b];[a;b]]] -a;b;a;b;a;b;a;b - -[[true; false]; [false]] -[[1; 2]; [3]] -[[1; 2]; [3]] - -Array(boo, and, foo) -Array(a) diff --git a/test/files/run/deeps.scala b/test/files/run/deeps.scala deleted file mode 100644 index e592c4ea25..0000000000 --- a/test/files/run/deeps.scala +++ /dev/null @@ -1,112 +0,0 @@ -//############################################################################ -// deepEquals / deepToString -//############################################################################ -// $Id: $ - -//############################################################################ - -object Test extends Application { - - def testEquals1 { - println(Array(1) == Array(1)) - println(Array(1) equals Array(1)) - println(Array(1) deepEquals Array(1)) - println - } - - def testEquals2 { - println(Array(Array(1), Array(2)) == Array(Array(1), Array(2))) - println(Array(Array(1), Array(2)) equals Array(Array(1), Array(2))) - println(Array(Array(1), Array(2)) deepEquals Array(Array(1), Array(2))) - println - } - - def testEquals3 { - val a1 = Array(1) - val b1 = Array(1) - val a2 = Array(a1, b1) - val b2 = Array(a1, b1) - val a3 = Array(a2, b2) - val b3 = Array(a2, b2) - def test[T](x: Array[T], y: Array[T]) { - println("x=" + x.deepToString) - println("y=" + y.deepToString) - println(x == y) - println(x equals y) - println(x deepEquals y) - println - } - test(a1, b1) - test(a2, b2) - test(a3, b3) - } - - def testEquals4 { - println("boo:and:foo".split(':') == "boo:and:foo".split(':')) - println("boo:and:foo".split(':') equals "boo:and:foo".split(':')) - println("boo:and:foo".split(':') deepEquals "boo:and:foo".split(':')) - - val xs = new java.util.ArrayList[String](); xs.add("a") - val ys = new java.util.ArrayList[String](); ys.add("a") - println(xs.toArray == ys.toArray) - println(xs.toArray equals ys.toArray) - println(xs.toArray deepEquals ys.toArray) - } - - def testToString1 { - def sweep(s: String) = - s.replaceAll("D@[0-9a-fA-F]+", "D@0000000") - .replaceAll("Z@[0-9a-fA-F]+", "Z@0000000") - .replaceAll(";@[0-9a-fA-F]+", ";@0000000") - def test[T](a: Array[T]) { - println(sweep(a.toString)) - println(a.deepToString) - println(a.deepMkString("[", ";", "]")) - println(a.deepMkString(";")) - println - } - - val ba1 = Array(true, false) - val ba2 = Array(ba1, ba1) - val ba3 = Array(ba2, ba2) - test(ba1) - test(ba2) - test(ba3) - - val da1 = Array(1.0d, 0.0d) - val da2 = Array(da1, da1) - val da3 = Array(da2, da2) - test(da1) - test(da2) - test(da3) - - val sa1 = Array("a", "b") - val sa2 = Array(sa1, sa1) - val sa3 = Array(sa2, sa2) - test(sa1) - test(sa2) - test(sa3) - } - - def testToString2 { - println(Array(Array(true, false), Array(false)).deepMkString("[", "; ", "]")) - println(Array(Array('1', '2'), Array('3')).deepMkString("[", "; ", "]")) - println(Array(Array(1, 2), Array(3)).deepMkString("[", "; ", "]")) - println - } - - def testToString3 { - println("boo:and:foo".split(':').deepToString) - - val xs = new java.util.ArrayList[String](); xs.add("a") - println(xs.toArray.deepToString) - } - - testEquals1 - testEquals2 - testEquals3 - testEquals4 - testToString1 - testToString2 - testToString3 -} diff --git a/test/files/run/forvaleq.check b/test/files/run/forvaleq.check deleted file mode 100644 index ec57719cb4..0000000000 --- a/test/files/run/forvaleq.check +++ /dev/null @@ -1,5 +0,0 @@ -List(2, 6, 10, 14, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38) -List(2, 6, 10, 14, 18, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2) -List(2, 6, 10, 14, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38) -List(2, 6, 10, 14, 18, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2) -called 20 times diff --git a/test/files/run/forvaleq.scala b/test/files/run/forvaleq.scala deleted file mode 100644 index 1e4fd33dbc..0000000000 --- a/test/files/run/forvaleq.scala +++ /dev/null @@ -1,92 +0,0 @@ -// test "foo = expr" clauses in for comprehensions -// $Id$ - -import scala.collection.immutable.Queue -import scala.{List=>L} - -object Test { - // redefine some symbols to make it extra hard - class List - class Tuple2 - def List[A](as: A*) = 5 - - def firstDigit(x: Int): Int = - x match { - case 0 => 0 - case _ if (x<0) => firstDigit(-x) - case _ if (x<10) => x - case _ => firstDigit(x / 10) - } - - - { - // a basic test case - - val input = L.range(0,20) - val oddFirstTimesTwo = - for {x <- input - xf = firstDigit(x) - if xf % 2 == 1} - yield x*2 - println(oddFirstTimesTwo) - } - - { - // a test case with patterns - - val input = L.range(0, 20) - val oddFirstTimesTwo = - for {x <- input - xf = firstDigit(x) - yf = x - firstDigit(x) / 10 - (a, b) = (xf - yf, xf + yf) - if xf % 2 == 1} - yield a + b - println(oddFirstTimesTwo) - } - - { - // make sure it works on non-Ls - - // val input: Queue = Queue.Empty[int].incl(L.range(0,20)) - val input = L.range(0, 20).elements - val oddFirstTimesTwo = - for {x <- input - xf = firstDigit(x) - if xf % 2 == 1} - yield x*2 - println(oddFirstTimesTwo.toList) - } - - { - // yield the computed value - - val input = L.range(0,20) - val oddFirstTimesTwo = - for {x <- input - xf = firstDigit(x) - if xf % 2 == 1} - yield xf*2 - println(oddFirstTimesTwo) - } - - { - // make sure the function is only called once - var count: Int = 0 - - def fdct(x: Int) = { - count += 1 - firstDigit(x) - } - - val input = L.range(0,20) - for {x <- input - xf = fdct(x) - if xf % 2 == 1} - yield xf - - println("called " + count + " times") - } - - def main(args: Array[String]) {} -} diff --git a/test/files/run/infiniteloop.check b/test/files/run/infiniteloop.check index be0b1437f1..6f8cf6e4d9 100644 --- a/test/files/run/infiniteloop.check +++ b/test/files/run/infiniteloop.check @@ -1 +1 @@ -Stream(512, ?) +Stream(512, 256, 128, 64, 32, 16, 8, 4, 2, 1) diff --git a/test/files/run/iq.check b/test/files/run/iq.check deleted file mode 100644 index 81114ea181..0000000000 --- a/test/files/run/iq.check +++ /dev/null @@ -1,12 +0,0 @@ -Empty -Head: 42 -q5: Queue(0, 1, 2, 3, 4, 5, 6, 7, 8, 9) -q5[5]: 5 -q5 == q5c: true -q5c == q5: true -q8: Queue(2, 3, 4, 5, 6, 7, 8, 9, 10, 11) -q8 == q9: true -Elements: 1 2 3 4 5 6 7 8 9 -String: <1-2-3-4-5-6-7-8-9> -Length: 9 -Front: 1 diff --git a/test/files/run/iq.scala b/test/files/run/iq.scala deleted file mode 100644 index 8ae3dbb080..0000000000 --- a/test/files/run/iq.scala +++ /dev/null @@ -1,100 +0,0 @@ -/* $Id$ - * Test file for immutable queues. - */ - -import scala.collection.immutable.Queue - -object iq { - def main { - /* Create an empty queue. */ - val q: Queue[Int] = Queue.Empty - - /* Test isEmpty. - * Expected: Empty - */ - if (q.isEmpty) { - Console.println("Empty") - } - - /* Test infix enqueing. */ - //val q2 = q + 42 + 0 // deprecated - val q2 = q.enqueue(42).enqueue(0) - - /* Test is empty and dequeue. - * Expected: Head: 42 - */ - val q4 = - if (q2.isEmpty) { - Console.println("Empty") - q2 - } - else { - val (head, q3) = q2.dequeue - Console.println("Head: " + head) - q3 - } - - /* Test sequence enqueing. */ - val q5: Queue[Any] = q4.enqueue(List(1,2,3,4,5,6,7,8,9)) - /* Test toString. - * Expected: Head: q5: Queue(0,1,2,3,4,5,6,7,8,9) - */ - Console.println("q5: " + q5) - /* Test apply - * Expected: q5[5]: 5 - */ - Console.println("q5[5]: " + q5(5)) - - val q5c: Queue[Int] = Queue.Empty.enqueue(List(0, 1, 2, 3, 4, 5, 6, 7, 8, 9)) - - /* Testing == - * Expected: q5 == q9: true - * q9 == q5: true - */ - Console.println("q5 == q5c: " + (q5 == q5c)) - Console.println("q5c == q5: " + (q5c == q5)) - - val (_, q6) = q5.dequeue - val (_, q7) = q6.dequeue - //val q8 = q7 + 10 + 11 //deprecated - val q8 = q7.enqueue(10).enqueue(11) - /* Test dequeu - * Expected: q8: Queue(2,3,4,5,6,7,8,9,10,11) - */ - Console.println("q8: " + q8) - val q9 = new Queue(2,3,4,5,6,7,8,9,10,11) - - /* Testing == - * Expected: q8 == q9: true - */ - Console.println("q8 == q9: " + (q8 == q9)) - - /* Testing elements - * Expected: Elements: 1 2 3 4 5 6 7 8 9 - */ - Console.print("Elements: "); - q6.elements.foreach(e => Console.print(" "+ e + " ")) - Console.println; - - /* Testing mkString - * Expected: String: <1-2-3-4-5-6-7-8-9> - */ - Console.println("String: " + q6.mkString("<","-",">")) - - /* Testing length - * Expected: Length: 9 - */ - Console.println("Length: " + q6.length) - - /* Testing front - * Expected: Front: 1 - */ - Console.println("Front: " + q6.front); - } -} - -object Test { - def main(args: Array[String]) { - iq.main - } -} diff --git a/test/files/run/patmatnew.scala b/test/files/run/patmatnew.scala index 615046bf14..3840b44b86 100644 --- a/test/files/run/patmatnew.scala +++ b/test/files/run/patmatnew.scala @@ -311,7 +311,7 @@ object Test extends TestConsoleMain { object TestStream extends TestCase("unapply for Streams") { def sum(stream: Stream[Int]): Int = stream match { - case Stream.empty => 0 + case Stream.Empty => 0 case Stream.cons(hd, tl) => hd + sum(tl) } diff --git a/test/files/run/range.scala b/test/files/run/range.scala index 5d0ca84c0b..18f3ace645 100644 --- a/test/files/run/range.scala +++ b/test/files/run/range.scala @@ -2,7 +2,7 @@ object Test extends Application{ def rangeForeach(range : Range) = { val buffer = new scala.collection.mutable.ListBuffer[Int]; range.foreach(buffer += _); - assert(buffer.toList == range.elements.toList); + assert(buffer.toList == range.elements.toList, buffer.toList+"/"+range.elements.toList) } rangeForeach(1 to 10); diff --git a/test/files/run/t0485.check b/test/files/run/t0485.check deleted file mode 100644 index 3a462cfdc1..0000000000 --- a/test/files/run/t0485.check +++ /dev/null @@ -1,32 +0,0 @@ -m1={(10,20), (20,30)} -m2={(10,20)} -m1.size > m2.size is true -m1 equals m2 is true - -m1={(10,20), (20,30)} -m2={(10,20)} -m1.size > m2.size is true -m1 equals m2 is true - -m1={(10,20), (20,30)} -m2={(10,20)} -m1.size > m2.size is true -m1 equals m2 is true - -java.lang.CloneNotSupportedException: The underlying map doesn't implement the Cloneable interface - -s1=[10, 20] -s2=[10] -s1.size > s2 is true -s1 equals s2 is true - -s1=[10, 20] -s2=[10] -s1.size > s2 is true -s1 equals s2 is true - -s1=[10, 20] -s2=[10] -s1.size > s2 is true -s1 equals s2 is true - diff --git a/test/files/run/t0485.scala b/test/files/run/t0485.scala deleted file mode 100644 index 9e2017aacc..0000000000 --- a/test/files/run/t0485.scala +++ /dev/null @@ -1,54 +0,0 @@ -import scala.collection.jcl - -object Test extends Application { - testMap - testSet -} - -object testMap { - def toString(m1: collection.Map[Int, Int]): String = - m1.toList.sort((x, y) => x < y).mkString("{", ", ", "}") - def test(m1: jcl.Map[Int, Int]) { - try { - m1.put(10, 20) - val m2 = m1.clone() - m1.put(20, 30) - println("m1="+toString(m1)) - println("m2="+toString(m2)) - println("m1.size > m2.size is "+ (m1.size > m2.size)) - m1.remove((20, 30)) - println("m1 equals m2 is "+ (m1 equals m2)) - println() - } - catch { - case e: Exception => - println(e); println() - } - } - test(new jcl.HashMap[Int, Int]) - // Clone on IdentityHashMap of java-ibm-1.6 behaves differently than all others - // Therefore, for now we will not perform this test on it. - // test(new jcl.IdentityHashMap[Int, Int]) - test(new jcl.LinkedHashMap[Int, Int]) - test(new jcl.TreeMap[Int, Int]) - test(new jcl.WeakHashMap[Int, Int]) -} - -object testSet { - def toString(s1: collection.Set[Int]): String = - s1.toList.sort((x, y) => x < y).mkString("[", ", ", "]") - def test(s1: jcl.Set[Int]) { - s1.add(10) - val s2 = s1.clone() - s1.add(20) - println("s1="+toString(s1)) - println("s2="+toString(s2)) - println("s1.size > s2 is "+ (s1.size > s2.size)) - s1.remove(20) - println("s1 equals s2 is "+ (s1 equals s2)) - println() - } - test(new jcl.HashSet[Int]) - test(new jcl.LinkedHashSet[Int]) - test(new jcl.TreeSet[Int]) -} diff --git a/test/files/run/t1323.scala b/test/files/run/t1323.scala index 7a68482101..d84239a12c 100644 --- a/test/files/run/t1323.scala +++ b/test/files/run/t1323.scala @@ -1,25 +1,25 @@ object Test extends Application { - println(" 1:" + List(1,2,3,4).indexOf(List(0,1))) // -1 - println(" 2:" + List(1,2,3,4).indexOf(List(1,2))) // 0 - println(" 3:" + List(1,2,3,4).indexOf(List(2,3))) // 1 - println(" 4:" + List(1,2,3,4).indexOf(List(3,4))) // 2 - println(" 5:" + List(1,2,3,4).indexOf(List(4,5))) // -1 - println(" 6:" + List(1,2,3,4).indexOf(List(2,4))) // -1 - println(" 7:" + List(1,2,3,4).indexOf(List(4,3))) // -1 - println(" 8:" + List(1,2,3,4).indexOf(List(1,3))) // -1 - println(" 9:" + List(1,2,3,4).indexOf(List(1,3))) // -1 - println("10:" + List(1,2,3,4).indexOf(List(1,2,3,4))) // 0 - println("11:" + List(1,2,3,4).indexOf(List(4,3,2,1))) // -1 - println("12:" + List(1,2,3,4).indexOf(List(1,2,3,4,5))) // -1 - println("13:" + List(1,2,3,4).indexOf(List(5,4,3,2,1))) // -1 - println("14:" + List(1,2,3,4).indexOf(List())) // 0 - println("15:" + List().indexOf(List())) // 0 - println("16:" + List().indexOf(List(1,2,3,4))) // -1 + println(" 1:" + List(1,2,3,4).indexOfSeq(List(0,1))) // -1 + println(" 2:" + List(1,2,3,4).indexOfSeq(List(1,2))) // 0 + println(" 3:" + List(1,2,3,4).indexOfSeq(List(2,3))) // 1 + println(" 4:" + List(1,2,3,4).indexOfSeq(List(3,4))) // 2 + println(" 5:" + List(1,2,3,4).indexOfSeq(List(4,5))) // -1 + println(" 6:" + List(1,2,3,4).indexOfSeq(List(2,4))) // -1 + println(" 7:" + List(1,2,3,4).indexOfSeq(List(4,3))) // -1 + println(" 8:" + List(1,2,3,4).indexOfSeq(List(1,3))) // -1 + println(" 9:" + List(1,2,3,4).indexOfSeq(List(1,3))) // -1 + println("10:" + List(1,2,3,4).indexOfSeq(List(1,2,3,4))) // 0 + println("11:" + List(1,2,3,4).indexOfSeq(List(4,3,2,1))) // -1 + println("12:" + List(1,2,3,4).indexOfSeq(List(1,2,3,4,5))) // -1 + println("13:" + List(1,2,3,4).indexOfSeq(List(5,4,3,2,1))) // -1 + println("14:" + List(1,2,3,4).indexOfSeq(List())) // 0 + println("15:" + List().indexOfSeq(List())) // 0 + println("16:" + List().indexOfSeq(List(1,2,3,4))) // -1 // Do some testing with infinite sequences def from(n: Int): Stream[Int] = Stream.cons(n, from(n + 1)) - println("17:" + List(1,2,3,4).indexOf(from(1))) // -1 - println("18:" + from(1).indexOf(List(4,5,6))) // 3 + println("17:" + List(1,2,3,4).indexOfSeq(from(1))) // -1 + println("18:" + from(1).indexOfSeq(List(4,5,6))) // 3 } diff --git a/test/files/run/unapply.scala b/test/files/run/unapply.scala index 3325d034d3..f540b2a2a9 100644 --- a/test/files/run/unapply.scala +++ b/test/files/run/unapply.scala @@ -107,7 +107,7 @@ object StreamFoo extends TestCase("unapply for Streams") with Assert { def sum(stream: Stream[Int]): Int = stream match { - case Stream.empty => 0 + case Stream.Empty => 0 case Stream.cons(hd, tl) => hd + sum(tl) } override def runTest { diff --git a/test/files/run/unittest_collection.scala b/test/files/run/unittest_collection.scala deleted file mode 100644 index 5d7ab97425..0000000000 --- a/test/files/run/unittest_collection.scala +++ /dev/null @@ -1,103 +0,0 @@ - -object Test { - - import scala.testing.SUnit._ - import scala.collection.mutable.{ArrayBuffer, Buffer, BufferProxy, ListBuffer} - - trait BufferTest extends Assert { - def doTest(x:Buffer[String]) = { - // testing method += - x += "one" - assertEquals("retrieving 'one'", x(0), "one") - assertEquals("length A ", x.length, 1) - x += "two" - assertEquals("retrieving 'two'", x(1), "two") - assertEquals("length B ", x.length, 2) - - // testing method -= (removing last element) - x -= "two" - - assertEquals("length C ", x.length, 1) - - try { x(1); fail("no exception for removed element") } - catch { case i:IndexOutOfBoundsException => } - - try { x.remove(1); fail("no exception for removed element") } - catch { case i:IndexOutOfBoundsException => } - - x += "two2" - assertEquals("length D ", x.length, 2) - - // removing first element - x.remove(0) - assertEquals("length E ", x.length, 1) - - // toList - assertEquals("toList ", x.toList, List("two2")) - - // clear - x.clear - assertEquals("length F ", x.length, 0) - - // copyToBuffer - x += "a" - x += "b" - val dest = new ArrayBuffer[String] - x copyToBuffer dest - assertEquals("dest", List("a", "b"), dest.toList) - assertEquals("source", List("a", "b"), x.toList) - } - } - - class TArrayBuffer extends TestCase("collection.mutable.ArrayBuffer") with Assert with BufferTest { - - var x: ArrayBuffer[String] = _ - - override def runTest = { setUp; doTest(x); tearDown } - - override def setUp = { x = new scala.collection.mutable.ArrayBuffer } - - override def tearDown = { x.clear; x = null } - } - - class TListBuffer extends TestCase("collection.mutable.ListBuffer") with Assert with BufferTest { - - var x: ListBuffer[String] = _ - - override def runTest = { setUp; doTest(x); tearDown } - - override def setUp = { x = new scala.collection.mutable.ListBuffer } - - override def tearDown = { x.clear; x = null } - - } - - class TBufferProxy extends TestCase("collection.mutable.BufferProxy") with Assert with BufferTest { - - class BBuf(z:ListBuffer[String]) extends BufferProxy[String] { - def self = z - } - - var x: BufferProxy[String] = _ - - override def runTest = { setUp; doTest(x); tearDown } - - override def setUp = { x = new BBuf(new scala.collection.mutable.ListBuffer) } - - override def tearDown = { x.clear; x = null } - - } - - def main(args:Array[String]) = { - val ts = new TestSuite( - //new TArrayBuffer, - new TListBuffer//, - //new TBufferProxy - ) - val tr = new TestResult() - ts.run(tr) - for(val failure <- tr.failures) { - Console.println(failure) - } - } -} diff --git a/test/files/run/withIndex.scala b/test/files/run/withIndex.scala index 6d470878d9..f0c3e7a468 100644 --- a/test/files/run/withIndex.scala +++ b/test/files/run/withIndex.scala @@ -19,7 +19,7 @@ object Test { val emptyArray = new Array[String](0) val emptyList: List[String] = Nil val emptyIterator = emptyList.elements - val emptyStream = Stream.empty + val emptyStream: Stream[String] = Stream.empty Console.println(emptyArray.zipWithIndex.toList) Console.println(emptyList.zipWithIndex.toList) |