summaryrefslogtreecommitdiff
path: root/test/files/run/t6632.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/t6632.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/t6632.scala')
-rw-r--r--test/files/run/t6632.scala29
1 files changed, 29 insertions, 0 deletions
diff --git a/test/files/run/t6632.scala b/test/files/run/t6632.scala
new file mode 100644
index 0000000000..c1c8d4abe0
--- /dev/null
+++ b/test/files/run/t6632.scala
@@ -0,0 +1,29 @@
+object Test extends App {
+ import collection.mutable.ListBuffer
+
+ def newLB = ListBuffer('a, 'b, 'c, 'd, 'e)
+
+ val lb0 = newLB
+
+ try {
+ lb0.insert(-1, 'x)
+ } catch {
+ case ex: IndexOutOfBoundsException => println(ex)
+ }
+
+ val lb1 = newLB
+
+ try {
+ lb1.insertAll(-2, Array('x, 'y, 'z))
+ } catch {
+ case ex: IndexOutOfBoundsException => println(ex)
+ }
+
+ val lb2 = newLB
+
+ try {
+ lb2.update(-3, 'u)
+ } catch {
+ case ex: IndexOutOfBoundsException => println(ex)
+ }
+} \ No newline at end of file