diff options
author | Hubert Plociniczak <hubert.plociniczak@epfl.ch> | 2011-11-02 14:34:35 +0000 |
---|---|---|
committer | Hubert Plociniczak <hubert.plociniczak@epfl.ch> | 2011-11-02 14:34:35 +0000 |
commit | b6778be91900b8161e705dc2598ef7af86842b0b (patch) | |
tree | d15e8ec18a37eec212f50f1ace27714d7e7d4d34 /test/files/jvm | |
parent | ac6c76f26d884a94d0c9ff54f055d3f9ab750bac (diff) | |
download | scala-b6778be91900b8161e705dc2598ef7af86842b0b.tar.gz scala-b6778be91900b8161e705dc2598ef7af86842b0b.tar.bz2 scala-b6778be91900b8161e705dc2598ef7af86842b0b.zip |
Begone t1737...
Diffstat (limited to 'test/files/jvm')
33 files changed, 200 insertions, 200 deletions
diff --git a/test/files/jvm/actor-sync-send-timeout.scala b/test/files/jvm/actor-sync-send-timeout.scala index ed330900b2..21e624bd0a 100644 --- a/test/files/jvm/actor-sync-send-timeout.scala +++ b/test/files/jvm/actor-sync-send-timeout.scala @@ -2,9 +2,9 @@ import scala.actors.Actor /* This test is a regression test for SI-4759. */ -object Test { +object Test { val Runs = 5 - + def main(args: Array[String]) = { var i = 0 while (i < Runs) { diff --git a/test/files/jvm/actor-uncaught-exception.scala b/test/files/jvm/actor-uncaught-exception.scala index 882362272d..5ae66de640 100644 --- a/test/files/jvm/actor-uncaught-exception.scala +++ b/test/files/jvm/actor-uncaught-exception.scala @@ -4,60 +4,60 @@ class MyException(msg: String) extends Exception(msg) { override def fillInStackTrace() = this } -object Test { +object Test { - case object StartError extends Actor { - def act() { + case object StartError extends Actor { + def act() { try { - throw new MyException("I don't want to run!") + throw new MyException("I don't want to run!") } catch { case e: Throwable if (!e.isInstanceOf[scala.util.control.ControlThrowable] && !e.isInstanceOf[MyException]) => e.printStackTrace() } - } - } + } + } - case object MessageError extends Actor { - def act() { + case object MessageError extends Actor { + def act() { try { - react { - case _ => throw new MyException("No message for me!") - } + react { + case _ => throw new MyException("No message for me!") + } } catch { case e: Throwable if !e.isInstanceOf[scala.util.control.ControlThrowable] => e.printStackTrace() } - } - } + } + } - case object Supervisor extends Actor { - def act() { + case object Supervisor extends Actor { + def act() { try { - trapExit = true + trapExit = true link(StartError) link(MessageError) - StartError.start() + StartError.start() MessageError.start() - Actor.loop { - react { + Actor.loop { + react { case Exit(actor, reason) => println("OK") if (actor == StartError) MessageError ! 'ping else exit() - } - } + } + } } catch { case e: Throwable if !e.isInstanceOf[scala.util.control.ControlThrowable] => e.printStackTrace() } - } - } + } + } - def main(args: Array[String]) { - Supervisor.start() - } -} + def main(args: Array[String]) { + Supervisor.start() + } +} diff --git a/test/files/jvm/actor-uncaught-exception2.scala b/test/files/jvm/actor-uncaught-exception2.scala index 36b6f0c52e..0364cbeb03 100644 --- a/test/files/jvm/actor-uncaught-exception2.scala +++ b/test/files/jvm/actor-uncaught-exception2.scala @@ -4,60 +4,60 @@ class MyException(msg: String) extends Exception(msg) { override def fillInStackTrace() = this } -object Test { +object Test { - case object StartError extends Actor { - def act() { + case object StartError extends Actor { + def act() { try { - throw new MyException("I don't want to run!") + throw new MyException("I don't want to run!") } catch { case e: Throwable if (!e.isInstanceOf[scala.util.control.ControlThrowable] && !e.isInstanceOf[MyException]) => e.printStackTrace() } - } - } + } + } - case object MessageError extends Actor { - def act() { + case object MessageError extends Actor { + def act() { try { - react { - case _ => throw new MyException("No message for me!") - } + react { + case _ => throw new MyException("No message for me!") + } } catch { case e: Throwable if !e.isInstanceOf[scala.util.control.ControlThrowable] => e.printStackTrace() } - } - } + } + } - case object Supervisor extends Actor { - def act() { + case object Supervisor extends Actor { + def act() { try { - trapExit = true + trapExit = true link(StartError) link(MessageError) - StartError.start() + StartError.start() MessageError.start() - Actor.loop { - react { + Actor.loop { + react { case Exit(actor, reason) => println(reason) if (actor == StartError) MessageError ! 'ping else exit() - } - } + } + } } catch { case e: Throwable if !e.isInstanceOf[scala.util.control.ControlThrowable] => e.printStackTrace() } - } - } + } + } - def main(args: Array[String]) { - Supervisor.start() - } -} + def main(args: Array[String]) { + Supervisor.start() + } +} diff --git a/test/files/jvm/backendBugUnapply.scala b/test/files/jvm/backendBugUnapply.scala index b4d029f478..45ee6f7d4f 100644 --- a/test/files/jvm/backendBugUnapply.scala +++ b/test/files/jvm/backendBugUnapply.scala @@ -1,16 +1,16 @@ -object Test { +object Test { import scala.xml.{Node,UnprefixedAttribute} - + def domatch(x:Node) = x match { case Node("foo", UnprefixedAttribute("bar", z, _), _*) => z case _ => null } - + def main(args: Array[String]): Unit = { println(domatch(<foo bar="baz"><hi/></foo>)) println(domatch(<foo bingo="donkey"><hi/></foo>)) - // + // // assert(domatch(<foo bar="baz"><hi/></foo>).toString == "baz") // assert(domatch(<foo bar="baz2"><hi/></foo>) == null)//, domatch(<foo bar="baz2"><hi/></foo>)) } diff --git a/test/files/jvm/console.scala b/test/files/jvm/console.scala index 0ac43f2d26..75449416aa 100644 --- a/test/files/jvm/console.scala +++ b/test/files/jvm/console.scala @@ -9,6 +9,6 @@ object Test extends App { flush println("..") println(1) - printf("Argument nr. %d has value %1.2f\n", + printf("Argument nr. %d has value %1.2f\n", 1, 10.0/3) } diff --git a/test/files/jvm/deprecation/Test_1.scala b/test/files/jvm/deprecation/Test_1.scala index 0a5b607037..b68a40c94b 100644 --- a/test/files/jvm/deprecation/Test_1.scala +++ b/test/files/jvm/deprecation/Test_1.scala @@ -7,7 +7,7 @@ class Test { val i = new d.Inner val w = i.buz() } - + @deprecated("no longer!", "") class Inner { @deprecated("uncool", "") def f: Int = 1 @deprecated("this one as well!", "") var g = -1 diff --git a/test/files/jvm/future-termination.scala b/test/files/jvm/future-termination.scala index 688de60c3b..f51642cb7a 100644 --- a/test/files/jvm/future-termination.scala +++ b/test/files/jvm/future-termination.scala @@ -1,19 +1,19 @@ -import scala.actors.Futures - -/* Test that unevaluated futures do not prevent program termination */ - -object Test { - def main(args: Array[String]) { +import scala.actors.Futures + +/* Test that unevaluated futures do not prevent program termination */ + +object Test { + def main(args: Array[String]) { try { - val meaningOfLife = Futures.future { - Thread.sleep(5000) // pretend this is a harder problem than it is - println("I have the answer!") - 42 - } - println("I can't wait that long, bye.") + val meaningOfLife = Futures.future { + Thread.sleep(5000) // pretend this is a harder problem than it is + println("I have the answer!") + 42 + } + println("I can't wait that long, bye.") } catch { case e: Throwable if !e.isInstanceOf[scala.util.control.ControlThrowable] => e.printStackTrace() } - } + } } diff --git a/test/files/jvm/inner.scala b/test/files/jvm/inner.scala index d0d2226de6..156d9e69a8 100644 --- a/test/files/jvm/inner.scala +++ b/test/files/jvm/inner.scala @@ -14,7 +14,7 @@ class A { trait Itf { def method1(x: Int): Int - + trait Itf2 extends Itf { def method2: Unit } diff --git a/test/files/jvm/interpreter.check b/test/files/jvm/interpreter.check index ede74fb26f..607e2bcaff 100644 --- a/test/files/jvm/interpreter.check +++ b/test/files/jvm/interpreter.check @@ -73,7 +73,7 @@ fish: S = fish scala> // Test that arrays pretty print nicely. -scala> val arr = Array("What's", "up", "doc?") +scala> val arr = Array("What's", "up", "doc?") arr: Array[String] = Array(What's, up, doc?) scala> // Test that arrays pretty print nicely, even when we give them type Any @@ -338,10 +338,10 @@ You typed two blank lines. Starting a new command. scala> // defining and using quoted names should work (ticket #323) -scala> def `match` = 1 +scala> def `match` = 1 match: Int -scala> val x = `match` +scala> val x = `match` x: Int = 1 scala> diff --git a/test/files/jvm/interpreter.scala b/test/files/jvm/interpreter.scala index 752a129950..f0bc8b5818 100644 --- a/test/files/jvm/interpreter.scala +++ b/test/files/jvm/interpreter.scala @@ -29,7 +29,7 @@ val atom = new scala.xml.Atom() class S(override val toString : String) val fish = new S("fish") // Test that arrays pretty print nicely. -val arr = Array("What's", "up", "doc?") +val arr = Array("What's", "up", "doc?") // Test that arrays pretty print nicely, even when we give them type Any val arrInt : Any = Array(1,2,3) // Test that nested arrays are pretty-printed correctly @@ -132,8 +132,8 @@ there // defining and using quoted names should work (ticket #323) -def `match` = 1 -val x = `match` +def `match` = 1 +val x = `match` // multiple classes defined on one line sealed class Exp; class Fact extends Exp; class Term extends Exp @@ -153,6 +153,6 @@ def f(e: Exp) = e match {{ // non-exhaustive warning here interp.interpret("\"after reset\"") interp.interpret("plusOne(5) // should be undefined now") } - + appendix() } diff --git a/test/files/jvm/methvsfield.java b/test/files/jvm/methvsfield.java index dadc98669a..c1b2b87b48 100644 --- a/test/files/jvm/methvsfield.java +++ b/test/files/jvm/methvsfield.java @@ -1,11 +1,11 @@ // This should be compiled with javac and saved // in ../lib/methvsfield.jar . -class MethVsField +class MethVsField { int three = 3; - int three() - { + int three() + { return 3; } } diff --git a/test/files/jvm/natives.scala b/test/files/jvm/natives.scala index 14ee4e1c1b..ba868dc85e 100644 --- a/test/files/jvm/natives.scala +++ b/test/files/jvm/natives.scala @@ -1,16 +1,16 @@ object Test { //println("java.library.path=" + System.getProperty("java.library.path")) - + val sysWordSize = System.getProperty("sun.arch.data.model", "32") val sysType = System.getProperty("os.name") - + val libName = if (sysType == "Mac OS X") "natives" else "natives-" + sysWordSize - + System.loadLibrary(libName) @native diff --git a/test/files/jvm/protectedacc.scala b/test/files/jvm/protectedacc.scala index 89e70b90d8..f213e0da19 100644 --- a/test/files/jvm/protectedacc.scala +++ b/test/files/jvm/protectedacc.scala @@ -16,7 +16,7 @@ object Test { val ji = new p.b.JavaInteraction(Array('a', 'b', 'c')); (new ji.Inner).m; - + (new p.b.OuterObj.Inner).m } } @@ -36,13 +36,13 @@ package p { def getA: this.type = this; } - + /** Test type members */ trait HighlighterXXX { type Node; protected def highlight(node : Node) : Unit; } - + /** Test type parameters */ abstract class PolyA[a] { protected def m(x: a): Unit; @@ -119,22 +119,22 @@ package p { val inc = meth2(1)_; Console.println("100 = " + inc("10")); - + getA.x; } } } - + trait ScalaAutoEditXXX extends HighlighterXXX { - trait NodeImpl { + trait NodeImpl { def self : Node; highlight(self); } } - + abstract class X[T] extends PolyA[T] { - trait Inner extends B { + trait Inner extends B { def self: T; def self2: Node; def getB: Inner; diff --git a/test/files/jvm/serialization.scala b/test/files/jvm/serialization.scala index af842f3e78..9391b60e46 100644 --- a/test/files/jvm/serialization.scala +++ b/test/files/jvm/serialization.scala @@ -295,7 +295,7 @@ object Test3_mutable { ab1 ++= List("one", "two") val _ab1: ArrayBuffer[String] = read(write(ab1)) check(ab1, _ab1) - + // ArrayBuilder val abu1 = ArrayBuilder.make[Long] val _abu1: ArrayBuilder[ClassManifest[Long]] = read(write(abu1)) @@ -304,12 +304,12 @@ object Test3_mutable { val abu2 = ArrayBuilder.make[Float] val _abu2: ArrayBuilder[ClassManifest[Float]] = read(write(abu2)) check(abu2, _abu2) - + // ArraySeq val aq1 = ArraySeq(1, 2, 3) val _aq1: ArraySeq[Int] = read(write(aq1)) check(aq1, _aq1) - + // ArrayStack val as1 = new ArrayStack[Int] as1 ++= List(20, 2, 3).iterator @@ -537,7 +537,7 @@ class WithTransient extends Serializable { @transient private lazy val a2 = 2 @transient object B extends Serializable @transient private object C extends Serializable - + def test = { println(a1) println(a2) @@ -583,50 +583,50 @@ object Test { // Test classes in package "scala.collection.parallel" and subpackages object Test9_parallel { import scala.collection.parallel._ - + try { println() - + // UnrolledBuffer val ub = new collection.mutable.UnrolledBuffer[String] ub ++= List("one", "two") val _ub: collection.mutable.UnrolledBuffer[String] = read(write(ub)) check(ub, _ub) - + // mutable.ParArray val pa = mutable.ParArray("abc", "def", "etc") val _pa: mutable.ParArray[String] = read(write(pa)) check(pa, _pa) - + // mutable.ParHashMap val mpm = mutable.ParHashMap(1 -> 2, 2 -> 4) val _mpm: mutable.ParHashMap[Int, Int] = read(write(mpm)) check(mpm, _mpm) - + // mutable.ParHashSet val mps = mutable.ParHashSet(1, 2, 3) val _mps: mutable.ParHashSet[Int] = read(write(mps)) check(mps, _mps) - + // immutable.ParRange val pr1 = immutable.ParRange(0, 4, 1, true) val _pr1: immutable.ParRange = read(write(pr1)) check(pr1, _pr1) - + val pr2 = immutable.ParRange(0, 4, 1, false) val _pr2: immutable.ParRange = read(write(pr2)) check(pr2, _pr2) - + // immutable.ParHashMap val ipm = immutable.ParHashMap(5 -> 1, 10 -> 2) val _ipm: immutable.ParHashMap[Int, Int] = read(write(ipm)) check(ipm, _ipm) - + // immutable.ParHashSet val ips = immutable.ParHashSet("one", "two") val _ips: immutable.ParHashSet[String] = read(write(ips)) check(ips, _ips) - + } catch { case e: Exception => println("Error in Test5_parallel: " + e) diff --git a/test/files/jvm/t1461.scala b/test/files/jvm/t1461.scala index f0e3cea6cd..a963ec6a12 100644 --- a/test/files/jvm/t1461.scala +++ b/test/files/jvm/t1461.scala @@ -3,7 +3,7 @@ object Test { def main(args: Array[String]) { val jl = classOf[Foo].getMethod("jl", classOf[Baz[_]]) jl.getGenericParameterTypes // works fine - + val l = classOf[Foo].getMethod("l", classOf[Baz[_]]) // By debugger inspection l.signature is (Ltest/Baz<J>;)V l.getGenericParameterTypes // throws GenericSignatureFormatError diff --git a/test/files/jvm/t1464/MyTrait.scala b/test/files/jvm/t1464/MyTrait.scala index 0b8ccc412b..014ddf86c3 100644 --- a/test/files/jvm/t1464/MyTrait.scala +++ b/test/files/jvm/t1464/MyTrait.scala @@ -1,5 +1,5 @@ trait MyTrait { type K def findChildByClass[T <: K with MyTrait]: Unit - + } diff --git a/test/files/jvm/t1600.scala b/test/files/jvm/t1600.scala index 79391b7e76..7e23687425 100644 --- a/test/files/jvm/t1600.scala +++ b/test/files/jvm/t1600.scala @@ -4,23 +4,23 @@ * changes on deserialization. */ object Test { - + import collection._ def main(args: Array[String]) { for (i <- Seq(0, 1, 2, 10, 100)) { def entries = (0 until i).map(i => (new Foo, i)).toList def elements = entries.map(_._1) - + val maps = Seq[Map[Foo, Int]](new mutable.HashMap, new mutable.LinkedHashMap, immutable.HashMap.empty).map(_ ++ entries) test[Map[Foo, Int]](maps, entries.size, assertMap _) - + val sets = Seq[Set[Foo]](new mutable.HashSet, new mutable.LinkedHashSet, immutable.HashSet.empty).map(_ ++ elements) test[Set[Foo]](sets, entries.size, assertSet _) } } - + private def test[A <: AnyRef](collections: Seq[A], expectedSize: Int, assertFunction: (A, Int) => Unit) { for (collection <- collections) { assertFunction(collection, expectedSize) @@ -28,19 +28,19 @@ object Test { val bytes = toBytes(collection) Foo.hashCodeModifier = 1 val deserializedCollection = toObject[A](bytes) - + assertFunction(deserializedCollection, expectedSize) assert(deserializedCollection.getClass == collection.getClass, "collection class should remain the same after deserialization ("+deserializedCollection.getClass+" != "+collection.getClass+")") Foo.hashCodeModifier = 0 } } - + private def toObject[A](bytes: Array[Byte]): A = { val in = new java.io.ObjectInputStream(new java.io.ByteArrayInputStream(bytes)) in.readObject.asInstanceOf[A] } - + private def toBytes(o: AnyRef): Array[Byte] = { val bos = new java.io.ByteArrayOutputStream val out = new java.io.ObjectOutputStream(bos) @@ -48,7 +48,7 @@ object Test { out.close bos.toByteArray } - + private def assertMap[A, B](map: Map[A, B], expectedSize: Int) { assert(expectedSize == map.size, "expected map size: " + expectedSize + ", actual size: " + map.size) map.foreach { case (k, v) => @@ -56,19 +56,19 @@ object Test { assert(map(k) == v) } } - + private def assertSet[A](set: Set[A], expectedSize: Int) { assert(expectedSize == set.size, "expected set size: " + expectedSize + ", actual size: " + set.size) set.foreach { e => assert(set.contains(e), "contains should return true for element in the set, element: " + e) } } - + object Foo { - /* Used to simulate a hashCode change caused by deserializing an instance with an + /* Used to simulate a hashCode change caused by deserializing an instance with an * identity-based hashCode in another JVM. */ var hashCodeModifier = 0 } - + @serializable class Foo { override def hashCode = System.identityHashCode(this) + Foo.hashCodeModifier diff --git a/test/files/jvm/t2570/Test.scala b/test/files/jvm/t2570/Test.scala index d7b7632e22..7944aedae6 100644 --- a/test/files/jvm/t2570/Test.scala +++ b/test/files/jvm/t2570/Test.scala @@ -1,3 +1,3 @@ class Test2 extends Test1[Test3[Test4]] class Test4 -object Test extends Application {}
\ No newline at end of file +object Test extends Application {}
\ No newline at end of file diff --git a/test/files/jvm/t3003/Test_1.scala b/test/files/jvm/t3003/Test_1.scala index 8ec08bebc6..38af66a25a 100644 --- a/test/files/jvm/t3003/Test_1.scala +++ b/test/files/jvm/t3003/Test_1.scala @@ -9,7 +9,7 @@ object Test { . map(f => f.getAnnotations.toList) . filterNot (_.isEmpty) // there are extra fields under -Xcheckinit ) - + println(xs) } } diff --git a/test/files/jvm/t560bis.scala b/test/files/jvm/t560bis.scala index 13bf4b1ae0..b04303c8a0 100644 --- a/test/files/jvm/t560bis.scala +++ b/test/files/jvm/t560bis.scala @@ -5,14 +5,14 @@ import scala.xml._; case Seq(a,b,c,d @ _*) => Console.println("cool!") case _ => Console.println("bah") } - def foo(args: List[String]) = + 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) diff --git a/test/files/jvm/throws-annot.scala b/test/files/jvm/throws-annot.scala index 90b58b9976..b679b6c121 100644 --- a/test/files/jvm/throws-annot.scala +++ b/test/files/jvm/throws-annot.scala @@ -43,24 +43,24 @@ object TestThrows { /** Test the top-level mirror that is has the annotations. */ object TL { - + @throws(classOf[IOException]) def read(): Int = 0 - + @throws(classOf[ClassCastException]) @throws(classOf[IOException]) def readWith2(): Int = 0 - + @throws(classOf[IOException]) @Deprecated @throws(classOf[NullPointerException]) def readMixed(): Int = 0 - + @Deprecated @throws(classOf[IOException]) @throws(classOf[NullPointerException]) def readMixed2(): Int = 0 - + @Deprecated def readNoEx(): Int = 0 } diff --git a/test/files/jvm/typerep.scala b/test/files/jvm/typerep.scala index e56b63bafc..49a216c05c 100644 --- a/test/files/jvm/typerep.scala +++ b/test/files/jvm/typerep.scala @@ -109,7 +109,7 @@ object testFuncs { def f5(f: Int => Int, x: Int) = f(x) println(getType(f5 _)) println(getType(f5(f1, 1))) - println + println } class Foo { diff --git a/test/files/jvm/unittest_io_Jvm.check b/test/files/jvm/unittest_io_Jvm.check index bcfce8cbdb..d6e855f939 100644 --- a/test/files/jvm/unittest_io_Jvm.check +++ b/test/files/jvm/unittest_io_Jvm.check @@ -1,5 +1,5 @@ lines.size = 5 - + This is a file it is split on several lines. diff --git a/test/files/jvm/unittest_io_Jvm.scala b/test/files/jvm/unittest_io_Jvm.scala index 7c8ef131bc..1484774fb3 100644 --- a/test/files/jvm/unittest_io_Jvm.scala +++ b/test/files/jvm/unittest_io_Jvm.scala @@ -3,7 +3,7 @@ import scala.io.Source object Test { def main(args: Array[String]) { val lines = Source.fromString( - """| + """| |This is a file |it is split on several lines. | diff --git a/test/files/jvm/unittest_xml.scala b/test/files/jvm/unittest_xml.scala index 7163ce2d88..c03695f5c6 100644 --- a/test/files/jvm/unittest_xml.scala +++ b/test/files/jvm/unittest_xml.scala @@ -24,8 +24,8 @@ object Test { var x: MetaData = Null var s: NamespaceBinding = TopScope - // testing method def apply(uri:String, scp:NamespaceBinding, k:String): Seq[Node] - // def apply(k:String): Seq[Node] + // testing method def apply(uri:String, scp:NamespaceBinding, k:String): Seq[Node] + // def apply(k:String): Seq[Node] assert(null == x("za://foo.com", s, "bar" ), "absent element (prefixed) 1") assert(null == x("bar"), "absent element (unprefix) 1") @@ -53,8 +53,8 @@ object Test { val z = <foo bar="gar"/> val z2 = <foo/> - assert(Text("gar") == domatch(z), "attribute extractor 1") - assert(new Atom(3) == domatch(z2), "attribute extractor 2") + assert(Text("gar") == domatch(z), "attribute extractor 1") + assert(new Atom(3) == domatch(z2), "attribute extractor 2") } } diff --git a/test/files/jvm/varargs/JavaClass.java b/test/files/jvm/varargs/JavaClass.java index 9851e1b78b..536e9a38fb 100644 --- a/test/files/jvm/varargs/JavaClass.java +++ b/test/files/jvm/varargs/JavaClass.java @@ -4,7 +4,7 @@ public class JavaClass { public static <T> void varargz(int i, T... v) { } - + public static void callSomeAnnotations() { VaClass va = new VaClass(); va.vs(4, "", "", ""); diff --git a/test/files/jvm/varargs/VaClass.scala b/test/files/jvm/varargs/VaClass.scala index 6343f9c6f6..8e9cbdbb3f 100644 --- a/test/files/jvm/varargs/VaClass.scala +++ b/test/files/jvm/varargs/VaClass.scala @@ -5,9 +5,9 @@ import annotation.varargs class VaClass { - + @varargs def vs(a: Int, b: String*) = println(a + b.length) @varargs def vi(a: Int, b: Int*) = println(a + b.sum) @varargs def vt[T](a: Int, b: T*) = println(a + b.length) - + } diff --git a/test/files/jvm/xml01.scala b/test/files/jvm/xml01.scala index ef320e218b..2fab650637 100644 --- a/test/files/jvm/xml01.scala +++ b/test/files/jvm/xml01.scala @@ -16,7 +16,7 @@ object Test extends App { val c = new Node { def label = "hello" - override def hashCode() = + override def hashCode() = Utility.hashCode(prefix, label, attributes.hashCode(), scope.hashCode(), child); def child = Elem(null, "world", e, sc); //def attributes = e; @@ -35,8 +35,8 @@ object Test extends App { val x2p = XML.load(i) assert(x2p == Elem(null, "book" , e, sc, - Elem(null, "author", e, sc,Text("Peter Buneman")), - Elem(null, "author", e, sc,Text("Dan Suciu")), + Elem(null, "author", e, sc,Text("Peter Buneman")), + Elem(null, "author", e, sc,Text("Dan Suciu")), Elem(null, "title" , e, sc,Text("Data on ze web")))) val xmlFile2 = "<bib><book><author>Peter Buneman</author><author>Dan Suciu</author><title>Data on ze web</title></book><book><author>John Mitchell</author><title>Foundations of Programming Languages</title></book></bib>"; @@ -49,11 +49,11 @@ object Test extends App { assert(parsedxml1 \ "world" sameElements List(Elem(null,"world", e, sc))) - assert( + assert( (parsedxml2 \ "_") sameElements List( Elem(null,"book", e, sc, - Elem(null,"author", e, sc, Text("Peter Buneman")), - Elem(null,"author", e, sc, Text("Dan Suciu")), + Elem(null,"author", e, sc, Text("Peter Buneman")), + Elem(null,"author", e, sc, Text("Dan Suciu")), Elem(null,"title" , e, sc, Text("Data on ze web"))), Elem(null,"book",e,sc, Elem(null,"author",e,sc,Text("John Mitchell")), @@ -61,11 +61,11 @@ object Test extends App { ) assert((parsedxml2 \ "author").isEmpty) - assert( + assert( (parsedxml2 \ "book") sameElements List( Elem(null,"book",e,sc, - Elem(null,"author", e, sc, Text("Peter Buneman")), - Elem(null,"author", e, sc, Text("Dan Suciu")), + Elem(null,"author", e, sc, Text("Peter Buneman")), + Elem(null,"author", e, sc, Text("Dan Suciu")), Elem(null,"title" , e, sc, Text("Data on ze web"))), Elem(null,"book",e,sc, Elem(null,"author", e, sc, Text("John Mitchell")), @@ -73,20 +73,20 @@ object Test extends App { ) ) - assert( + assert( (parsedxml2 \ "_" \ "_") sameElements List( - Elem(null,"author", e, sc, Text("Peter Buneman")), - Elem(null,"author", e, sc, Text("Dan Suciu")), + Elem(null,"author", e, sc, Text("Peter Buneman")), + Elem(null,"author", e, sc, Text("Dan Suciu")), Elem(null,"title" , e, sc, Text("Data on ze web")), Elem(null,"author", e, sc, Text("John Mitchell")), Elem(null,"title" , e, sc, Text("Foundations of Programming Languages")) ) ) - assert( + assert( (parsedxml2 \ "_" \ "author") sameElements List( - Elem(null,"author", e, sc, Text("Peter Buneman")), - Elem(null,"author", e, sc, Text("Dan Suciu")), + Elem(null,"author", e, sc, Text("Peter Buneman")), + Elem(null,"author", e, sc, Text("Dan Suciu")), Elem(null,"author", e, sc, Text("John Mitchell")) ) ) @@ -95,15 +95,15 @@ object Test extends App { Console.println("xpath \\\\ DESCENDANTS"); - assert( + assert( (parsedxml2 \\ "author") sameElements List( - Elem(null,"author", e, sc, Text("Peter Buneman")), - Elem(null,"author", e, sc, Text("Dan Suciu")), + Elem(null,"author", e, sc, Text("Peter Buneman")), + Elem(null,"author", e, sc, Text("Dan Suciu")), Elem(null,"author", e, sc, Text("John Mitchell")) ) ) - assert( + assert( (parsedxml2 \\ "title") sameElements List( Elem(null,"title", e, sc, Text("Data on ze web")), Elem(null,"title", e, sc, Text("Foundations of Programming Languages"))) @@ -114,19 +114,19 @@ object Test extends App { (parsedxml2 \\ "book" ){ n:Node => (n \ "title") xml_== "Data on ze web" } ) - assert( + assert( ((new NodeSeq { val theSeq = List( parsedxml2 ) }) \\ "_") sameElements List( Elem(null,"bib",e,sc, Elem(null,"book",e,sc, - Elem(null, "author", e, sc, Text("Peter Buneman")), - Elem(null, "author", e, sc, Text("Dan Suciu")), + Elem(null, "author", e, sc, Text("Peter Buneman")), + Elem(null, "author", e, sc, Text("Dan Suciu")), Elem(null, "title" , e, sc, Text("Data on ze web"))), Elem(null,"book",e,sc, Elem(null,"author",e,sc,Text("John Mitchell")), Elem(null,"title",e,sc,Text("Foundations of Programming Languages")))), Elem(null,"book",e,sc, - Elem(null,"author",e,sc,Text("Peter Buneman")), - Elem(null,"author",e,sc,Text("Dan Suciu")), + Elem(null,"author",e,sc,Text("Peter Buneman")), + Elem(null,"author",e,sc,Text("Dan Suciu")), Elem(null,"title",e,sc,Text("Data on ze web"))), Elem(null,"author",e,sc,Text("Peter Buneman")), Elem(null,"author",e,sc,Text("Dan Suciu")), diff --git a/test/files/jvm/xml02.scala b/test/files/jvm/xml02.scala index fb790d5926..b830a0e694 100644 --- a/test/files/jvm/xml02.scala +++ b/test/files/jvm/xml02.scala @@ -36,26 +36,26 @@ object Test { val z = ax \ "@{the namespace from outer space}foo" assert((ax \ "@{the namespace from outer space}foo") xml_== "baz") assert((cx \ "@{the namespace from outer space}foo") xml_== "baz") - + try { ax \ "@" assert(false) } catch { - case _: IllegalArgumentException => + case _: IllegalArgumentException => } try { ax \ "@{" assert(false) } catch { - case _: IllegalArgumentException => + case _: IllegalArgumentException => } try { ax \ "@{}" assert(false) } catch { - case _: IllegalArgumentException => + case _: IllegalArgumentException => } - + } } diff --git a/test/files/jvm/xmlattr.scala b/test/files/jvm/xmlattr.scala index 2668819c9d..d214642eb6 100644 --- a/test/files/jvm/xmlattr.scala +++ b/test/files/jvm/xmlattr.scala @@ -7,7 +7,7 @@ object Test { AttributeWithOptionTest() AttributeOutputTest() } - + object UnprefixedAttributeTest { def apply() { val x = new UnprefixedAttribute("foo","bar", Null) @@ -15,13 +15,13 @@ object Test { println(Text("bar") == x("foo")) println(None == x.get("no_foo")) println(null == x("no_foo")) - + val y = x.remove("foo") println(Null == y) val z = new UnprefixedAttribute("foo", null:NodeSeq, x) println(None == z.get("foo")) - + var appended = x append x append x append x var len = 0; while (appended ne Null) { appended = appended.next diff --git a/test/files/jvm/xmlmore.scala b/test/files/jvm/xmlmore.scala index 1381cdf837..04d0a6c759 100644 --- a/test/files/jvm/xmlmore.scala +++ b/test/files/jvm/xmlmore.scala @@ -11,7 +11,7 @@ Ours is the portal of hope, come as you are." Mevlana Celaleddin Rumi]]> val nazim = <foo>{myBreak}</foo> // shows use of unparsed - + Console println com Console println pi Console println crz // this guy will escaped, and rightly so diff --git a/test/files/jvm/xmlpull.scala b/test/files/jvm/xmlpull.scala index d2bb72a071..9ba7d4cf02 100644 --- a/test/files/jvm/xmlpull.scala +++ b/test/files/jvm/xmlpull.scala @@ -5,7 +5,7 @@ import scala.io.Source object Test { val src = Source.fromString("<hello><world/>!</hello>") - + def main(args: Array[String]) { var er = new XMLEventReader(src) er.next match { @@ -28,4 +28,4 @@ object Test { //println("6") } } - + diff --git a/test/files/jvm/xmlstuff.scala b/test/files/jvm/xmlstuff.scala index f2ad0307b1..45234c7139 100644 --- a/test/files/jvm/xmlstuff.scala +++ b/test/files/jvm/xmlstuff.scala @@ -26,7 +26,7 @@ object Test { <baz bazValue="8"/> <bar value="5" gi='go'/> </foo>; - + val pelems_1 = for (x <- p \ "bar"; y <- p \ "baz" ) yield { Text(x.attributes("value").toString + y.attributes("bazValue").toString+ "!") }; @@ -35,14 +35,14 @@ object Test { assert(Text("8") sameElements (p \\ "@bazValue")) - val books = + val books = <bks> <book><title>Blabla</title></book> <book><title>Blubabla</title></book> <book><title>Baaaaaaalabla</title></book> </bks>; - val reviews = + val reviews = <reviews> <entry><title>Blabla</title> <remarks> @@ -72,32 +72,32 @@ object Test { )); // example - println( + println( for (t @ <book><title>Blabla</title></book> <- new NodeSeq { val theSeq = books.child }.toList) yield t ); - val phoneBook = + val phoneBook = <phonebook> <descr> - This is the <b>phonebook</b> of the + This is the <b>phonebook</b> of the <a href="http://acme.org">ACME</a> corporation. </descr> <entry> - <name>John</name> + <name>John</name> <phone where="work"> +41 21 693 68 67</phone> <phone where="mobile">+41 79 602 23 23</phone> </entry> </phonebook>; - val addrBook = + val addrBook = <addrbook> <descr> - This is the <b>addressbook</b> of the + This is the <b>addressbook</b> of the <a href="http://acme.org">ACME</a> corporation. </descr> <entry> - <name>John</name> + <name>John</name> <street> Elm Street</street> <city>Dolphin City</city> </entry> @@ -113,7 +113,7 @@ object Test { </result> )); - + /* namespaces */ // begin tmp println("namespaces") @@ -135,9 +135,9 @@ object Test { import scala.xml.dtd.ELEMENTS import scala.xml.dtd.ContentModel._ vtor.setContentModel( - ELEMENTS( + ELEMENTS( Sequ( - Letter(ElemName("bar")), + Letter(ElemName("bar")), Star(Letter(ElemName("baz"))) ))); } @@ -146,11 +146,11 @@ object Test { { import scala.xml.dtd.MIXED import scala.xml.dtd.ContentModel._ - + vtor.setContentModel( MIXED( - Alt(Letter(ElemName("bar")), - Letter(ElemName("baz")), + Alt(Letter(ElemName("bar")), + Letter(ElemName("baz")), Letter(ElemName("bal"))))); } @@ -162,20 +162,20 @@ object Test { vtor.setContentModel(null) vtor.setMetaData(List()) assert(!vtor( <foo bar="hello"/> )) - - { - import scala.xml.dtd._ + + { + import scala.xml.dtd._ vtor setMetaData List(AttrDecl("bar", "CDATA", IMPLIED)) } assert(!vtor(<foo href="http://foo.com" bar="hello"/>)) assert(vtor(<foo bar="hello"/>)) - { + { import scala.xml.dtd._ vtor.setMetaData(List(AttrDecl("bar","CDATA",REQUIRED))) } assert(!vtor( <foo href="http://foo.com" /> )) assert( vtor( <foo bar="http://foo.com" /> )) - + } } |