summaryrefslogtreecommitdiff
path: root/test/files
diff options
context:
space:
mode:
Diffstat (limited to 'test/files')
-rw-r--r--test/files/run/hashCodeScalaRunTime.scala (renamed from test/files/run/hashCodeBoxesRunTime.scala)10
-rw-r--r--test/files/run/hashhash.scala13
-rw-r--r--test/files/run/t1247.check1
-rw-r--r--test/files/run/t1247.scala11
-rw-r--r--test/files/run/t4190.check3
-rw-r--r--test/files/run/t4190.scala6
-rw-r--r--test/files/run/t5328.check3
-rw-r--r--test/files/run/t5328.scala5
8 files changed, 47 insertions, 5 deletions
diff --git a/test/files/run/hashCodeBoxesRunTime.scala b/test/files/run/hashCodeScalaRunTime.scala
index 081a73376e..e352af95f1 100644
--- a/test/files/run/hashCodeBoxesRunTime.scala
+++ b/test/files/run/hashCodeScalaRunTime.scala
@@ -1,23 +1,23 @@
-// This only tests direct access to the methods in BoxesRunTime,
+// This only tests direct access to the methods in ScalaRunTime,
// not the whole scheme.
object Test
{
import java.{ lang => jl }
- import scala.runtime.BoxesRunTime.{ hashFromNumber, hashFromObject }
+ import scala.runtime.ScalaRunTime.{ hash }
def allSame[T](xs: List[T]) = assert(xs.distinct.size == 1, "failed: " + xs)
def mkNumbers(x: Int): List[Number] =
List(x.toByte, x.toShort, x, x.toLong, x.toFloat, x.toDouble)
- def testLDF(x: Long) = allSame(List[Number](x, x.toDouble, x.toFloat) map hashFromNumber)
+ def testLDF(x: Long) = allSame(List[Number](x, x.toDouble, x.toFloat) map hash)
def main(args: Array[String]): Unit = {
List(Byte.MinValue, -1, 0, 1, Byte.MaxValue) foreach { n =>
- val hashes = mkNumbers(n) map hashFromNumber
+ val hashes = mkNumbers(n) map hash
allSame(hashes)
if (n >= 0) {
- val charCode = hashFromObject(n.toChar: Character)
+ val charCode = hash(n.toChar: Character)
assert(charCode == hashes.head)
}
}
diff --git a/test/files/run/hashhash.scala b/test/files/run/hashhash.scala
index b9cec99a12..f9fc067398 100644
--- a/test/files/run/hashhash.scala
+++ b/test/files/run/hashhash.scala
@@ -6,5 +6,18 @@ object Test {
/** Just a little sanity check, not to be confused with a unit test. */
List(5, 5.5f, "abc", new AnyRef, ()) foreach confirmSame
List(5.0f, 1.0d, -(5.0f), (-1.0d)) foreach confirmDifferent
+
+ val x = (BigInt(1) << 64).toDouble
+ val y: Any = x
+ val f: Float = x.toFloat
+ val jn: java.lang.Number = x
+ val jf: java.lang.Float = x.toFloat
+ val jd: java.lang.Double = x
+
+ assert(x.## == y.##, ((x, y)))
+ assert(x.## == f.##, ((x, f)))
+ assert(x.## == jn.##, ((x, jn)))
+ assert(x.## == jf.##, ((x, jf)))
+ assert(x.## == jd.##, ((x, jd)))
}
}
diff --git a/test/files/run/t1247.check b/test/files/run/t1247.check
new file mode 100644
index 0000000000..ce123032fd
--- /dev/null
+++ b/test/files/run/t1247.check
@@ -0,0 +1 @@
+Is same closure class: true is same closure: true
diff --git a/test/files/run/t1247.scala b/test/files/run/t1247.scala
new file mode 100644
index 0000000000..c709b73bc8
--- /dev/null
+++ b/test/files/run/t1247.scala
@@ -0,0 +1,11 @@
+object Test extends App {
+ val f = () => 5
+ def test(g: => Int) {
+ val gFunc = g _
+ val isSameClosureClass = gFunc.getClass == f.getClass
+ val isSame = gFunc eq f
+ println("Is same closure class: "+isSameClosureClass+" is same closure: "+isSame)
+ }
+
+ test(f())
+}
diff --git a/test/files/run/t4190.check b/test/files/run/t4190.check
new file mode 100644
index 0000000000..b8aae0c7a1
--- /dev/null
+++ b/test/files/run/t4190.check
@@ -0,0 +1,3 @@
+a0
+b0
+c0
diff --git a/test/files/run/t4190.scala b/test/files/run/t4190.scala
new file mode 100644
index 0000000000..aa88b8708d
--- /dev/null
+++ b/test/files/run/t4190.scala
@@ -0,0 +1,6 @@
+import collection.mutable._
+
+object Test extends App {
+ val x: ArrayBuffer[String] = ArrayBuffer("a", "b", "c")
+ x.view map (_ + "0") foreach println
+}
diff --git a/test/files/run/t5328.check b/test/files/run/t5328.check
new file mode 100644
index 0000000000..77a43968c5
--- /dev/null
+++ b/test/files/run/t5328.check
@@ -0,0 +1,3 @@
+2
+1,2,8
+1,8,3
diff --git a/test/files/run/t5328.scala b/test/files/run/t5328.scala
new file mode 100644
index 0000000000..12adf45b84
--- /dev/null
+++ b/test/files/run/t5328.scala
@@ -0,0 +1,5 @@
+object Test extends App {
+ println(Vector(1).view.updated(0,2).toList mkString ",")
+ println(Seq(1,2,3).view.updated(2,8).toList mkString ",")
+ println(List(1,2,3).view.updated(1,8).toList mkString ",")
+}