summaryrefslogtreecommitdiff
path: root/test/files/run/t6292.scala
diff options
context:
space:
mode:
authorJosh Suereth <joshua.suereth@gmail.com>2012-08-29 15:50:13 -0400
committerJosh Suereth <joshua.suereth@gmail.com>2012-08-29 15:50:13 -0400
commitdb94e06b1c11b9afdc0fd9a18e456e0774fabd80 (patch)
tree27d5e5fcb76d746e4889a2051ec569bba5cd2eaa /test/files/run/t6292.scala
parente03a5b766be27a1f43c9151a611b04519a2b15df (diff)
downloadscala-db94e06b1c11b9afdc0fd9a18e456e0774fabd80.tar.gz
scala-db94e06b1c11b9afdc0fd9a18e456e0774fabd80.tar.bz2
scala-db94e06b1c11b9afdc0fd9a18e456e0774fabd80.zip
Fixed cloning a double-linked list.
Still need to determine if this is a systemic issue and needs to be addressed higher in the linked list hierarchy. For now, just fixing the reported bug, with a note here for other maintainers.
Diffstat (limited to 'test/files/run/t6292.scala')
-rw-r--r--test/files/run/t6292.scala18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/files/run/t6292.scala b/test/files/run/t6292.scala
new file mode 100644
index 0000000000..51e31f95fc
--- /dev/null
+++ b/test/files/run/t6292.scala
@@ -0,0 +1,18 @@
+ import scala.collection.mutable.DoubleLinkedList
+
+object Test {
+ def main(args: Array[String]): Unit = {
+ cloneAndtest(DoubleLinkedList[Int]())
+ cloneAndtest(DoubleLinkedList[Int](1))
+ cloneAndtest(DoubleLinkedList[Int](1,2,3,4))
+ }
+
+ def cloneAndtest(l: DoubleLinkedList[Int]): Unit =
+ testSame(l, l.clone.asInstanceOf[DoubleLinkedList[Int]])
+
+ def testSame(one: DoubleLinkedList[Int], two: DoubleLinkedList[Int]): Unit = {
+ def msg = s" for ${one} and ${two} !"
+ assert(one.size == two.size, s"Cloned sizes are not the same $msg!")
+ assert(one == two, s"Cloned lists are not equal $msg")
+ }
+}