summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAdriaan Moors <adriaan.moors@typesafe.com>2014-02-14 13:23:44 -0800
committerAdriaan Moors <adriaan.moors@typesafe.com>2014-02-14 13:23:44 -0800
commitd62ceb88278bbe8317e8dcce6fb8515cae64e2b1 (patch)
tree9ebf30b69000bd659452a79fc1d36e2876455dfc /test
parentd227a89363886635969f4a7725303c6b65b0914b (diff)
parentd3a302b022adc5eaeb1fcbdffaffd5fd438726e0 (diff)
downloadscala-d62ceb88278bbe8317e8dcce6fb8515cae64e2b1.tar.gz
scala-d62ceb88278bbe8317e8dcce6fb8515cae64e2b1.tar.bz2
scala-d62ceb88278bbe8317e8dcce6fb8515cae64e2b1.zip
Merge pull request #3530 from Ichoran/issue/6632
SI-6632 ListBuffer's updated accepts negative positions
Diffstat (limited to 'test')
-rw-r--r--test/files/run/t6632.check2
-rw-r--r--test/files/run/t6632.scala29
2 files changed, 13 insertions, 18 deletions
diff --git a/test/files/run/t6632.check b/test/files/run/t6632.check
index 1f084b1dac..26cf061b5f 100644
--- a/test/files/run/t6632.check
+++ b/test/files/run/t6632.check
@@ -1,3 +1,5 @@
java.lang.IndexOutOfBoundsException: -1
java.lang.IndexOutOfBoundsException: -2
java.lang.IndexOutOfBoundsException: -3
+java.lang.IndexOutOfBoundsException: -1
+java.lang.IndexOutOfBoundsException: 5
diff --git a/test/files/run/t6632.scala b/test/files/run/t6632.scala
index 0242e60104..f338b73fa6 100644
--- a/test/files/run/t6632.scala
+++ b/test/files/run/t6632.scala
@@ -3,27 +3,20 @@ object Test extends App {
def newLB = ListBuffer('a, 'b, 'c, 'd, 'e)
- val lb0 = newLB
+ def iiobe[A](f: => A) =
+ try { f }
+ catch { case ex: IndexOutOfBoundsException => println(ex) }
- try {
- lb0.insert(-1, 'x)
- } catch {
- case ex: IndexOutOfBoundsException => println(ex)
- }
+ val lb0 = newLB
+ iiobe( lb0.insert(-1, 'x) )
val lb1 = newLB
-
- try {
- lb1.insertAll(-2, Array('x, 'y, 'z))
- } catch {
- case ex: IndexOutOfBoundsException => println(ex)
- }
+ iiobe( lb1.insertAll(-2, Array('x, 'y, 'z)) )
val lb2 = newLB
+ iiobe( lb2.update(-3, 'u) )
- try {
- lb2.update(-3, 'u)
- } catch {
- case ex: IndexOutOfBoundsException => println(ex)
- }
-} \ No newline at end of file
+ val lb3 = newLB
+ iiobe( lb3.updated(-1, 'u) )
+ iiobe( lb3.updated(5, 'u) )
+}