summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAntonio Cunei <antonio.cunei@epfl.ch>2011-04-20 12:19:47 +0000
committerAntonio Cunei <antonio.cunei@epfl.ch>2011-04-20 12:19:47 +0000
commit517acfdd56af4562d3c4f2963f656f2834ca23e2 (patch)
tree609c95d6aafff786460300162991ce5b31fe8c32 /test
parente5ad9c55f8a7a97aa7c36a057078db2031f468e8 (diff)
downloadscala-517acfdd56af4562d3c4f2963f656f2834ca23e2.tar.gz
scala-517acfdd56af4562d3c4f2963f656f2834ca23e2.tar.bz2
scala-517acfdd56af4562d3c4f2963f656f2834ca23e2.zip
Fixing an incomplete svnmerge; second, merge ag...
Fixing an incomplete svnmerge; second, merge again from trunk.
Diffstat (limited to 'test')
-rw-r--r--test/disabled/jvm/JavaInteraction.check (renamed from test/files/jvm/JavaInteraction.check)0
-rw-r--r--test/disabled/jvm/JavaInteraction.scala (renamed from test/files/jvm/JavaInteraction.scala)0
-rw-r--r--test/disabled/presentation/simple-tests.check (renamed from test/files/presentation/simple-tests.check)0
-rw-r--r--test/disabled/presentation/simple-tests.javaopts (renamed from test/files/presentation/simple-tests.javaopts)0
-rw-r--r--test/disabled/presentation/simple-tests.opts (renamed from test/files/presentation/simple-tests.opts)0
-rw-r--r--test/disabled/scalacheck/HashTrieSplit.scala47
-rw-r--r--test/files/jvm/ticket4283/AbstractFoo.java5
-rw-r--r--test/files/jvm/ticket4283/ScalaBipp.scala5
-rw-r--r--test/files/jvm/ticket4283/Test.scala4
-rwxr-xr-xtest/files/neg/t3115.scala2
-rw-r--r--test/files/neg/t3774.check4
-rw-r--r--test/files/pos/bug1071.scala17
-rw-r--r--test/files/pos/bug4275.scala13
-rw-r--r--test/files/pos/spec-List.scala2
-rw-r--r--test/files/pos/t2799.scala2
-rw-r--r--test/files/pos/t4402/A.scala3
-rw-r--r--test/files/pos/t4402/Bar.java7
-rw-r--r--test/files/pos/t4402/Foo.java8
-rw-r--r--test/files/pos/t4432.scala42
-rw-r--r--test/files/run/pc-conversions.scala13
-rw-r--r--test/files/run/t4426.scala24
-rw-r--r--test/files/run/t4459.scala12
-rw-r--r--test/files/scalacheck/HashTrieSplit.scala4
-rw-r--r--test/files/scalacheck/parallel-collections/ParallelIterableCheck.scala6
-rw-r--r--test/files/scalacheck/parallel-collections/pc.scala10
-rw-r--r--test/pending/run/t4283/AbstractFoo.java6
-rw-r--r--test/pending/run/t4283/IllegalAccess.scala17
-rw-r--r--test/pending/run/t4283/ScalaBipp.scala5
-rw-r--r--test/scaladoc/resources/Trac4452.scala30
-rw-r--r--test/scaladoc/resources/Trac4471.scala9
-rw-r--r--test/scaladoc/scala/html/HtmlFactoryTest.scala40
31 files changed, 313 insertions, 24 deletions
diff --git a/test/files/jvm/JavaInteraction.check b/test/disabled/jvm/JavaInteraction.check
index fb9d3cdd8c..fb9d3cdd8c 100644
--- a/test/files/jvm/JavaInteraction.check
+++ b/test/disabled/jvm/JavaInteraction.check
diff --git a/test/files/jvm/JavaInteraction.scala b/test/disabled/jvm/JavaInteraction.scala
index 26fbc17e58..26fbc17e58 100644
--- a/test/files/jvm/JavaInteraction.scala
+++ b/test/disabled/jvm/JavaInteraction.scala
diff --git a/test/files/presentation/simple-tests.check b/test/disabled/presentation/simple-tests.check
index b90dfce77c..b90dfce77c 100644
--- a/test/files/presentation/simple-tests.check
+++ b/test/disabled/presentation/simple-tests.check
diff --git a/test/files/presentation/simple-tests.javaopts b/test/disabled/presentation/simple-tests.javaopts
index 4af888f9c2..4af888f9c2 100644
--- a/test/files/presentation/simple-tests.javaopts
+++ b/test/disabled/presentation/simple-tests.javaopts
diff --git a/test/files/presentation/simple-tests.opts b/test/disabled/presentation/simple-tests.opts
index 8529bbf1a0..8529bbf1a0 100644
--- a/test/files/presentation/simple-tests.opts
+++ b/test/disabled/presentation/simple-tests.opts
diff --git a/test/disabled/scalacheck/HashTrieSplit.scala b/test/disabled/scalacheck/HashTrieSplit.scala
new file mode 100644
index 0000000000..6b20efe12b
--- /dev/null
+++ b/test/disabled/scalacheck/HashTrieSplit.scala
@@ -0,0 +1,47 @@
+
+
+
+
+
+import collection._
+
+
+
+
+// checks whether hash tries split their iterators correctly
+// even after some elements have been traversed
+object Test {
+ def main(args: Array[String]) {
+ doesSplitOk
+ }
+
+ def doesSplitOk = {
+ val sz = 2000
+ var ht = new parallel.immutable.ParHashMap[Int, Int]
+ // println("creating trie")
+ for (i <- 0 until sz) ht += ((i + sz, i))
+ // println("created trie")
+ for (n <- 0 until (sz - 1)) {
+ // println("---------> n = " + n)
+ val pit = ht.parallelIterator
+ val pit2 = ht.parallelIterator
+ var i = 0
+ while (i < n) {
+ pit.next
+ pit2.next
+ i += 1
+ }
+ // println("splitting")
+ val pits = pit.split
+ val fst = pits(0).toSet
+ val snd = pits(1).toSet
+ val orig = pit2.toSet
+ if (orig.size != (fst.size + snd.size) || orig != (fst ++ snd)) {
+ println("Original: " + orig)
+ println("First: " + fst)
+ println("Second: " + snd)
+ assert(false)
+ }
+ }
+ }
+}
diff --git a/test/files/jvm/ticket4283/AbstractFoo.java b/test/files/jvm/ticket4283/AbstractFoo.java
new file mode 100644
index 0000000000..74f3827fe3
--- /dev/null
+++ b/test/files/jvm/ticket4283/AbstractFoo.java
@@ -0,0 +1,5 @@
+package test;
+
+/* package private */ class AbstractFoo {
+ public int t;
+}
diff --git a/test/files/jvm/ticket4283/ScalaBipp.scala b/test/files/jvm/ticket4283/ScalaBipp.scala
new file mode 100644
index 0000000000..36dea9f4de
--- /dev/null
+++ b/test/files/jvm/ticket4283/ScalaBipp.scala
@@ -0,0 +1,5 @@
+package test
+
+class ScalaBipp extends AbstractFoo {
+ def make: Option[ScalaBipp] = Option(this)
+}
diff --git a/test/files/jvm/ticket4283/Test.scala b/test/files/jvm/ticket4283/Test.scala
new file mode 100644
index 0000000000..9bbfaab928
--- /dev/null
+++ b/test/files/jvm/ticket4283/Test.scala
@@ -0,0 +1,4 @@
+
+object Test extends App {
+ val x = (new test.ScalaBipp).make.get.t // java.lang.IllegalAccessError: tried to access class test.AbstractFoo from class other.IllegalAccess$
+}
diff --git a/test/files/neg/t3115.scala b/test/files/neg/t3115.scala
index 4aeeb4063e..3888085593 100755
--- a/test/files/neg/t3115.scala
+++ b/test/files/neg/t3115.scala
@@ -1,5 +1,5 @@
object sc {
- @deprecated("") object Math
+ @deprecated("", "2.8.0") object Math
}
object Test {
diff --git a/test/files/neg/t3774.check b/test/files/neg/t3774.check
index 59c63c4ee8..ea35c50541 100644
--- a/test/files/neg/t3774.check
+++ b/test/files/neg/t3774.check
@@ -1,6 +1,6 @@
t3774.scala:4: error: overloaded method value ++ with alternatives:
- [B1 >: List[Int]](xs: scala.collection.TraversableOnce[((Int, Int), B1)])scala.collection.immutable.Map[(Int, Int),B1] <and>
- [B >: ((Int, Int), List[Int]),That](that: scala.collection.TraversableOnce[B])(implicit bf: scala.collection.generic.CanBuildFrom[scala.collection.immutable.Map[(Int, Int),List[Int]],B,That])That
+ [B1 >: List[Int]](xs: scala.collection.GenTraversableOnce[((Int, Int), B1)])scala.collection.immutable.Map[(Int, Int),B1] <and>
+ [B >: ((Int, Int), List[Int]),That](that: scala.collection.GenTraversableOnce[B])(implicit bf: scala.collection.generic.CanBuildFrom[scala.collection.immutable.Map[(Int, Int),List[Int]],B,That])That
cannot be applied to (scala.collection.immutable.IndexedSeq[((Int, Int), scala.collection.immutable.Range.Inclusive)])
Map[(Int,Int),List[Int]]() ++ (for(x <- 0 to 1 ; y <- 0 to 1) yield {(x,y)-> (0 to 1)})
^
diff --git a/test/files/pos/bug1071.scala b/test/files/pos/bug1071.scala
new file mode 100644
index 0000000000..59149a021b
--- /dev/null
+++ b/test/files/pos/bug1071.scala
@@ -0,0 +1,17 @@
+class C {
+ private val a = 0
+ def getA = a
+}
+
+class D(c: C) {
+ def a = c.getA
+}
+
+object Test {
+ implicit def c2d(c: C): D = new D(c)
+
+ val c = new C
+ (c: D).a // works
+ c.a // error
+}
+
diff --git a/test/files/pos/bug4275.scala b/test/files/pos/bug4275.scala
new file mode 100644
index 0000000000..1938aceadc
--- /dev/null
+++ b/test/files/pos/bug4275.scala
@@ -0,0 +1,13 @@
+object Test {
+ def f = "abc".count(_ > 'a')
+
+ class A {
+ private val count: Int = 0
+ }
+ class B extends A { }
+ object B {
+ implicit def b2seq(x: B): Seq[Int] = Nil
+
+ def f = (new B) count (_ > 0)
+ }
+}
diff --git a/test/files/pos/spec-List.scala b/test/files/pos/spec-List.scala
index e3055f3051..04ab7d1543 100644
--- a/test/files/pos/spec-List.scala
+++ b/test/files/pos/spec-List.scala
@@ -144,7 +144,7 @@ sealed trait List[@specialized +A] extends LinearSeq[A]
/** Create a new list which contains all elements of this list
* followed by all elements of Traversable `that'
*/
- override def ++[B >: A, That](xs: TraversableOnce[B])(implicit bf: CanBuildFrom[List[A], B, That]): That = {
+ override def ++[B >: A, That](xs: GenTraversableOnce[B])(implicit bf: CanBuildFrom[List[A], B, That]): That = {
val b = bf(this)
if (b.isInstanceOf[ListBuffer[_]]) (this ::: xs.toList).asInstanceOf[That]
else super.++(xs)
diff --git a/test/files/pos/t2799.scala b/test/files/pos/t2799.scala
index fe93c0e301..7710cce26c 100644
--- a/test/files/pos/t2799.scala
+++ b/test/files/pos/t2799.scala
@@ -1 +1 @@
-@deprecated("hi mom") case class Bob ()
+@deprecated("hi mom", "") case class Bob ()
diff --git a/test/files/pos/t4402/A.scala b/test/files/pos/t4402/A.scala
new file mode 100644
index 0000000000..f43f0865f0
--- /dev/null
+++ b/test/files/pos/t4402/A.scala
@@ -0,0 +1,3 @@
+package ohmy
+
+class A extends other.Bar
diff --git a/test/files/pos/t4402/Bar.java b/test/files/pos/t4402/Bar.java
new file mode 100644
index 0000000000..edc00a5fd1
--- /dev/null
+++ b/test/files/pos/t4402/Bar.java
@@ -0,0 +1,7 @@
+package other;
+
+public class Bar extends test.Foo {
+ void createMeSth(test.Foo.Inner aaa) {
+ aaa.hello();
+ }
+}
diff --git a/test/files/pos/t4402/Foo.java b/test/files/pos/t4402/Foo.java
new file mode 100644
index 0000000000..585a5e0a2c
--- /dev/null
+++ b/test/files/pos/t4402/Foo.java
@@ -0,0 +1,8 @@
+package test;
+
+public abstract class Foo {
+ protected interface Inner {
+ public void hello();
+ }
+}
+
diff --git a/test/files/pos/t4432.scala b/test/files/pos/t4432.scala
new file mode 100644
index 0000000000..106312311a
--- /dev/null
+++ b/test/files/pos/t4432.scala
@@ -0,0 +1,42 @@
+object Main {
+ def foo1 = {
+ class A {
+ val x = {
+ lazy val cc = 1 //
+ cc
+ ()
+ }
+ }
+ new A
+ }
+
+ def foo2 = {
+ class B {
+ val x = {
+ object cc
+ cc
+ ()
+ }
+ }
+ new B
+ }
+
+ def foo3 = {
+ object C {
+ val x = {
+ lazy val cc = 1
+ cc
+ }
+ }
+ C
+ }
+
+ def foo4 = {
+ class D {
+ lazy val cc = 1
+ cc
+ }
+ new D
+ }
+
+}
diff --git a/test/files/run/pc-conversions.scala b/test/files/run/pc-conversions.scala
index 3121d82944..6be0f99355 100644
--- a/test/files/run/pc-conversions.scala
+++ b/test/files/run/pc-conversions.scala
@@ -7,7 +7,7 @@ import collection._
object Test {
def main(args: Array[String]) {
- // disabled
+ testConversions
}
def testConversions {
@@ -49,13 +49,18 @@ object Test {
assertToPar(parallel.immutable.ParHashSet(1 -> 3))
assertToParWoMap(immutable.Range(1, 10, 2))
+
+ // seq and par again conversions)
+ assertSeqPar(parallel.mutable.ParArray(1, 2, 3))
}
+ def assertSeqPar[T](pc: parallel.ParIterable[T]) = pc.seq.par == pc
+
def assertSeq[T](pc: parallel.ParIterable[T]) = assert(pc.seq == pc)
- def assertPar[T, P <: Parallel](xs: Iterable[T]) = assert(xs == xs.par)
+ def assertPar[T, P <: Parallel](xs: GenIterable[T]) = assert(xs == xs.par)
- def assertToPar[K, V](xs: Traversable[(K, V)]) {
+ def assertToPar[K, V](xs: GenTraversable[(K, V)]) {
xs match {
case _: Seq[_] =>
assert(xs.toIterable.par == xs)
@@ -73,7 +78,7 @@ object Test {
assert(xs.par.toMap == xs.toMap)
}
- def assertToParWoMap[T](xs: Seq[T]) {
+ def assertToParWoMap[T](xs: GenSeq[T]) {
assert(xs.toIterable.par == xs.toIterable)
assert(xs.par.toIterable == xs.toIterable)
diff --git a/test/files/run/t4426.scala b/test/files/run/t4426.scala
new file mode 100644
index 0000000000..1cbd42da25
--- /dev/null
+++ b/test/files/run/t4426.scala
@@ -0,0 +1,24 @@
+import scala.tools.nsc._
+
+object Test {
+ val x = {
+ val settings = new Settings()
+ settings.classpath.value = System.getProperty("java.class.path")
+
+ object cc extends Global(settings) {
+ object dummy
+
+ override def computePluginPhases() = {
+ super.computePluginPhases()
+ assert(dummy ne null, "Dummy not initialized")
+ }
+ }
+ new cc.Run
+ ()
+ }
+
+ def main(args: Array[String]): Unit = {
+
+ }
+}
+
diff --git a/test/files/run/t4459.scala b/test/files/run/t4459.scala
new file mode 100644
index 0000000000..6e1b871cbe
--- /dev/null
+++ b/test/files/run/t4459.scala
@@ -0,0 +1,12 @@
+import collection._
+
+object Test {
+ def main(args: Array[String]) {
+ for (i <- 0 until 2000) {
+ foo((0 until 10000).toSeq.par)
+ }
+ }
+
+ def foo(arg: GenSeq[_]): String = arg.map(x => x).mkString(",")
+}
+
diff --git a/test/files/scalacheck/HashTrieSplit.scala b/test/files/scalacheck/HashTrieSplit.scala
index 6b20efe12b..e959a3d535 100644
--- a/test/files/scalacheck/HashTrieSplit.scala
+++ b/test/files/scalacheck/HashTrieSplit.scala
@@ -23,8 +23,8 @@ object Test {
// println("created trie")
for (n <- 0 until (sz - 1)) {
// println("---------> n = " + n)
- val pit = ht.parallelIterator
- val pit2 = ht.parallelIterator
+ val pit = ht.splitter
+ val pit2 = ht.splitter
var i = 0
while (i < n) {
pit.next
diff --git a/test/files/scalacheck/parallel-collections/ParallelIterableCheck.scala b/test/files/scalacheck/parallel-collections/ParallelIterableCheck.scala
index 744d22f05c..ac3493e56c 100644
--- a/test/files/scalacheck/parallel-collections/ParallelIterableCheck.scala
+++ b/test/files/scalacheck/parallel-collections/ParallelIterableCheck.scala
@@ -71,11 +71,11 @@ abstract class ParallelIterableCheck[T](collName: String) extends Properties(col
(inst, fromTraversable(inst), modif)
}
- def areEqual(t1: Traversable[T], t2: Traversable[T]) = if (hasStrictOrder) {
+ def areEqual(t1: GenTraversable[T], t2: GenTraversable[T]) = if (hasStrictOrder) {
t1 == t2 && t2 == t1
} else (t1, t2) match { // it is slightly delicate what `equal` means if the order is not strict
- case (m1: Map[_, _], m2: Map[_, _]) => m1 == m2 && m2 == m1
- case (i1: Iterable[_], i2: Iterable[_]) =>
+ case (m1: GenMap[_, _], m2: GenMap[_, _]) => m1 == m2 && m2 == m1
+ case (i1: GenIterable[_], i2: GenIterable[_]) =>
val i1s = i1.toSet
val i2s = i2.toSet
i1s == i2s && i2s == i1s
diff --git a/test/files/scalacheck/parallel-collections/pc.scala b/test/files/scalacheck/parallel-collections/pc.scala
index 4be7b0ec4d..103b5e2993 100644
--- a/test/files/scalacheck/parallel-collections/pc.scala
+++ b/test/files/scalacheck/parallel-collections/pc.scala
@@ -30,16 +30,6 @@ class ParCollProperties extends Properties("Parallel collections") {
// parallel vectors
include(immutable.IntParallelVectorCheck)
-
- /* Views */
-
- // parallel array views
-
- // parallel immutable hash map views
-
- // parallel mutable hash map views
-
- // parallel vector views
}
diff --git a/test/pending/run/t4283/AbstractFoo.java b/test/pending/run/t4283/AbstractFoo.java
new file mode 100644
index 0000000000..0403271b74
--- /dev/null
+++ b/test/pending/run/t4283/AbstractFoo.java
@@ -0,0 +1,6 @@
+package test;
+
+/* package private */ class AbstractFoo {
+ public int t = 1;
+ public int f() { return 2; }
+} \ No newline at end of file
diff --git a/test/pending/run/t4283/IllegalAccess.scala b/test/pending/run/t4283/IllegalAccess.scala
new file mode 100644
index 0000000000..12de7e4649
--- /dev/null
+++ b/test/pending/run/t4283/IllegalAccess.scala
@@ -0,0 +1,17 @@
+package other
+
+object IllegalAccess {
+ def main(args: Array[String]) {
+ val x = (new test.ScalaBipp).make.get.asInstanceOf[test.ScalaBipp].f()
+ println(x)
+ val y = (new test.ScalaBipp).make.get.f()
+ println(y)
+ val u = (new test.ScalaBipp).make.get.asInstanceOf[test.ScalaBipp].t
+ println(u)
+ val v = (new test.ScalaBipp).make.get.t
+ println(v)
+ val sb: test.ScalaBipp = (new test.ScalaBipp).make.get
+ val z = sb.t
+ println(z)
+ }
+}
diff --git a/test/pending/run/t4283/ScalaBipp.scala b/test/pending/run/t4283/ScalaBipp.scala
new file mode 100644
index 0000000000..36dea9f4de
--- /dev/null
+++ b/test/pending/run/t4283/ScalaBipp.scala
@@ -0,0 +1,5 @@
+package test
+
+class ScalaBipp extends AbstractFoo {
+ def make: Option[ScalaBipp] = Option(this)
+}
diff --git a/test/scaladoc/resources/Trac4452.scala b/test/scaladoc/resources/Trac4452.scala
new file mode 100644
index 0000000000..b844437dba
--- /dev/null
+++ b/test/scaladoc/resources/Trac4452.scala
@@ -0,0 +1,30 @@
+/**
+ * @define MacroWithNewLine
+ * This macro should not include "*".
+ *
+ * @define MacroWithoutNewLine This macro
+ * should
+ * include "*".
+ */
+class Test
+
+/**
+ * TestA class
+ */
+class Trac4452 extends Test {
+ /** $MacroWithNewLine */
+ def a = 1
+
+ /** $MacroWithoutNewLine */
+ def b = 2
+
+ /**
+ * $MacroWithNewLine
+ */
+ def c = 3
+
+ /**
+ * $MacroWithoutNewLine
+ */
+ def d = 4
+}
diff --git a/test/scaladoc/resources/Trac4471.scala b/test/scaladoc/resources/Trac4471.scala
new file mode 100644
index 0000000000..2a22887c0d
--- /dev/null
+++ b/test/scaladoc/resources/Trac4471.scala
@@ -0,0 +1,9 @@
+class A {
+ @deprecated def foo = 123
+ @deprecated def bar = 456
+}
+
+class B {
+ def foo = 123
+ @deprecated def bar = 456
+}
diff --git a/test/scaladoc/scala/html/HtmlFactoryTest.scala b/test/scaladoc/scala/html/HtmlFactoryTest.scala
index c0a3f1ad95..cb31df3fb2 100644
--- a/test/scaladoc/scala/html/HtmlFactoryTest.scala
+++ b/test/scaladoc/scala/html/HtmlFactoryTest.scala
@@ -24,6 +24,7 @@ object Test extends Properties("HtmlFactory") {
import scala.tools.nsc.doc.{DocFactory, Settings}
import scala.tools.nsc.doc.model.IndexModelFactory
import scala.tools.nsc.doc.html.HtmlFactory
+ import scala.tools.nsc.doc.html.page.ReferenceIndex
def getClasspath = {
// these things can be tricky
@@ -59,6 +60,23 @@ object Test extends Properties("HtmlFactory") {
result
}
+ def createReferenceIndex(basename: String) = {
+ createFactory.makeUniverse(List("test/scaladoc/resources/"+basename)) match {
+ case Some(universe) => {
+ val index = IndexModelFactory.makeIndex(universe)
+ val pages = index.firstLetterIndex.map({
+ case (key, value) => {
+ val page = new ReferenceIndex(key, index, universe)
+ page.absoluteLinkTo(page.path) -> page.body
+ }
+ })
+ Some(pages)
+ }
+ case _ =>
+ None
+ }
+ }
+
def createTemplate(scala: String) = {
val html = scala.stripSuffix(".scala") + ".html"
createTemplates(scala)(html)
@@ -266,4 +284,26 @@ object Test extends Properties("HtmlFactory") {
case _ => false
}
}
+
+ property("Trac #4452") = {
+ createTemplate("Trac4452.scala") match {
+ case node: scala.xml.Node =>
+ ! node.toString.contains(">*")
+ case _ => false
+ }
+ }
+
+ property("Trac #4471") = {
+ createReferenceIndex("Trac4471.scala") match {
+ case Some(pages) =>
+ (pages.get("index/index-f.html") match {
+ case Some(node) => node.toString.contains(">A</a></strike>")
+ case _ => false
+ }) && (pages.get("index/index-b.html") match {
+ case Some(node) => node.toString.contains(">bar</strike>")
+ case _ => false
+ })
+ case _ => false
+ }
+ }
}