diff options
author | Josh Suereth <Joshua.Suereth@gmail.com> | 2012-11-20 17:54:28 -0800 |
---|---|---|
committer | Josh Suereth <Joshua.Suereth@gmail.com> | 2012-11-20 17:54:28 -0800 |
commit | 522ef796c8466d24fe7068af0bd1c8989b29b392 (patch) | |
tree | 2188f2e8f982a3aa2f1cdfcd1d64e0c7a62d6ded /test/files | |
parent | 249b3c43a125542d1c981b32626fa77ae6f0d773 (diff) | |
parent | 925c6e34635a9a8621b20c328670cbd23975327f (diff) | |
download | scala-522ef796c8466d24fe7068af0bd1c8989b29b392.tar.gz scala-522ef796c8466d24fe7068af0bd1c8989b29b392.tar.bz2 scala-522ef796c8466d24fe7068af0bd1c8989b29b392.zip |
Merge pull request #1596 from soc/SI-6632+SI-6633
SI-6632 SI-6633 Fixes issues and data corruption in ListBuffer
Diffstat (limited to 'test/files')
-rw-r--r-- | test/files/run/t6632.check | 3 | ||||
-rw-r--r-- | test/files/run/t6632.scala | 29 | ||||
-rw-r--r-- | test/files/run/t6633.check | 3 | ||||
-rw-r--r-- | test/files/run/t6633.scala | 33 |
4 files changed, 68 insertions, 0 deletions
diff --git a/test/files/run/t6632.check b/test/files/run/t6632.check new file mode 100644 index 0000000000..1f084b1dac --- /dev/null +++ b/test/files/run/t6632.check @@ -0,0 +1,3 @@ +java.lang.IndexOutOfBoundsException: -1 +java.lang.IndexOutOfBoundsException: -2 +java.lang.IndexOutOfBoundsException: -3 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 diff --git a/test/files/run/t6633.check b/test/files/run/t6633.check new file mode 100644 index 0000000000..1ff8cdbc44 --- /dev/null +++ b/test/files/run/t6633.check @@ -0,0 +1,3 @@ +java.lang.IndexOutOfBoundsException: 9 +replStringOf OK +length OK 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 |