summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2013-01-04 12:08:32 -0800
committerPaul Phillips <paulp@improving.org>2013-01-04 12:08:32 -0800
commit54aca491463f25985d45aeb823d2cddda54b6a44 (patch)
tree064e96da0b40876fdab603e1da478969e3fd579f /test
parente112ac94d04be7ee715ebf8724709123b0f3e1f6 (diff)
parent02b2da63409af6a28824cbb74d00d0ec04518c8d (diff)
downloadscala-54aca491463f25985d45aeb823d2cddda54b6a44.tar.gz
scala-54aca491463f25985d45aeb823d2cddda54b6a44.tar.bz2
scala-54aca491463f25985d45aeb823d2cddda54b6a44.zip
Merge pull request #1739 from jedesah/Array_opt
SI-5017 Poor performance of :+ operator on Arrays
Diffstat (limited to 'test')
-rw-r--r--test/files/run/array-addition.check4
-rw-r--r--test/files/run/array-addition.scala11
2 files changed, 15 insertions, 0 deletions
diff --git a/test/files/run/array-addition.check b/test/files/run/array-addition.check
new file mode 100644
index 0000000000..7bfbd9c711
--- /dev/null
+++ b/test/files/run/array-addition.check
@@ -0,0 +1,4 @@
+Array(1, 2, 3, 4)
+Array(1, 2, 3, 4)
+Array(1)
+Array(1)
diff --git a/test/files/run/array-addition.scala b/test/files/run/array-addition.scala
new file mode 100644
index 0000000000..8def48e85c
--- /dev/null
+++ b/test/files/run/array-addition.scala
@@ -0,0 +1,11 @@
+object Test {
+ def prettyPrintArray(x: Array[_]) = println("Array(" + x.mkString(", ") + ")")
+
+ def main(args: Array[String]): Unit = {
+ prettyPrintArray(Array(1,2,3) :+ 4)
+ prettyPrintArray(1 +: Array(2,3,4))
+ prettyPrintArray(Array() :+ 1)
+ prettyPrintArray(1 +: Array())
+ }
+}
+