From f54efe4dc3d13ffab28e6c1e7b0fced4b79eb8d0 Mon Sep 17 00:00:00 2001 From: mihaylov Date: Tue, 6 Feb 2007 16:06:34 +0000 Subject: Merged the dotnet-scala branch --- test/files/jvm/bug560bis.check | 2 ++ test/files/jvm/bug560bis.scala | 21 ++++++++++++ test/files/run/Course-2002-03.scala | 8 +++-- test/files/run/bug560bis.check | 2 -- test/files/run/bug560bis.scala | 21 ------------ test/files/run/bugs.scala | 12 +++---- test/files/run/richs-msil.check | 66 +++++++++++++++++++++++++++++++++++++ test/files/run/richs.check | 3 -- test/files/run/richs.scala | 40 +++++++++++----------- test/files/run/try.scala | 4 +-- 10 files changed, 122 insertions(+), 57 deletions(-) create mode 100644 test/files/jvm/bug560bis.check create mode 100644 test/files/jvm/bug560bis.scala delete mode 100644 test/files/run/bug560bis.check delete mode 100644 test/files/run/bug560bis.scala create mode 100644 test/files/run/richs-msil.check (limited to 'test/files') diff --git a/test/files/jvm/bug560bis.check b/test/files/jvm/bug560bis.check new file mode 100644 index 0000000000..91eb4c19a2 --- /dev/null +++ b/test/files/jvm/bug560bis.check @@ -0,0 +1,2 @@ +cool! +cool! diff --git a/test/files/jvm/bug560bis.scala b/test/files/jvm/bug560bis.scala new file mode 100644 index 0000000000..13bf4b1ae0 --- /dev/null +++ b/test/files/jvm/bug560bis.scala @@ -0,0 +1,21 @@ +object Test { +import scala.xml._; + + def bar(args: Seq[String]) = args match { + case Seq(a,b,c,d @ _*) => Console.println("cool!") + case _ => Console.println("bah") + } + def foo(args: List[String]) = + Elem(null,"bla",Null, TopScope, (args map {x => Text(x)}):_*) match { + case Elem(_,_,_,_,Text("1"),_*) => + Console.println("cool!") + case _ => + Console.println("bah") + } + + def main(args: Array[String]) = { + val li = List("1","2","3","4") + bar(li) + foo(li) + } +} diff --git a/test/files/run/Course-2002-03.scala b/test/files/run/Course-2002-03.scala index 7933514f9a..5a470a3561 100644 --- a/test/files/run/Course-2002-03.scala +++ b/test/files/run/Course-2002-03.scala @@ -3,6 +3,8 @@ //############################################################################ // $Id$ +import scala.compat.StringBuilder; + object M0 { class Rational(x: Int, y: Int) { def numer = x; @@ -230,10 +232,10 @@ object M8 { def intersect2(that: IntSet): IntSet = filter(x => that.contains(x)); def filter(f: Int => Boolean): IntSet = filter0(f, new Empty); - def printOn(out: java.io.PrintStream) = foreach(out.println); + def print() = foreach(Console.println); override def toString(): String = { - val buffer: java.lang.StringBuffer = new java.lang.StringBuffer(); + val buffer: StringBuilder = new StringBuilder(); buffer.append('['); foreach(i => { if (buffer.length() > 1) {buffer.append(','); ()}; // !!! ; () @@ -312,7 +314,7 @@ object M8 { Console.println; Console.println("set4 contains the following elements:"); - set4.printOn(java.lang.System.out); + set4.print(); Console.println; Console.println("2 <- set2: " + (set2 contains 2)); diff --git a/test/files/run/bug560bis.check b/test/files/run/bug560bis.check deleted file mode 100644 index 91eb4c19a2..0000000000 --- a/test/files/run/bug560bis.check +++ /dev/null @@ -1,2 +0,0 @@ -cool! -cool! diff --git a/test/files/run/bug560bis.scala b/test/files/run/bug560bis.scala deleted file mode 100644 index 13bf4b1ae0..0000000000 --- a/test/files/run/bug560bis.scala +++ /dev/null @@ -1,21 +0,0 @@ -object Test { -import scala.xml._; - - def bar(args: Seq[String]) = args match { - case Seq(a,b,c,d @ _*) => Console.println("cool!") - case _ => Console.println("bah") - } - def foo(args: List[String]) = - Elem(null,"bla",Null, TopScope, (args map {x => Text(x)}):_*) match { - case Elem(_,_,_,_,Text("1"),_*) => - Console.println("cool!") - case _ => - Console.println("bah") - } - - def main(args: Array[String]) = { - val li = List("1","2","3","4") - bar(li) - foo(li) - } -} diff --git a/test/files/run/bugs.scala b/test/files/run/bugs.scala index 0f77bd5f34..ae23dc6b91 100644 --- a/test/files/run/bugs.scala +++ b/test/files/run/bugs.scala @@ -359,9 +359,9 @@ trait Bug266BB extends Bug266BA { val in = 3; } -object Bug266BTest extends Application { +object Bug266BTest { val a: Bug266BA1 = new Bug266BA1 with Bug266BB; - a.mkP.f(a.in); + def test(args: Array[String]): Unit = a.mkP.f(a.in); } // main @@ -369,7 +369,7 @@ object Bug266BTest extends Application { object Bug266Test { def test(args: Array[String]): Unit = { Bug266ATest.test(args); - Bug266BTest; + Bug266BTest.test(args); } } @@ -412,9 +412,9 @@ trait Bug396C extends Bug396A { override def run = { super.run; Console.println("C"); } } } -object Bug396Test extends Application with Bug396B with Bug396C { +object Bug396Test extends Bug396B with Bug396C { class I2 extends super[Bug396B].I with super[Bug396C].I; - (new I2).run + def test(args: Array[String]): Unit = (new I2).run } //############################################################################ @@ -478,7 +478,7 @@ object Test { test(266, Bug266Test.test(args)); test(316, Bug316Test.test(args)); test(328, Bug328Test.test(args)); - test(396, Bug396Test); + test(396, Bug396Test.test(args)); test(399, Bug399Test.test(args)); if (errors > 0) { diff --git a/test/files/run/richs-msil.check b/test/files/run/richs-msil.check new file mode 100644 index 0000000000..e628ad3998 --- /dev/null +++ b/test/files/run/richs-msil.check @@ -0,0 +1,66 @@ + +RichCharTest1: +True +True +True +False + +RichIntTest: +10 +11 +12 +13 +0 +0 + +RichStringTest1: +s1: abc +s2: abc\txyz\n +s3: abc + xyz +s4: abc + |xyz +s5: abc + #xyz + +RichStringTest2: +s1: abc +s2: abc\txyz\n +s3: abc + xyz +s4: abc + |xyz +s5: abc + #xyz + +RichStringTest3: +s1: abc +s2: abc\txyz\n +s3: abc + xyz +s4: abc + |xyz +s5: abc + #xyz + +RichStringTest4: +s1: abc +s2: abc\txyz\n +s3: abc + xyz +s4: abc +xyz +s5: abc + #xyz + +RichStringTest5: +s1: abc + xyz +s2: abc + xyz +s3: abc + xyz +s4: abc + |xyz +s5: abc +xyz diff --git a/test/files/run/richs.check b/test/files/run/richs.check index 3b73f084a0..80b2ef3ef2 100644 --- a/test/files/run/richs.check +++ b/test/files/run/richs.check @@ -5,9 +5,6 @@ true true true -RichCharTest2: -true - RichIntTest: 10 11 diff --git a/test/files/run/richs.scala b/test/files/run/richs.scala index 90eb46d9ad..4df7bc3bf3 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 = compat.Platform.getClassName(this) + val cn = this.getClass().getName() cn.substring(0, cn.length-1) } def length[A](it: Iterator[A]) = it.toList length @@ -23,24 +23,24 @@ object RichCharTest1 extends RichTest { Console.println('A'.asDigit == 10) } } -object RichCharTest2 extends RichTest { - case class C(s: String) { - private val it = s.elements - private var c: Char = _ - def ch(): Char = c - def nextch(): Unit = { c = if (it.hasNext) it.next else ';' } - def err(msg: String) = Console.println(msg) - nextch() - } - def run { - Console.println("\n" + getObjectName + ":") - val c1 = C("x4A;") - val s1 = xml.Utility.parseCharRef(c1.ch, c1.nextch, c1.err) - val c2 = C("74;") - val s2 = xml.Utility.parseCharRef(c2.ch, c2.nextch, c2.err) - Console.println(s1 == s2) - } -} +// object RichCharTest2 extends RichTest { +// case class C(s: String) { +// private val it = s.elements +// private var c: Char = _ +// def ch(): Char = c +// def nextch(): Unit = { c = if (it.hasNext) it.next else ';' } +// def err(msg: String) = Console.println(msg) +// nextch() +// } +// def run { +// Console.println("\n" + getObjectName + ":") +// val c1 = C("x4A;") +// val s1 = xml.Utility.parseCharRef(c1.ch, c1.nextch, c1.err) +// val c2 = C("74;") +// val s2 = xml.Utility.parseCharRef(c2.ch, c2.nextch, c2.err) +// Console.println(s1 == s2) +// } +// } object RichIntTest extends RichTest { private val n = 10 private val m = -2 @@ -107,7 +107,7 @@ object RichStringTest5 extends RichTest { object Test { def main(args: Array[String]): Unit = { RichCharTest1.run - RichCharTest2.run + //RichCharTest2.run RichIntTest.run RichStringTest1.run RichStringTest2.run diff --git a/test/files/run/try.scala b/test/files/run/try.scala index fca6bf5c55..934ebaa2e7 100644 --- a/test/files/run/try.scala +++ b/test/files/run/try.scala @@ -43,12 +43,12 @@ object Test extends AnyRef with Application { def try4 = { if (instance == null) { instance = try { - new String(); + "" //new String(); } catch { case _ => val cs = "aaa"; if (cs.length() > 0) { - new String(); + "" //new String(); } else { throw new Error("fatal error"); null -- cgit v1.2.3