summaryrefslogtreecommitdiff
path: root/test/junit/scala/runtime/ScalaRunTimeTest.scala
diff options
context:
space:
mode:
Diffstat (limited to 'test/junit/scala/runtime/ScalaRunTimeTest.scala')
-rw-r--r--test/junit/scala/runtime/ScalaRunTimeTest.scala70
1 files changed, 70 insertions, 0 deletions
diff --git a/test/junit/scala/runtime/ScalaRunTimeTest.scala b/test/junit/scala/runtime/ScalaRunTimeTest.scala
new file mode 100644
index 0000000000..9da197c71a
--- /dev/null
+++ b/test/junit/scala/runtime/ScalaRunTimeTest.scala
@@ -0,0 +1,70 @@
+package scala.runtime
+
+import org.junit.Assert._
+import org.junit.Test
+import org.junit.runner.RunWith
+import org.junit.runners.JUnit4
+
+/** Tests for the private class DefaultPromise */
+@RunWith(classOf[JUnit4])
+class ScalaRunTimeTest {
+ @Test
+ def testIsTuple() {
+ import ScalaRunTime.isTuple
+ def check(v: Any) = {
+ assertTrue(v.toString, isTuple(v))
+ }
+
+ val s = ""
+ check(Tuple1(s))
+ check((s, s))
+ check((s, s, s))
+ check((s, s, s, s))
+ check((s, s, s, s, s))
+ check((s, s, s, s, s, s))
+ check((s, s, s, s, s, s, s))
+ check((s, s, s, s, s, s, s, s))
+ check((s, s, s, s, s, s, s, s, s))
+ check((s, s, s, s, s, s, s, s, s, s))
+ check((s, s, s, s, s, s, s, s, s, s, s))
+ check((s, s, s, s, s, s, s, s, s, s, s, s))
+ check((s, s, s, s, s, s, s, s, s, s, s, s, s))
+ check((s, s, s, s, s, s, s, s, s, s, s, s, s, s))
+ check((s, s, s, s, s, s, s, s, s, s, s, s, s, s, s))
+ check((s, s, s, s, s, s, s, s, s, s, s, s, s, s, s, s))
+ check((s, s, s, s, s, s, s, s, s, s, s, s, s, s, s, s, s))
+ check((s, s, s, s, s, s, s, s, s, s, s, s, s, s, s, s, s, s))
+ check((s, s, s, s, s, s, s, s, s, s, s, s, s, s, s, s, s, s, s))
+ check((s, s, s, s, s, s, s, s, s, s, s, s, s, s, s, s, s, s, s, s))
+ check((s, s, s, s, s, s, s, s, s, s, s, s, s, s, s, s, s, s, s, s, s))
+ check((s, s, s, s, s, s, s, s, s, s, s, s, s, s, s, s, s, s, s, s, s, s))
+
+ // some specialized variants will have mangled classnames
+ check(Tuple1(0))
+ check((0, 0))
+ check((0, 0, 0))
+ check((0, 0, 0, 0))
+ check((0, 0, 0, 0, 0))
+ check((0, 0, 0, 0, 0, 0))
+ check((0, 0, 0, 0, 0, 0, 0))
+ check((0, 0, 0, 0, 0, 0, 0, 0))
+ check((0, 0, 0, 0, 0, 0, 0, 0, 0))
+ check((0, 0, 0, 0, 0, 0, 0, 0, 0, 0))
+ check((0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0))
+ check((0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0))
+ check((0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0))
+ check((0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0))
+ check((0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0))
+ check((0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0))
+ check((0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0))
+ check((0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0))
+ check((0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0))
+ check((0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0))
+ check((0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0))
+ check((0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0))
+
+ case class C()
+ val c = new C()
+ assertFalse(c.toString, isTuple(c))
+ }
+}