summaryrefslogtreecommitdiff
path: root/test/files
diff options
context:
space:
mode:
authormihaylov <mihaylov@epfl.ch>2006-10-10 11:14:06 +0000
committermihaylov <mihaylov@epfl.ch>2006-10-10 11:14:06 +0000
commitc1a76844ed9f1ab43dc6757e9c8d7866a5ccc998 (patch)
tree0fa6d997fe62579ed565b28a61b655140be680e8 /test/files
parentc012f9230600552b491b000f18252d0f832426be (diff)
downloadscala-c1a76844ed9f1ab43dc6757e9c8d7866a5ccc998.tar.gz
scala-c1a76844ed9f1ab43dc6757e9c8d7866a5ccc998.tar.bz2
scala-c1a76844ed9f1ab43dc6757e9c8d7866a5ccc998.zip
Made some test cases platform-independent
Diffstat (limited to 'test/files')
-rw-r--r--test/files/run/Course-2002-07.scala132
-rw-r--r--test/files/run/Course-2002-10.scala48
-rw-r--r--test/files/run/bug457.scala2
-rw-r--r--test/files/run/bugs.scala137
-rw-r--r--test/files/run/caseclasses.scala31
-rw-r--r--test/files/run/classof.scala4
-rw-r--r--test/files/run/enums.scala2
-rw-r--r--test/files/run/literals.scala2
-rw-r--r--test/files/run/richs.scala2
-rw-r--r--test/files/run/runtime.scala29
-rw-r--r--test/files/run/tailcalls.scala2
11 files changed, 185 insertions, 206 deletions
diff --git a/test/files/run/Course-2002-07.scala b/test/files/run/Course-2002-07.scala
index 98f09aafb7..cfce48717c 100644
--- a/test/files/run/Course-2002-07.scala
+++ b/test/files/run/Course-2002-07.scala
@@ -3,8 +3,6 @@
//############################################################################
// $Id$
-import java.lang.System; // to avoid name clash with .NET's library
-
object M0 {
trait Expr {
@@ -53,15 +51,15 @@ object M0 {
}
def test = {
- System.out.println(" 0 = " + eval(new Number(0)));
- System.out.println(" 1 = " + eval(new Number(1)));
- System.out.println(" 0 + 1 = " +
+ Console.println(" 0 = " + eval(new Number(0)));
+ Console.println(" 1 = " + eval(new Number(1)));
+ Console.println(" 0 + 1 = " +
eval(new Sum(new Number(0),new Number(1))));
- System.out.println(" 1 + 2 = " +
+ Console.println(" 1 + 2 = " +
eval(new Sum(new Number(1),new Number(2))));
- System.out.println("2 + 3 + 4 = " +
+ Console.println("2 + 3 + 4 = " +
eval(new Sum(new Sum(new Number(2),new Number(3)),new Number(4))));
- System.out.println();
+ Console.println;
}
}
@@ -81,15 +79,15 @@ object M1 {
}
def test = {
- System.out.println(" 0 = " + new Number(0).eval);
- System.out.println(" 1 = " + new Number(1).eval);
- System.out.println(" 0 + 1 = " +
+ Console.println(" 0 = " + new Number(0).eval);
+ Console.println(" 1 = " + new Number(1).eval);
+ Console.println(" 0 + 1 = " +
new Sum(new Number(0),new Number(1)).eval);
- System.out.println(" 1 + 2 = " +
+ Console.println(" 1 + 2 = " +
new Sum(new Number(1),new Number(2)).eval);
- System.out.println("2 + 3 + 4 = " +
+ Console.println("2 + 3 + 4 = " +
new Sum(new Sum(new Number(2),new Number(3)),new Number(4)).eval);
- System.out.println();
+ Console.println;
}
}
@@ -107,13 +105,13 @@ object M2 {
}
def test = {
- System.out.println(" 0 = " + eval(Number(0)));
- System.out.println(" 1 = " + eval(Number(1)));
- System.out.println(" 0 + 1 = " + eval(Sum(Number(0),Number(1))));
- System.out.println(" 1 + 2 = " + eval(Sum(Number(1),Number(2))));
- System.out.println("2 + 3 + 4 = " + eval(Sum(Sum(Number(2),Number(3)),
+ Console.println(" 0 = " + eval(Number(0)));
+ Console.println(" 1 = " + eval(Number(1)));
+ Console.println(" 0 + 1 = " + eval(Sum(Number(0),Number(1))));
+ Console.println(" 1 + 2 = " + eval(Sum(Number(1),Number(2))));
+ Console.println("2 + 3 + 4 = " + eval(Sum(Sum(Number(2),Number(3)),
Number(4))));
- System.out.println();
+ Console.println;
}
}
@@ -131,13 +129,13 @@ object M3 {
case class Sum(e1: Expr, e2: Expr) extends Expr;
def test = {
- System.out.println(" 0 = " + Number(0).eval);
- System.out.println(" 1 = " + Number(1).eval);
- System.out.println(" 0 + 1 = " + Sum(Number(0),Number(1)).eval);
- System.out.println(" 1 + 2 = " + Sum(Number(1),Number(2)).eval);
- System.out.println("2 + 3 + 4 = " + Sum(Sum(Number(2),Number(3)),
+ Console.println(" 0 = " + Number(0).eval);
+ Console.println(" 1 = " + Number(1).eval);
+ Console.println(" 0 + 1 = " + Sum(Number(0),Number(1)).eval);
+ Console.println(" 1 + 2 = " + Sum(Number(1),Number(2)).eval);
+ Console.println("2 + 3 + 4 = " + Sum(Sum(Number(2),Number(3)),
Number(4)).eval);
- System.out.println();
+ Console.println;
}
}
@@ -152,7 +150,7 @@ object M4 {
}
def test_concat[a](xss: List[List[a]]) = {
- System.out.println(concat(xss).toString() + " = concat(" + xss + ")"); // !!! .toString()
+ Console.println(concat(xss).toString() + " = concat(" + xss + ")"); // !!! .toString()
}
def test = {
@@ -175,7 +173,7 @@ object M4 {
test_concat(List(List[int](),List(1),List(2,3,4,5,6))); // !!! [int]
test_concat(List(List[int](),List[int](),List(1,2,3,4,5,6))); // !!! [int]
test_concat(List(List(1,2),List(3,4),List(5,6)));
- System.out.println();
+ Console.println;
}
}
@@ -191,7 +189,7 @@ object M5 {
}
def test_zipFun[a,b](xs: List[a], ys: List[b]) = {
- System.out.println(zipFun(xs,ys).toString() + " = zipFun(" + xs + "," + ys + ")"); // !!! .toString()
+ Console.println(zipFun(xs,ys).toString() + " = zipFun(" + xs + "," + ys + ")"); // !!! .toString()
}
def test = {
@@ -209,7 +207,7 @@ object M5 {
test_zipFun(List(1,2,3),List('a','b','c'));
- System.out.println();
+ Console.println;
}
}
@@ -225,7 +223,7 @@ object M6 {
}
def test_zipFun[a,b](xs: List[a], ys: List[b]) = {
- System.out.println(zipFun(xs,ys).toString() + " = zipFun(" + xs + "," + ys + ")"); // !!! .toString()
+ Console.println(zipFun(xs,ys).toString() + " = zipFun(" + xs + "," + ys + ")"); // !!! .toString()
}
def test = {
@@ -243,7 +241,7 @@ object M6 {
test_zipFun(List(1,2,3),List('a','b','c'));
- System.out.println();
+ Console.println;
}
}
@@ -258,7 +256,7 @@ object M7 {
}
def test_heads[a](xss: List[List[a]]) = {
- System.out.println(heads(xss).toString() + " = heads(" + xss + ")"); // !!! .toString()
+ Console.println(heads(xss).toString() + " = heads(" + xss + ")"); // !!! .toString()
}
@@ -287,7 +285,7 @@ object M7 {
test_heads(List(List(1,2),List(3,4),List(5,6)));
- System.out.println();
+ Console.println;
}
}
@@ -304,7 +302,7 @@ object M8 {
}
def test_heads[a](xss: List[List[a]]) = {
- System.out.println(heads(xss).toString() + " = heads(" + xss + ")"); // !!! .toString()
+ Console.println(heads(xss).toString() + " = heads(" + xss + ")"); // !!! .toString()
}
@@ -333,7 +331,7 @@ object M8 {
test_heads(List(List(1,2),List(3,4),List(5,6)));
- System.out.println();
+ Console.println;
}
}
@@ -367,9 +365,9 @@ object M9 {
val x = Var("x");
val f0 = Prod(x, x);
val f1 = f0 derive x;
- System.out.println("f (x) = " + f0);
- System.out.println("f'(x) = " + f1);
- System.out.println();
+ Console.println("f (x) = " + f0);
+ Console.println("f'(x) = " + f1);
+ Console.println;
}
}
@@ -434,17 +432,17 @@ object MA {
val f0 = x * x;
val f1 = f0 derive x;
- System.out.println("f (x) = " + f0);
- System.out.println("f'(x) = " + f1);
+ Console.println("f (x) = " + f0);
+ Console.println("f'(x) = " + f1);
val g0 = Number(2) * x * x + Number(3) * x;
val g1 = g0 derive x;
- System.out.println("g (x) = " + g0);
- System.out.println("g'(x) = " + g1);
- System.out.println("g (3) = " + evalvars(List(Pair("x",3)))(g0));
- System.out.println("g'(3) = " + evalvars(List(Pair("x",3)))(g1));
+ Console.println("g (x) = " + g0);
+ Console.println("g'(x) = " + g1);
+ Console.println("g (3) = " + evalvars(List(Pair("x",3)))(g0));
+ Console.println("g'(3) = " + evalvars(List(Pair("x",3)))(g1));
- System.out.println();
+ Console.println;
}
}
@@ -647,15 +645,15 @@ object MB {
val tg = x + x + (x * _2) + x + x;
val th = x * x * (x ^ 2) * x * x;
- System.out.println("ta(x) = " + ta);
- System.out.println("tb(x) = " + tb);
- System.out.println("tc(x) = " + tc);
- System.out.println("td(x) = " + td);
- System.out.println("te(x) = " + te);
- System.out.println("tf(x) = " + tf);
- System.out.println("tg(x) = " + tg);
- System.out.println("th(x) = " + th);
- System.out.println();
+ Console.println("ta(x) = " + ta);
+ Console.println("tb(x) = " + tb);
+ Console.println("tc(x) = " + tc);
+ Console.println("td(x) = " + td);
+ Console.println("te(x) = " + te);
+ Console.println("tf(x) = " + tf);
+ Console.println("tg(x) = " + tg);
+ Console.println("th(x) = " + th);
+ Console.println;
val f4 = (x+ _3)*(_2+x)*x*(x+ _1) + (x+ _5)*(x*(x+ _2)+x+ _1) + (x^2) + x;
val f3 = f4.derive(x);
@@ -663,17 +661,17 @@ object MB {
val f1 = f2.derive(x);
val f0 = f1.derive(x);
- System.out.println("f4(x) = " + f4);
- System.out.println("f3(x) = " + f3);
- System.out.println("f2(x) = " + f2);
- System.out.println("f1(x) = " + f1);
- System.out.println("f0(x) = " + f0);
- System.out.println();
+ Console.println("f4(x) = " + f4);
+ Console.println("f3(x) = " + f3);
+ Console.println("f2(x) = " + f2);
+ Console.println("f1(x) = " + f1);
+ Console.println("f0(x) = " + f0);
+ Console.println;
def check(n: String, f: Expr, x: int, e: int) = {
val a: int = f.evaluate(List(Pair("x",x)));
val s: String = if (a == e) "ok" else "KO(" + e + ")";
- System.out.println(n + "(" + x + ") = " + a + " " + s);
+ Console.println(n + "(" + x + ") = " + a + " " + s);
}
check("f4", f4, 0, 5);
@@ -681,25 +679,25 @@ object MB {
check("f4", f4, 2, 203);
check("f4", f4, 3, 524);
check("f4", f4, 4, 1121);
- System.out.println();
+ Console.println;
check("f3", f3, 0, 23);
check("f3", f3, 1, 88);
check("f3", f3, 2, 219);
check("f3", f3, 3, 440);
- System.out.println();
+ Console.println;
check("f2", f2, 0, 40);
check("f2", f2, 1, 94);
check("f2", f2, 2, 172);
- System.out.println();
+ Console.println;
check("f1", f1, 0, 42);
check("f1", f1, 1, 66);
- System.out.println();
+ Console.println;
check("f0", f0, 0, 24);
- System.out.println();
+ Console.println;
}
}
diff --git a/test/files/run/Course-2002-10.scala b/test/files/run/Course-2002-10.scala
index d92893772e..cfd4f02e99 100644
--- a/test/files/run/Course-2002-10.scala
+++ b/test/files/run/Course-2002-10.scala
@@ -3,8 +3,6 @@
//############################################################################
// $Id$
-import java.lang.System; // to avoid name clash with .NET's library
-
object M0 {
def addStream (s1: Stream[int], s2: Stream[int]): Stream[int] =
@@ -15,8 +13,8 @@ object M0 {
def test = {
var i = 0;
- fib.take(20).foreach(n => {System.out.println("fib("+i+") = "+n); i=i+1});
- System.out.println();
+ fib.take(20).foreach(n => {Console.println("fib("+i+") = "+n); i=i+1});
+ Console.println;
}
}
@@ -67,30 +65,30 @@ object M1 {
def test = {
var i = 0;
while (i < 10) {
- System.out.print("pi("+i+") = ");
- System.out.print(str(pi0.at(i)) + ", ");
- System.out.print(str(pi1.at(i)) + ", ");
- System.out.print(str(pi2.at(i)) + "\n");
+ Console.print("pi("+i+") = ");
+ Console.print(str(pi0.at(i)) + ", ");
+ Console.print(str(pi1.at(i)) + ", ");
+ Console.print(str(pi2.at(i)) + "\n");
i = i + 1;
}
- System.out.print("pi = ");
- System.out.print(str(Math.PI) + ", ");
- System.out.print(str(Math.PI) + ", ");
- System.out.print(str(Math.PI) + "\n");
- System.out.println();
+ Console.print("pi = ");
+ Console.print(str(Math.PI) + ", ");
+ Console.print(str(Math.PI) + ", ");
+ Console.print(str(Math.PI) + "\n");
+ Console.println;
i = 0;
while (i < 10) {
- System.out.print("ln("+i+") = ");
- System.out.print(str(ln0.at(i)) + ", ");
- System.out.print(str(ln1.at(i)) + ", ");
- System.out.print(str(ln2.at(i)) + "\n");
+ Console.print("ln("+i+") = ");
+ Console.print(str(ln0.at(i)) + ", ");
+ Console.print(str(ln1.at(i)) + ", ");
+ Console.print(str(ln2.at(i)) + "\n");
i = i + 1;
}
- System.out.print("ln = ");
- System.out.print(str(Math.log(2)) + ", ");
- System.out.print(str(Math.log(2)) + ", ");
- System.out.print(str(Math.log(2)) + "\n");
- System.out.println();
+ Console.print("ln = ");
+ Console.print(str(Math.log(2)) + ", ");
+ Console.print(str(Math.log(2)) + ", ");
+ Console.print(str(Math.log(2)) + "\n");
+ Console.println;
}
}
@@ -116,9 +114,9 @@ object M2 {
def test = {
val i = (new PrimeIterator()).take(30);
- System.out.print("prime numbers:");
- while (i.hasNext) { System.out.print(" " + i.next); }
- System.out.println();
+ Console.print("prime numbers:");
+ while (i.hasNext) { Console.print(" " + i.next); }
+ Console.println;
}
}
diff --git a/test/files/run/bug457.scala b/test/files/run/bug457.scala
index 98983a2fa2..3438857a7a 100644
--- a/test/files/run/bug457.scala
+++ b/test/files/run/bug457.scala
@@ -15,7 +15,7 @@ object Test {
}
def method2(): scala.Boolean = {
- val x: java.lang.String = "Hello, world";
+ val x: String = "Hello, world";
val y: scala.Int = 100;
{
var temp1: scala.Int = y;
diff --git a/test/files/run/bugs.scala b/test/files/run/bugs.scala
index 165be165d6..6d0075332d 100644
--- a/test/files/run/bugs.scala
+++ b/test/files/run/bugs.scala
@@ -4,20 +4,11 @@
// $Id$
//############################################################################
-// serves as an entry point with the MSIL backend
-
-object TestMain {
- def main(args: Array[String]): Unit = {
- Test.main(args);
- }
-}
-
-//############################################################################
// Bug 98
object Bug98Test {
object MyCase { def name = "mycase" };
- def main(args: Array[String]) = {
+ def test(args: Array[String]) = {
Console.println(MyCase.name);
}
}
@@ -30,18 +21,18 @@ class Bug120A(x: Int) {
}
trait Bug120B {
- System.out.println("B");
+ Console.println("B");
}
class Bug120C(x: Int)
extends Bug120A(Bug120Test.print("one", 1))
with Bug120B {
- System.out.println("C");
+ Console.println("C");
}
object Bug120Test {
def print[A](str: String, res: A): A = {
Console.println(str); res
}
- def main(args: Array[String]) = {
+ def test(args: Array[String]) = {
val c = new Bug120C(1);
}
}
@@ -53,7 +44,7 @@ object Bug135Test {
import scala.collection.immutable.TreeMap;
- def main(args: Array[String]): Unit = {
+ def test(args: Array[String]): Unit = {
val myMap:TreeMap[int,String] = new TreeMap;
val map1 = myMap + 42 -> "The answer";
Console.println(map1.get(42));
@@ -69,22 +60,22 @@ abstract class Bug142Foo2 { class Inner; def foo: Inner = {Console.println("ok")
abstract class Bug142Foo3 { type Inner; def foo: Inner; foo; }
abstract class Bug142Foo4 { type Inner; def foo: Inner = {Console.println("ok"); null.asInstanceOf[Inner]}; }
-trait Bug142Bar1 { type Inner; def foo: Inner = {System.out.println("ok"); null.asInstanceOf[Inner]}; }
+trait Bug142Bar1 { type Inner; def foo: Inner = {Console.println("ok"); null.asInstanceOf[Inner]}; }
trait Bug142Bar2 { type Inner; def foo: Inner; foo; }
-trait Bug142Bar3 { class Inner; def foo: Inner = {System.out.println("ok"); null}; }
+trait Bug142Bar3 { class Inner; def foo: Inner = {Console.println("ok"); null}; }
trait Bug142Bar4 { class Inner; def foo: Inner; foo; }
-object Bug142Test1 extends Bug142Foo1 with Bug142Bar1 {def main(args:Array[String]):Unit=();}
-object Bug142Test2 extends Bug142Foo2 with Bug142Bar2 {def main(args:Array[String]):Unit=();}
-object Bug142Test3 extends Bug142Foo3 with Bug142Bar3 {def main(args:Array[String]):Unit=();}
-object Bug142Test4 extends Bug142Foo4 with Bug142Bar4 {def main(args:Array[String]):Unit=();}
-object Bug142Test5 extends Bug142Foo1 with Bug142Bar1 {def main(args:Array[String]):Unit=();}
-object Bug142Test6 extends Bug142Foo2 with Bug142Bar2 {def main(args:Array[String]):Unit=();}
-object Bug142Test7 extends Bug142Foo3 with Bug142Bar3 {def main(args:Array[String]):Unit=();}
-object Bug142Test8 extends Bug142Foo4 with Bug142Bar4 {def main(args:Array[String]):Unit=();}
+object Bug142Test1 extends Bug142Foo1 with Bug142Bar1 {def test(args:Array[String]):Unit=();}
+object Bug142Test2 extends Bug142Foo2 with Bug142Bar2 {def test(args:Array[String]):Unit=();}
+object Bug142Test3 extends Bug142Foo3 with Bug142Bar3 {def test(args:Array[String]):Unit=();}
+object Bug142Test4 extends Bug142Foo4 with Bug142Bar4 {def test(args:Array[String]):Unit=();}
+object Bug142Test5 extends Bug142Foo1 with Bug142Bar1 {def test(args:Array[String]):Unit=();}
+object Bug142Test6 extends Bug142Foo2 with Bug142Bar2 {def test(args:Array[String]):Unit=();}
+object Bug142Test7 extends Bug142Foo3 with Bug142Bar3 {def test(args:Array[String]):Unit=();}
+object Bug142Test8 extends Bug142Foo4 with Bug142Bar4 {def test(args:Array[String]):Unit=();}
object Bug142Test {
- def main(args:Array[String]): Unit = {
+ def test(args:Array[String]): Unit = {
Bug142Test1;
Bug142Test2;
Bug142Test3;
@@ -102,7 +93,7 @@ object Bug142Test {
object Bug166Test {
import scala.collection.mutable.HashMap ;
- def main(args:Array[String]) = {
+ def test(args:Array[String]) = {
val m:HashMap[String,String] = new HashMap[String,String];
m.update("foo","bar");
}
@@ -119,7 +110,7 @@ class Bug167Node(bar:Int) {
}
object Bug167Test {
- def main(args: Array[String]): Unit = {
+ def test(args: Array[String]): Unit = {
if (new Bug167Node(0).foo != 1) Console.println("bug 167");
}
}
@@ -133,7 +124,7 @@ class Bug168Foo {
}
object Bug168Test {
- def main(args: Array[String]): Unit = {
+ def test(args: Array[String]): Unit = {
(new Bug168Foo).foo;
()
}
@@ -161,7 +152,7 @@ class Bug174Foo[X] {
}
object Bug174Test {
- def main(args: Array[String]): Unit = {
+ def test(args: Array[String]): Unit = {
(new Bug174Foo[Int]).inner.test;
()
}
@@ -189,7 +180,7 @@ class Bug176C extends Bug176A with Bug176B {
def bar = new S;
}
object Bug176Test {
- def main(args: Array[String]): Unit = {
+ def test(args: Array[String]): Unit = {
val x: Bug176A = new Bug176C;
Console.println(x.test);
}
@@ -200,7 +191,7 @@ object Bug176Test {
class Bug199C { object o; }
object Bug199Test {
- def main(args: Array[String]) = {
+ def test(args: Array[String]) = {
(new Bug199C).o; ()
}
}
@@ -219,18 +210,18 @@ class Bug213Bar extends Bug213Foo {
}
object Bug213Test {
- def main(args: Array[String]): Unit = {
+ def test(args: Array[String]): Unit = {
val foo: Bug213Foo = new Bug213Bar;
try {
foo.testAll;
} catch {
- case e: java.lang.ClassCastException =>
+ case e: compat.Platform.ClassCastException =>
Console.println("Cannot cast unit to Nothing");
}
try {
foo.testAllRef;
} catch {
- case e: java.lang.ClassCastException =>
+ case e: compat.Platform.ClassCastException =>
Console.println("Cannot cast empty string to Null");
}
()
@@ -246,14 +237,14 @@ object Bug217Test {
foo(() => 0);
()
}
- def main(args: Array[String]): Unit = bar(32);
+ def test(args: Array[String]): Unit = bar(32);
}
//############################################################################
// Bug 222
object Bug222Test {
- def main(args:Array[String]): Unit = {
+ def test(args:Array[String]): Unit = {
val array: Array[String] = new Array(16);
()
}
@@ -266,7 +257,7 @@ case class Bug225C();
object Bug225Test {
- def main(args: Array[String]): Unit = {
+ def test(args: Array[String]): Unit = {
val a = new Array[Array[Bug225C]](2);
a(0) = new Array[Bug225C](2);
a(0)(0) = new Bug225C();
@@ -280,7 +271,7 @@ object Bug226Test {
def id[a](xs: Array[a]): Array[a] = xs;
- def main(args: Array[String]): Unit = {
+ def test(args: Array[String]): Unit = {
var xs = new Array[Int](1);
class X { xs };
xs = id(xs);
@@ -295,7 +286,7 @@ object Bug226Test {
object Bug233Test {
val b: Array[String] = null;
- def main(args: Array[String]): Unit =
+ def test(args: Array[String]): Unit =
Console.println(b == null);
}
@@ -303,7 +294,7 @@ object Bug233Test {
// Bug 250
object Bug250Test {
- def main(args: Array[String]): Unit = {
+ def test(args: Array[String]): Unit = {
if (true) null;
()
}
@@ -324,7 +315,7 @@ object Bug257Test {
f2(x);
}
- def main(args: Array[String]): Unit = {
+ def test(args: Array[String]): Unit = {
f(sayhello())(sayhi())
}
}
@@ -342,7 +333,7 @@ abstract class Bug266AFoo {
object Bug266ATest extends Bug266AFoo {
type T = String;
class I1 extends I0 { def f(x: String): Unit = { Console.println("hello"); ();} }
- def main(args: Array[String]): Unit = { new I1; () }
+ def test(args: Array[String]): Unit = { new I1; () }
}
// version - B
@@ -376,9 +367,9 @@ object Bug266BTest extends Application {
// main
object Bug266Test {
- def main(args: Array[String]): Unit = {
- Bug266ATest.main(args);
- Bug266BTest.main(args);
+ def test(args: Array[String]): Unit = {
+ Bug266ATest.test(args);
+ Bug266BTest;
}
}
@@ -391,7 +382,7 @@ class Bug316MyIterator extends Iterator[Int] {
}
object Bug316Test {
- def main(args: Array[String]): Unit =
+ def test(args: Array[String]): Unit =
(new Bug316MyIterator) filter { x: Int => x == 1 };
}
@@ -399,8 +390,8 @@ object Bug316Test {
// Bug 328
object Bug328Test {
- def test(f: Function1[Int,String]): Unit = ();
- def main(args: Array[String]): Unit = test(args);
+ def test0(f: Function1[Int,String]): Unit = ();
+ def test(args: Array[String]): Unit = test0(args);
}
//############################################################################
@@ -418,7 +409,7 @@ trait Bug396B extends Bug396A {
}
trait Bug396C extends Bug396A {
trait I extends super.I {
- override def run = { super.run; System.out.println("C"); }
+ override def run = { super.run; Console.println("C"); }
}
}
object Bug396Test extends Application with Bug396B with Bug396C {
@@ -438,7 +429,7 @@ object Bug399Test {
(new G).f
}
- def main(args: Array[String]): Unit = {
+ def test(args: Array[String]): Unit = {
Console.println(f("a"));
}
}
@@ -466,29 +457,29 @@ object Test {
def main(args: Array[String]): Unit = {
- test( 98, Bug98Test.main(args));
- test(120, Bug120Test.main(args));
- test(135, Bug135Test.main(args));
- test(142, Bug142Test.main(args));
- test(166, Bug166Test.main(args));
- test(167, Bug167Test.main(args));
- test(168, Bug168Test.main(args));
- test(174, Bug174Test.main(args));
- test(176, Bug176Test.main(args));
- test(199, Bug199Test.main(args));
- test(213, Bug213Test.main(args));
- test(217, Bug217Test.main(args));
- test(222, Bug222Test.main(args));
- test(225, Bug225Test.main(args));
- test(226, Bug226Test.main(args));
- test(233, Bug233Test.main(args));
- test(250, Bug250Test.main(args));
- test(257, Bug257Test.main(args));
- test(266, Bug266Test.main(args));
- test(316, Bug316Test.main(args));
- test(328, Bug328Test.main(args));
- test(396, Bug396Test.main(args));
- test(399, Bug399Test.main(args));
+ test( 98, Bug98Test.test(args));
+ test(120, Bug120Test.test(args));
+ test(135, Bug135Test.test(args));
+ test(142, Bug142Test.test(args));
+ test(166, Bug166Test.test(args));
+ test(167, Bug167Test.test(args));
+ test(168, Bug168Test.test(args));
+ test(174, Bug174Test.test(args));
+ test(176, Bug176Test.test(args));
+ test(199, Bug199Test.test(args));
+ test(213, Bug213Test.test(args));
+ test(217, Bug217Test.test(args));
+ test(222, Bug222Test.test(args));
+ test(225, Bug225Test.test(args));
+ test(226, Bug226Test.test(args));
+ test(233, Bug233Test.test(args));
+ test(250, Bug250Test.test(args));
+ test(257, Bug257Test.test(args));
+ test(266, Bug266Test.test(args));
+ test(316, Bug316Test.test(args));
+ test(328, Bug328Test.test(args));
+ test(396, Bug396Test);
+ test(399, Bug399Test.test(args));
if (errors > 0) {
Console.println;
diff --git a/test/files/run/caseclasses.scala b/test/files/run/caseclasses.scala
index 147b1cdd4e..809bfb3511 100644
--- a/test/files/run/caseclasses.scala
+++ b/test/files/run/caseclasses.scala
@@ -3,26 +3,27 @@ case class Foo(x: int)(y: int);
case class Bar;
object Test extends Application {
+ import compat.Platform.IndexOutOfBoundsException
+
def fn[a,b](x: a => b) = x;
val f = fn(Foo(1))
(f(2): AnyRef) match {
- case Foo(1) => System.out.println("OK")
- case Bar() => System.out.println("NO")
+ case Foo(1) => Console.println("OK")
+ case Bar() => Console.println("NO")
}
- try {
- Bar() caseElement 2
- throw new NullPointerException("duh")
- } catch {
- case x:IndexOutOfBoundsException =>
- }
+ try {
+ Bar() caseElement 2
+ throw new NullPointerException("duh")
+ } catch {
+ case x:IndexOutOfBoundsException =>
+ }
- try {
- f(2) caseElement 2
- throw new NullPointerException("duh")
- } catch {
- case x:IndexOutOfBoundsException =>
- }
+ try {
+ f(2) caseElement 2
+ throw new NullPointerException("duh")
+ } catch {
+ case x:IndexOutOfBoundsException =>
+ }
}
-
diff --git a/test/files/run/classof.scala b/test/files/run/classof.scala
index c2c76b344e..3b6180396c 100644
--- a/test/files/run/classof.scala
+++ b/test/files/run/classof.scala
@@ -2,7 +2,7 @@ class SomeClass
object Test {
def main(args: Array[String]): Unit = {
- val cls:Class = classOf[SomeClass]
- Console.println(cls.getName)
+ val cls: Class = classOf[SomeClass]
+ Console.println(compat.Platform.getName(cls))
}
}
diff --git a/test/files/run/enums.scala b/test/files/run/enums.scala
index 1fd7dfb6c4..239e2944d4 100644
--- a/test/files/run/enums.scala
+++ b/test/files/run/enums.scala
@@ -64,7 +64,7 @@ object Test {
} catch {
case exception: Throwable => {
Console.print(" raised exception " + exception);
- exception.printStackTrace();
+ compat.Platform.printStackTrace(exception);
}
}
Console.println;
diff --git a/test/files/run/literals.scala b/test/files/run/literals.scala
index 85f755969f..8f7eea55b5 100644
--- a/test/files/run/literals.scala
+++ b/test/files/run/literals.scala
@@ -38,7 +38,7 @@ object Test {
check_success("'\\u005f' == '_'", '\u005f', '_')
check_success("65.asInstanceOf[char] == 'A'", 65.asInstanceOf[char], 'A')
check_success("\"\\141\\142\" == \"ab\"", "\141\142", "ab")
- check_success("\"\\0x61\\0x62\".trim() == \"x61\\0x62\"", "\0x61\0x62".trim(), "x61\0x62")
+ check_success("\"\\0x61\\0x62\".trim() == \"x61\\0x62\"", "\0x61\0x62".substring(1), "x61\0x62")
Console.println
diff --git a/test/files/run/richs.scala b/test/files/run/richs.scala
index 526783318b..8b2775ea7b 100644
--- a/test/files/run/richs.scala
+++ b/test/files/run/richs.scala
@@ -8,7 +8,7 @@ trait RichTest {
val s5 = """abc
#xyz"""
def getObjectName: String = {
- val cn = this.getClass().getName()
+ val cn = compat.Platform.getClassName(this)
cn.substring(0, cn.length-1)
}
def length[A](it: Iterator[A]) = it.toList length
diff --git a/test/files/run/runtime.scala b/test/files/run/runtime.scala
index 30f32b7cba..192d405eba 100644
--- a/test/files/run/runtime.scala
+++ b/test/files/run/runtime.scala
@@ -4,15 +4,6 @@
// $Id$
//############################################################################
-// serves as an entry point with the MSIL backend
-
-object TestMain {
- def main(args: Array[String]): Unit = {
- Test.main(args);
- }
-}
-
-//############################################################################
// Test 0 - Array creation
object Test0Test {
@@ -28,7 +19,7 @@ object Test0Test {
Console.println;
}
- def main(args: Array[String]): Unit = {
+ def test(args: Array[String]): Unit = {
val zs: Array[Boolean] = Array(false, true);
val bs: Array[Byte ] = Array(0, 1, 2);
val ss: Array[Short ] = Array(3, 4, 5);
@@ -69,7 +60,7 @@ package test1.bar {
object Test1Test {
- def main(args: Array[String]): Unit = {
+ def test(args: Array[String]): Unit = {
{Console.print(10)}; Console.println;
// {System.out.print(11); java}.lang.System.out.println();
// {System.out.print(12); java.lang}.System.out.println();
@@ -99,7 +90,7 @@ package test2 {
}
trait M0 extends A {
- override def run = { super.run; System.out.println("M0"); }
+ override def run = { super.run; Console.println("M0"); }
}
class M1 extends M0 {
@@ -107,7 +98,7 @@ package test2 {
}
trait N0 extends A {
- override def run = { super.run; System.out.println("N0"); }
+ override def run = { super.run; Console.println("N0"); }
}
class N1 extends N0 {
@@ -122,7 +113,7 @@ package test2 {
}
object Test2Test {
- def main(args: Array[String]): Unit = {
+ def test(args: Array[String]): Unit = {
test2.M0N0.run; Console.println;
test2.N0M0.run; Console.println;
test2.M1N0.run; Console.println;
@@ -143,7 +134,7 @@ object Test3Test {
+ "expected: " + expected + " - " + (!expected) + ", "
+ "found: " + actual1 + " - " + actual1);
- def main(args: Array[String]): Unit = {
+ def test(args: Array[String]): Unit = {
val foo1: AnyRef = null;
val foo2: AnyRef = new Foo();
val foo3: AnyRef = new Foo();
@@ -194,10 +185,10 @@ object Test {
def main(args: Array[String]): Unit = {
- test("Test0" , Test0Test.main(args));
- test("Test1" , Test1Test.main(args));
- test("Test2" , Test2Test.main(args));
- test("Test3" , Test3Test.main(args));
+ test("Test0" , Test0Test.test(args));
+ test("Test1" , Test1Test.test(args));
+ test("Test2" , Test2Test.test(args));
+ test("Test3" , Test3Test.test(args));
if (errors > 0) {
Console.println;
diff --git a/test/files/run/tailcalls.scala b/test/files/run/tailcalls.scala
index 3c1d96dd0b..037b8b41f8 100644
--- a/test/files/run/tailcalls.scala
+++ b/test/files/run/tailcalls.scala
@@ -215,7 +215,7 @@ object Test {
if (n >= compat.Math.MAX_INT / 2) error("calibration failure");
n = 2 * n;
} catch {
- case exception: StackOverflowError => stop = true
+ case exception: compat.Platform.StackOverflowError => stop = true
}
}
4 * n;