summaryrefslogtreecommitdiff
path: root/test/files
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2015-07-08 15:45:03 +1000
committerJason Zaugg <jzaugg@gmail.com>2015-07-08 15:45:03 +1000
commitcca13ad0cb12669ed7a7931c5029a52486b9d6fc (patch)
treec69c77151082884a12c0144bbe6dd694ddf361cc /test/files
parentb92c3aff1ab8c76c4816bd7b1a82a0f87d787837 (diff)
downloadscala-cca13ad0cb12669ed7a7931c5029a52486b9d6fc.tar.gz
scala-cca13ad0cb12669ed7a7931c5029a52486b9d6fc.tar.bz2
scala-cca13ad0cb12669ed7a7931c5029a52486b9d6fc.zip
[indylambda] Improve test coverage
Adding tests for the selective use of boxing bridge methods and to show that specialization is not subverted by indylambda. Other aspects of indylambda are tested by tests like: - run/lambda-serialization.scala - run/indylambda-boxing When those tests were written, they only tested the old backend. However, now that we have Java 8 and the new backend avaialble by default to partest, they provide the intended coverage.
Diffstat (limited to 'test/files')
-rw-r--r--test/files/run/indylambda-specialization.scala15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/files/run/indylambda-specialization.scala b/test/files/run/indylambda-specialization.scala
new file mode 100644
index 0000000000..2c66073e90
--- /dev/null
+++ b/test/files/run/indylambda-specialization.scala
@@ -0,0 +1,15 @@
+object Test {
+ def assertApply(expected: Boolean) = {
+ val frames = Thread.currentThread.getStackTrace.takeWhile(_.getMethodName != "main")
+ val usesObjectApply = frames.exists(_.getMethodName == "apply")
+ assert(expected == usesObjectApply, frames.mkString("\n"))
+ }
+ def assertSpecialized() = assertApply(false)
+ def assertUnspecialized() = assertApply(true)
+ def main(args: Array[String]): Unit = {
+ ((i: String) => {assertUnspecialized(); i}).apply("")
+ (() => {assertSpecialized(); 0}).apply()
+ ((i: Int) => {assertSpecialized(); i}).apply(0)
+ ((i: Int, j: Int) => {assertSpecialized(); i + j}).apply(0, 0)
+ }
+}