diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/files/run/t4216.check | 34 | ||||
-rw-r--r-- | test/files/run/t4216.scala | 18 | ||||
-rw-r--r-- | test/files/run/t4929.check | 1 | ||||
-rw-r--r-- | test/files/run/t4929.scala | 42 |
4 files changed, 95 insertions, 0 deletions
diff --git a/test/files/run/t4216.check b/test/files/run/t4216.check new file mode 100644 index 0000000000..ac19a98315 --- /dev/null +++ b/test/files/run/t4216.check @@ -0,0 +1,34 @@ +Type in expressions to have them evaluated. +Type :help for more information. + +scala> def f[A: ArrayTag](a: A) = java.util.Arrays.asList(Array(a): _*) +f: [A](a: A)(implicit evidence$1: ArrayTag[A])java.util.List[A] + +scala> f(".") +res0: java.util.List[String] = [.] + +scala> f(0) +res1: java.util.List[Int] = [0] + +scala> def i(a: Int) = java.util.Arrays.asList(Array(a): _*) +i: (a: Int)java.util.List[Int] + +scala> i(0) +res2: java.util.List[Int] = [0] + +scala> def o(a: Any) = java.util.Arrays.asList(Array(a): _*) +o: (a: Any)java.util.List[Any] + +scala> o(".") +res3: java.util.List[Any] = [.] + +scala> class V(val a: Int) extends AnyVal +defined class V + +scala> f(new V(0)) +res4: java.util.List[V] = [V@0] + +scala> o(new V(0)) +res5: java.util.List[Any] = [V@0] + +scala> diff --git a/test/files/run/t4216.scala b/test/files/run/t4216.scala new file mode 100644 index 0000000000..4ada8f48aa --- /dev/null +++ b/test/files/run/t4216.scala @@ -0,0 +1,18 @@ +import scala.tools.partest.ReplTest + +// t4216 +object Test extends ReplTest { + def code = + """ + |def f[A: ArrayTag](a: A) = java.util.Arrays.asList(Array(a): _*) + |f(".") + |f(0) + |def i(a: Int) = java.util.Arrays.asList(Array(a): _*) + |i(0) + |def o(a: Any) = java.util.Arrays.asList(Array(a): _*) + |o(".") + |class V(val a: Int) extends AnyVal + |f(new V(0)) + |o(new V(0)) + |""".stripMargin.trim +} diff --git a/test/files/run/t4929.check b/test/files/run/t4929.check new file mode 100644 index 0000000000..0f0c913d55 --- /dev/null +++ b/test/files/run/t4929.check @@ -0,0 +1 @@ +success
\ No newline at end of file diff --git a/test/files/run/t4929.scala b/test/files/run/t4929.scala new file mode 100644 index 0000000000..3208cd1b09 --- /dev/null +++ b/test/files/run/t4929.scala @@ -0,0 +1,42 @@ +import scala.util.parsing.json._ +import java.util.concurrent._ +import collection.JavaConversions._ + +object Test extends App { + + val LIMIT = 2000 + val THREAD_COUNT = 20 + val count = new java.util.concurrent.atomic.AtomicInteger(0) + + val begin = new CountDownLatch(THREAD_COUNT) + val finish = new CountDownLatch(THREAD_COUNT) + + val errors = new ConcurrentLinkedQueue[Throwable] + + (1 to THREAD_COUNT) foreach { i => + val thread = new Thread { + override def run() { + begin.await(1, TimeUnit.SECONDS) + try { + while (count.getAndIncrement() < LIMIT && errors.isEmpty) { + JSON.parseFull("""{"foo": [1,2,3,4]}""") + } + } catch { + case t: Throwable => errors.add(t) + } + + finish.await(10, TimeUnit.SECONDS) + } + } + + thread.setDaemon(true) + thread.start() + + } + + + errors foreach { throw(_) } + + println("success") + +} |