From fb87f2de763e558c8639905ea8dfb447b5212cf7 Mon Sep 17 00:00:00 2001 From: Paul Phillips Date: Sat, 3 Mar 2012 15:06:02 -0800 Subject: Test case closes SI-4777. And pending tests for most of the other VerifyErrors which still fail to verify. --- test/files/run/si4147.scala | 36 --------------------- test/files/run/si5171.check | 1 - test/files/run/si5171.scala | 7 ----- test/files/run/si5262.check | 2 -- test/files/run/si5262.scala | 26 ---------------- test/files/run/si5374.check | 6 ---- test/files/run/si5374.scala | 76 --------------------------------------------- test/files/run/si5375.check | 1 - test/files/run/si5375.scala | 19 ------------ test/files/run/si5380.scala | 6 ---- test/files/run/t4147.scala | 36 +++++++++++++++++++++ test/files/run/t4777.check | 2 ++ test/files/run/t4777.scala | 8 +++++ test/files/run/t5171.check | 1 + test/files/run/t5171.scala | 7 +++++ test/files/run/t5262.check | 2 ++ test/files/run/t5262.scala | 26 ++++++++++++++++ test/files/run/t5374.check | 6 ++++ test/files/run/t5374.scala | 76 +++++++++++++++++++++++++++++++++++++++++++++ test/files/run/t5375.check | 1 + test/files/run/t5375.scala | 19 ++++++++++++ test/files/run/t5380.scala | 6 ++++ 22 files changed, 190 insertions(+), 180 deletions(-) delete mode 100644 test/files/run/si4147.scala delete mode 100644 test/files/run/si5171.check delete mode 100644 test/files/run/si5171.scala delete mode 100644 test/files/run/si5262.check delete mode 100644 test/files/run/si5262.scala delete mode 100644 test/files/run/si5374.check delete mode 100644 test/files/run/si5374.scala delete mode 100644 test/files/run/si5375.check delete mode 100644 test/files/run/si5375.scala delete mode 100644 test/files/run/si5380.scala create mode 100644 test/files/run/t4147.scala create mode 100644 test/files/run/t4777.check create mode 100644 test/files/run/t4777.scala create mode 100644 test/files/run/t5171.check create mode 100644 test/files/run/t5171.scala create mode 100644 test/files/run/t5262.check create mode 100644 test/files/run/t5262.scala create mode 100644 test/files/run/t5374.check create mode 100644 test/files/run/t5374.scala create mode 100644 test/files/run/t5375.check create mode 100644 test/files/run/t5375.scala create mode 100644 test/files/run/t5380.scala (limited to 'test/files') diff --git a/test/files/run/si4147.scala b/test/files/run/si4147.scala deleted file mode 100644 index c1e2d746a9..0000000000 --- a/test/files/run/si4147.scala +++ /dev/null @@ -1,36 +0,0 @@ - - - -import scala.collection._ - - - -object Test { - - def main(args: Array[String]) { - checkElementsAreSorted() - checkRangedImpl() - } - - def checkElementsAreSorted() { - val tree = mutable.SortedSet[Int]() - tree ++= List(4, 3, 1, 6, 7, 5, 2) - assert(tree == immutable.SortedSet(1, 2, 3, 4, 5, 6, 7)) - assert(tree.size == 7) - } - - def checkRangedImpl() { - val tree = mutable.SortedSet[Int](3, 1, 6, 7, 5, 2) - val projection = tree.rangeImpl(Some(3), Some(6)) - assert(projection == immutable.SortedSet(3, 5)) - assert(projection.size == 2) - - // Let's check that modification are taken into account - tree add 4 - assert(tree == immutable.SortedSet(1, 2, 3, 4, 5, 6, 7)) - assert(projection == immutable.SortedSet(3, 4, 5)) - assert(tree.size == 7) - assert(projection.size == 3) - } - -} diff --git a/test/files/run/si5171.check b/test/files/run/si5171.check deleted file mode 100644 index 159606d35c..0000000000 --- a/test/files/run/si5171.check +++ /dev/null @@ -1 +0,0 @@ -IsList diff --git a/test/files/run/si5171.scala b/test/files/run/si5171.scala deleted file mode 100644 index eb8029df80..0000000000 --- a/test/files/run/si5171.scala +++ /dev/null @@ -1,7 +0,0 @@ -abstract sealed class ArgNumber -case object IsList extends ArgNumber -case object ArgNumber - -object Test extends App { - println(IsList) -} diff --git a/test/files/run/si5262.check b/test/files/run/si5262.check deleted file mode 100644 index 4c7a875de5..0000000000 --- a/test/files/run/si5262.check +++ /dev/null @@ -1,2 +0,0 @@ -List(1, 2, 3, 4) -List(1, 2, null, 4) \ No newline at end of file diff --git a/test/files/run/si5262.scala b/test/files/run/si5262.scala deleted file mode 100644 index fc4e57aa96..0000000000 --- a/test/files/run/si5262.scala +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - -object Test { - - def serializationDeserialization(obj : Any) { - val bos = new java.io.ByteArrayOutputStream() - val out = new java.io.ObjectOutputStream(bos) - out.writeObject(obj) - - val arr = bos.toByteArray() - val in = new java.io.ObjectInputStream(new java.io.ByteArrayInputStream(arr)) - val o = in.readObject() - println(o) - } - - def main(args : Array[String]) { - serializationDeserialization(List(1,2,3,4)) - serializationDeserialization(List(1,2,null,4)) - } - -} diff --git a/test/files/run/si5374.check b/test/files/run/si5374.check deleted file mode 100644 index 6be88d77ec..0000000000 --- a/test/files/run/si5374.check +++ /dev/null @@ -1,6 +0,0 @@ -ListBuffer(1, 2, 3, 1) -ListBuffer(1, 2, 3, 1) -ListBuffer() -List(1, 2, 3, 4, 5) -List(1, 2, 3) -ok \ No newline at end of file diff --git a/test/files/run/si5374.scala b/test/files/run/si5374.scala deleted file mode 100644 index 9b1671e795..0000000000 --- a/test/files/run/si5374.scala +++ /dev/null @@ -1,76 +0,0 @@ - - - -import collection.mutable.ListBuffer -import java.io._ - - - -object Test { - - def main(args: Array[String]) { - ticketExample() - emptyListBuffer() - list() - legacyList() - objectWithMultipleLists() - } - - def inAndOut[T <: AnyRef](obj: T): T = { - val baos = new ByteArrayOutputStream - val oos = new ObjectOutputStream(baos) - oos.writeObject( obj ) - val bais = new ByteArrayInputStream( baos.toByteArray ) - val ois = new ObjectInputStream(bais) - ois.readObject.asInstanceOf[T] - } - - def ticketExample() { - val lb = inAndOut(ListBuffer(1, 2, 3)) - val lb2 = ListBuffer[Int]() ++= lb - - lb2 ++= List(1) - lb ++= List(1) - println(lb) - println(lb2) - } - - def emptyListBuffer() { - val lb = inAndOut(ListBuffer[Int]()) - - println(lb) - } - - def list() { - val l = inAndOut(List(1, 2, 3, 4, 5)) - - println(l) - } - - // this byte array corresponds to what List(1, 2, 3) used to be serialized to prior to this fix - val listBytes = Array[Byte](-84, -19, 0, 5, 115, 114, 0, 39, 115, 99, 97, 108, 97, 46, 99, 111, 108, 108, 101, 99, 116, 105, 111, 110, 46, 105, 109, 109, 117, 116, 97, 98, 108, 101, 46, 36, 99, 111, 108, 111, 110, 36, 99, 111, 108, 111, 110, -118, 92, 99, 91, -10, -40, -7, 109, 3, 0, 2, 76, 0, 43, 115, 99, 97, 108, 97, 36, 99, 111, 108, 108, 101, 99, 116, 105, 111, 110, 36, 105, 109, 109, 117, 116, 97, 98, 108, 101, 36, 36, 99, 111, 108, 111, 110, 36, 99, 111, 108, 111, 110, 36, 36, 104, 100, 116, 0, 18, 76, 106, 97, 118, 97, 47, 108, 97, 110, 103, 47, 79, 98, 106, 101, 99, 116, 59, 76, 0, 2, 116, 108, 116, 0, 33, 76, 115, 99, 97, 108, 97, 47, 99, 111, 108, 108, 101, 99, 116, 105, 111, 110, 47, 105, 109, 109, 117, 116, 97, 98, 108, 101, 47, 76, 105, 115, 116, 59, 120, 112, 115, 114, 0, 17, 106, 97, 118, 97, 46, 108, 97, 110, 103, 46, 73, 110, 116, 101, 103, 101, 114, 18, -30, -96, -92, -9, -127, -121, 56, 2, 0, 1, 73, 0, 5, 118, 97, 108, 117, 101, 120, 114, 0, 16, 106, 97, 118, 97, 46, 108, 97, 110, 103, 46, 78, 117, 109, 98, 101, 114, -122, -84, -107, 29, 11, -108, -32, -117, 2, 0, 0, 120, 112, 0, 0, 0, 1, 115, 113, 0, 126, 0, 4, 0, 0, 0, 2, 115, 113, 0, 126, 0, 4, 0, 0, 0, 3, 115, 114, 0, 44, 115, 99, 97, 108, 97, 46, 99, 111, 108, 108, 101, 99, 116, 105, 111, 110, 46, 105, 109, 109, 117, 116, 97, 98, 108, 101, 46, 76, 105, 115, 116, 83, 101, 114, 105, 97, 108, 105, 122, 101, 69, 110, 100, 36, -118, 92, 99, 91, -9, 83, 11, 109, 2, 0, 0, 120, 112, 120) - - def legacyList() { - val bais = new ByteArrayInputStream(listBytes) - val ois = new ObjectInputStream(bais) - val l = ois.readObject() - - println(l) - } - - class Foo extends Serializable { - val head = List(1, 2, 3) - val last = head.tail.tail - def structuralSharing: Boolean = head.tail.tail eq last - - assert(structuralSharing) - } - - def objectWithMultipleLists() { - val foo = inAndOut(new Foo) - - if (foo.structuralSharing) println("ok") - else println("no structural sharing") - } - -} diff --git a/test/files/run/si5375.check b/test/files/run/si5375.check deleted file mode 100644 index 7d3002ffda..0000000000 --- a/test/files/run/si5375.check +++ /dev/null @@ -1 +0,0 @@ -Composite throwable \ No newline at end of file diff --git a/test/files/run/si5375.scala b/test/files/run/si5375.scala deleted file mode 100644 index e4b329deae..0000000000 --- a/test/files/run/si5375.scala +++ /dev/null @@ -1,19 +0,0 @@ - - - -import collection.parallel.CompositeThrowable - - - -object Test { - - def main(args: Array[String]) { - val foos = (1 to 1000) toSeq; - try { - foos.par.map(i => if (i % 37 == 0) sys.error("i div 37") else i) - } catch { - case CompositeThrowable(thr) => println("Composite throwable") - } - } - -} diff --git a/test/files/run/si5380.scala b/test/files/run/si5380.scala deleted file mode 100644 index 6083161a9b..0000000000 --- a/test/files/run/si5380.scala +++ /dev/null @@ -1,6 +0,0 @@ -object Test { - def main(args: Array[String]) { - val f = () => return try { 1 } catch { case _ => 0 } - f() - } -} diff --git a/test/files/run/t4147.scala b/test/files/run/t4147.scala new file mode 100644 index 0000000000..c1e2d746a9 --- /dev/null +++ b/test/files/run/t4147.scala @@ -0,0 +1,36 @@ + + + +import scala.collection._ + + + +object Test { + + def main(args: Array[String]) { + checkElementsAreSorted() + checkRangedImpl() + } + + def checkElementsAreSorted() { + val tree = mutable.SortedSet[Int]() + tree ++= List(4, 3, 1, 6, 7, 5, 2) + assert(tree == immutable.SortedSet(1, 2, 3, 4, 5, 6, 7)) + assert(tree.size == 7) + } + + def checkRangedImpl() { + val tree = mutable.SortedSet[Int](3, 1, 6, 7, 5, 2) + val projection = tree.rangeImpl(Some(3), Some(6)) + assert(projection == immutable.SortedSet(3, 5)) + assert(projection.size == 2) + + // Let's check that modification are taken into account + tree add 4 + assert(tree == immutable.SortedSet(1, 2, 3, 4, 5, 6, 7)) + assert(projection == immutable.SortedSet(3, 4, 5)) + assert(tree.size == 7) + assert(projection.size == 3) + } + +} diff --git a/test/files/run/t4777.check b/test/files/run/t4777.check new file mode 100644 index 0000000000..11f1f59d43 --- /dev/null +++ b/test/files/run/t4777.check @@ -0,0 +1,2 @@ +28 +28 diff --git a/test/files/run/t4777.scala b/test/files/run/t4777.scala new file mode 100644 index 0000000000..4a811d3b9a --- /dev/null +++ b/test/files/run/t4777.scala @@ -0,0 +1,8 @@ +class A(val a: Int = 13) +class DefaultsTest(x: Int = 25) extends A(28) +object DefaultsTest extends DefaultsTest(12) + +object Test extends App { + println(new DefaultsTest() a) + println(DefaultsTest a) +} diff --git a/test/files/run/t5171.check b/test/files/run/t5171.check new file mode 100644 index 0000000000..159606d35c --- /dev/null +++ b/test/files/run/t5171.check @@ -0,0 +1 @@ +IsList diff --git a/test/files/run/t5171.scala b/test/files/run/t5171.scala new file mode 100644 index 0000000000..eb8029df80 --- /dev/null +++ b/test/files/run/t5171.scala @@ -0,0 +1,7 @@ +abstract sealed class ArgNumber +case object IsList extends ArgNumber +case object ArgNumber + +object Test extends App { + println(IsList) +} diff --git a/test/files/run/t5262.check b/test/files/run/t5262.check new file mode 100644 index 0000000000..4c7a875de5 --- /dev/null +++ b/test/files/run/t5262.check @@ -0,0 +1,2 @@ +List(1, 2, 3, 4) +List(1, 2, null, 4) \ No newline at end of file diff --git a/test/files/run/t5262.scala b/test/files/run/t5262.scala new file mode 100644 index 0000000000..fc4e57aa96 --- /dev/null +++ b/test/files/run/t5262.scala @@ -0,0 +1,26 @@ + + + + + + + +object Test { + + def serializationDeserialization(obj : Any) { + val bos = new java.io.ByteArrayOutputStream() + val out = new java.io.ObjectOutputStream(bos) + out.writeObject(obj) + + val arr = bos.toByteArray() + val in = new java.io.ObjectInputStream(new java.io.ByteArrayInputStream(arr)) + val o = in.readObject() + println(o) + } + + def main(args : Array[String]) { + serializationDeserialization(List(1,2,3,4)) + serializationDeserialization(List(1,2,null,4)) + } + +} diff --git a/test/files/run/t5374.check b/test/files/run/t5374.check new file mode 100644 index 0000000000..6be88d77ec --- /dev/null +++ b/test/files/run/t5374.check @@ -0,0 +1,6 @@ +ListBuffer(1, 2, 3, 1) +ListBuffer(1, 2, 3, 1) +ListBuffer() +List(1, 2, 3, 4, 5) +List(1, 2, 3) +ok \ No newline at end of file diff --git a/test/files/run/t5374.scala b/test/files/run/t5374.scala new file mode 100644 index 0000000000..9b1671e795 --- /dev/null +++ b/test/files/run/t5374.scala @@ -0,0 +1,76 @@ + + + +import collection.mutable.ListBuffer +import java.io._ + + + +object Test { + + def main(args: Array[String]) { + ticketExample() + emptyListBuffer() + list() + legacyList() + objectWithMultipleLists() + } + + def inAndOut[T <: AnyRef](obj: T): T = { + val baos = new ByteArrayOutputStream + val oos = new ObjectOutputStream(baos) + oos.writeObject( obj ) + val bais = new ByteArrayInputStream( baos.toByteArray ) + val ois = new ObjectInputStream(bais) + ois.readObject.asInstanceOf[T] + } + + def ticketExample() { + val lb = inAndOut(ListBuffer(1, 2, 3)) + val lb2 = ListBuffer[Int]() ++= lb + + lb2 ++= List(1) + lb ++= List(1) + println(lb) + println(lb2) + } + + def emptyListBuffer() { + val lb = inAndOut(ListBuffer[Int]()) + + println(lb) + } + + def list() { + val l = inAndOut(List(1, 2, 3, 4, 5)) + + println(l) + } + + // this byte array corresponds to what List(1, 2, 3) used to be serialized to prior to this fix + val listBytes = Array[Byte](-84, -19, 0, 5, 115, 114, 0, 39, 115, 99, 97, 108, 97, 46, 99, 111, 108, 108, 101, 99, 116, 105, 111, 110, 46, 105, 109, 109, 117, 116, 97, 98, 108, 101, 46, 36, 99, 111, 108, 111, 110, 36, 99, 111, 108, 111, 110, -118, 92, 99, 91, -10, -40, -7, 109, 3, 0, 2, 76, 0, 43, 115, 99, 97, 108, 97, 36, 99, 111, 108, 108, 101, 99, 116, 105, 111, 110, 36, 105, 109, 109, 117, 116, 97, 98, 108, 101, 36, 36, 99, 111, 108, 111, 110, 36, 99, 111, 108, 111, 110, 36, 36, 104, 100, 116, 0, 18, 76, 106, 97, 118, 97, 47, 108, 97, 110, 103, 47, 79, 98, 106, 101, 99, 116, 59, 76, 0, 2, 116, 108, 116, 0, 33, 76, 115, 99, 97, 108, 97, 47, 99, 111, 108, 108, 101, 99, 116, 105, 111, 110, 47, 105, 109, 109, 117, 116, 97, 98, 108, 101, 47, 76, 105, 115, 116, 59, 120, 112, 115, 114, 0, 17, 106, 97, 118, 97, 46, 108, 97, 110, 103, 46, 73, 110, 116, 101, 103, 101, 114, 18, -30, -96, -92, -9, -127, -121, 56, 2, 0, 1, 73, 0, 5, 118, 97, 108, 117, 101, 120, 114, 0, 16, 106, 97, 118, 97, 46, 108, 97, 110, 103, 46, 78, 117, 109, 98, 101, 114, -122, -84, -107, 29, 11, -108, -32, -117, 2, 0, 0, 120, 112, 0, 0, 0, 1, 115, 113, 0, 126, 0, 4, 0, 0, 0, 2, 115, 113, 0, 126, 0, 4, 0, 0, 0, 3, 115, 114, 0, 44, 115, 99, 97, 108, 97, 46, 99, 111, 108, 108, 101, 99, 116, 105, 111, 110, 46, 105, 109, 109, 117, 116, 97, 98, 108, 101, 46, 76, 105, 115, 116, 83, 101, 114, 105, 97, 108, 105, 122, 101, 69, 110, 100, 36, -118, 92, 99, 91, -9, 83, 11, 109, 2, 0, 0, 120, 112, 120) + + def legacyList() { + val bais = new ByteArrayInputStream(listBytes) + val ois = new ObjectInputStream(bais) + val l = ois.readObject() + + println(l) + } + + class Foo extends Serializable { + val head = List(1, 2, 3) + val last = head.tail.tail + def structuralSharing: Boolean = head.tail.tail eq last + + assert(structuralSharing) + } + + def objectWithMultipleLists() { + val foo = inAndOut(new Foo) + + if (foo.structuralSharing) println("ok") + else println("no structural sharing") + } + +} diff --git a/test/files/run/t5375.check b/test/files/run/t5375.check new file mode 100644 index 0000000000..7d3002ffda --- /dev/null +++ b/test/files/run/t5375.check @@ -0,0 +1 @@ +Composite throwable \ No newline at end of file diff --git a/test/files/run/t5375.scala b/test/files/run/t5375.scala new file mode 100644 index 0000000000..e4b329deae --- /dev/null +++ b/test/files/run/t5375.scala @@ -0,0 +1,19 @@ + + + +import collection.parallel.CompositeThrowable + + + +object Test { + + def main(args: Array[String]) { + val foos = (1 to 1000) toSeq; + try { + foos.par.map(i => if (i % 37 == 0) sys.error("i div 37") else i) + } catch { + case CompositeThrowable(thr) => println("Composite throwable") + } + } + +} diff --git a/test/files/run/t5380.scala b/test/files/run/t5380.scala new file mode 100644 index 0000000000..6083161a9b --- /dev/null +++ b/test/files/run/t5380.scala @@ -0,0 +1,6 @@ +object Test { + def main(args: Array[String]) { + val f = () => return try { 1 } catch { case _ => 0 } + f() + } +} -- cgit v1.2.3