summaryrefslogtreecommitdiff
path: root/test/files/run/t6633.scala
diff options
context:
space:
mode:
authorSimon Ochsenreither <simon@ochsenreither.de>2012-11-09 03:18:33 +0100
committerSimon Ochsenreither <simon@ochsenreither.de>2012-11-09 21:44:22 +0100
commit925c6e34635a9a8621b20c328670cbd23975327f (patch)
treec3340b8d75c2be2fa2dd3970e062c9694f30aa95 /test/files/run/t6633.scala
parent3b68b45a200087104a1ac2de7c4b86635023fd4d (diff)
downloadscala-925c6e34635a9a8621b20c328670cbd23975327f.tar.gz
scala-925c6e34635a9a8621b20c328670cbd23975327f.tar.bz2
scala-925c6e34635a9a8621b20c328670cbd23975327f.zip
SI-6632 SI-6633 Fixes issues and data corruption in ListBuffer
- Disallow negative positions for ListBuffer#insert/insertAll/update - Fix data corruption issue in ListBuffer#insert
Diffstat (limited to 'test/files/run/t6633.scala')
-rw-r--r--test/files/run/t6633.scala33
1 files changed, 33 insertions, 0 deletions
diff --git a/test/files/run/t6633.scala b/test/files/run/t6633.scala
new file mode 100644
index 0000000000..bd993c8d88
--- /dev/null
+++ b/test/files/run/t6633.scala
@@ -0,0 +1,33 @@
+object Test extends App {
+ import collection.mutable.ListBuffer
+
+ def newLB = ListBuffer('a, 'b, 'c, 'd, 'e)
+
+ val lb0 = newLB
+
+ try {
+ lb0.insert(9, 'x)
+ } catch {
+ case ex: IndexOutOfBoundsException => println(ex)
+ }
+
+ val lb1 = newLB
+
+ try {
+ lb1.insert(9, 'x)
+ } catch {
+ case ex: IndexOutOfBoundsException =>
+ }
+
+ val replStr = scala.runtime.ScalaRunTime.replStringOf(lb1, 100)
+ if (replStr == "ListBuffer('a, 'b, 'c, 'd, 'e)\n")
+ println("replStringOf OK")
+ else
+ println("replStringOf FAILED: " + replStr)
+
+ val len = lb1.length
+ if (len == 5)
+ println("length OK")
+ else
+ println("length FAILED: " + len)
+} \ No newline at end of file