summaryrefslogtreecommitdiff
path: root/test/scaladoc
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2013-05-17 17:01:20 +0200
committerPaul Phillips <paulp@improving.org>2013-05-17 11:16:39 -0700
commitb7c352a57f65458c66c78a368f75aaaa4a08e443 (patch)
tree4b2b7fcea439948c5de65b05a392091a66eea0a4 /test/scaladoc
parent4f8c306aca703c63282295c9f74f0cb35f9f85d4 (diff)
parentbe405eed9bef9736f0142d6ddf53b6bf8af08696 (diff)
downloadscala-b7c352a57f65458c66c78a368f75aaaa4a08e443.tar.gz
scala-b7c352a57f65458c66c78a368f75aaaa4a08e443.tar.bz2
scala-b7c352a57f65458c66c78a368f75aaaa4a08e443.zip
Merge v2.10.1-326-g4f8c306' into merge/v2.10.1-326-g4f8c306-to-master
================================================================ Merge commit 'v2.10.1-326-g4f8c306' into merge/v2.10.1-326-g4f8c306-to-master Conflicts: src/compiler/scala/tools/nsc/typechecker/SuperAccessors.scala src/reflect/scala/reflect/runtime/JavaMirrors.scala ================================================================ Merge -s ours 4e64a27 ([nomaster commit range]) ================================================================ Merge commit '0ae7e55' into merge/v2.10.1-326-g4f8c306-to-master Conflicts: src/compiler/scala/tools/nsc/typechecker/Macros.scala
Diffstat (limited to 'test/scaladoc')
-rw-r--r--test/scaladoc/resources/SI_4715.scala4
-rw-r--r--test/scaladoc/resources/Trac4325.scala4
-rw-r--r--test/scaladoc/resources/doc-root/Any.scala2
-rw-r--r--test/scaladoc/resources/doc-root/AnyRef.scala2
-rw-r--r--test/scaladoc/resources/doc-root/Nothing.scala2
-rw-r--r--test/scaladoc/resources/doc-root/Null.scala2
-rw-r--r--test/scaladoc/resources/implicits-base-res.scala80
-rw-r--r--test/scaladoc/resources/links.scala2
-rwxr-xr-xtest/scaladoc/run/SI-191-deprecated.check1
-rwxr-xr-xtest/scaladoc/run/SI-191-deprecated.scala72
-rw-r--r--test/scaladoc/run/SI-6812.scala24
-rw-r--r--test/scaladoc/run/implicits-base.scala148
-rw-r--r--test/scaladoc/run/links.scala2
-rw-r--r--test/scaladoc/run/t5527.check132
-rw-r--r--test/scaladoc/run/t5527.scala155
-rw-r--r--test/scaladoc/scalacheck/CommentFactoryTest.scala6
-rw-r--r--test/scaladoc/scalacheck/HtmlFactoryTest.scala19
-rw-r--r--test/scaladoc/scalacheck/IndexScriptTest.scala16
-rw-r--r--test/scaladoc/scalacheck/IndexTest.scala23
19 files changed, 453 insertions, 243 deletions
diff --git a/test/scaladoc/resources/SI_4715.scala b/test/scaladoc/resources/SI_4715.scala
index 29daf43717..de286956bc 100644
--- a/test/scaladoc/resources/SI_4715.scala
+++ b/test/scaladoc/resources/SI_4715.scala
@@ -1,7 +1,7 @@
class SI_4715 {
type :+:[X,Y] = Map[X,Y]
- val withType: Int :+: Double = error("")
+ val withType: Int :+: Double = sys.error("")
trait :-:[X,Y]
- val withTrait: Int :-: Double = error("")
+ val withTrait: Int :-: Double = sys.error("")
}
diff --git a/test/scaladoc/resources/Trac4325.scala b/test/scaladoc/resources/Trac4325.scala
index ffb968d571..ccc2f1900a 100644
--- a/test/scaladoc/resources/Trac4325.scala
+++ b/test/scaladoc/resources/Trac4325.scala
@@ -1,5 +1,5 @@
-case class WithSynthetic
+case class WithSynthetic()
-case class WithObject
+case class WithObject()
object WithObject
diff --git a/test/scaladoc/resources/doc-root/Any.scala b/test/scaladoc/resources/doc-root/Any.scala
index 031b7d9d8c..fd4c287b4f 100644
--- a/test/scaladoc/resources/doc-root/Any.scala
+++ b/test/scaladoc/resources/doc-root/Any.scala
@@ -1,6 +1,6 @@
/* __ *\
** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2002-2010, LAMP/EPFL **
+** / __/ __// _ | / / / _ | (c) 2002-2013, LAMP/EPFL **
** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
** /____/\___/_/ |_/____/_/ | | **
** |/ **
diff --git a/test/scaladoc/resources/doc-root/AnyRef.scala b/test/scaladoc/resources/doc-root/AnyRef.scala
index 7d8b9f9e76..362fbcf0f5 100644
--- a/test/scaladoc/resources/doc-root/AnyRef.scala
+++ b/test/scaladoc/resources/doc-root/AnyRef.scala
@@ -1,6 +1,6 @@
/* __ *\
** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2002-2010, LAMP/EPFL **
+** / __/ __// _ | / / / _ | (c) 2002-2013, LAMP/EPFL **
** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
** /____/\___/_/ |_/____/_/ | | **
** |/ **
diff --git a/test/scaladoc/resources/doc-root/Nothing.scala b/test/scaladoc/resources/doc-root/Nothing.scala
index eed6066039..57f6fac3f9 100644
--- a/test/scaladoc/resources/doc-root/Nothing.scala
+++ b/test/scaladoc/resources/doc-root/Nothing.scala
@@ -1,6 +1,6 @@
/* __ *\
** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2002-2010, LAMP/EPFL **
+** / __/ __// _ | / / / _ | (c) 2002-2013, LAMP/EPFL **
** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
** /____/\___/_/ |_/____/_/ | | **
** |/ **
diff --git a/test/scaladoc/resources/doc-root/Null.scala b/test/scaladoc/resources/doc-root/Null.scala
index 7455e78ae7..931beb2d1a 100644
--- a/test/scaladoc/resources/doc-root/Null.scala
+++ b/test/scaladoc/resources/doc-root/Null.scala
@@ -1,6 +1,6 @@
/* __ *\
** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2002-2010, LAMP/EPFL **
+** / __/ __// _ | / / / _ | (c) 2002-2013, LAMP/EPFL **
** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
** /____/\___/_/ |_/____/_/ | | **
** |/ **
diff --git a/test/scaladoc/resources/implicits-base-res.scala b/test/scaladoc/resources/implicits-base-res.scala
index d6c0332c10..1d17e9a6d3 100644
--- a/test/scaladoc/resources/implicits-base-res.scala
+++ b/test/scaladoc/resources/implicits-base-res.scala
@@ -11,21 +11,21 @@ trait MyNumeric[R]
* - tests the complete type inference
* - the following inherited methods should appear:
* {{{
- * def convToGtColonDoubleA(x: Double) // pimpA3: with a constraint that T <: Double
- * def convToIntA(x: Int) // pimpA2: with a constraint that T = Int
- * def convToManifestA(x: T) // pimpA7: with 2 constraints: T: Manifest and T <: Double
- * def convToMyNumericA(x: T) // pimpA6: with a constraint that there is x: MyNumeric[T] implicit in scope
- * def convToNumericA(x: T) // pimpA1: with a constraint that there is x: Numeric[T] implicit in scope
- * def convToPimpedA(x: Bar[Foo[T]]) // pimpA5: no constraints, SHADOWED
- * def convToPimpedA(x: S) // pimpA4: with 3 constraints: T = Foo[Bar[S]], S: Foo and S: Bar, SHADOWED
- * def convToPimpedA(x: T) // pimpA0: with no constraints, SHADOWED
- * def convToTraversableOps(x: T) // pimpA7: with 2 constraints: T: Manifest and T <: Double
+ * def convToGtColonDoubleA(x: Double) // enrichA3: with a constraint that T <: Double
+ * def convToIntA(x: Int) // enrichA2: with a constraint that T = Int
+ * def convToManifestA(x: T) // enrichA7: with 2 constraints: T: Manifest and T <: Double
+ * def convToMyNumericA(x: T) // enrichA6: with a constraint that there is x: MyNumeric[T] implicit in scope
+ * def convToNumericA(x: T) // enrichA1: with a constraint that there is x: Numeric[T] implicit in scope
+ * def convToEnrichedA(x: Bar[Foo[T]]) // enrichA5: no constraints, SHADOWED
+ * def convToEnrichedA(x: S) // enrichA4: with 3 constraints: T = Foo[Bar[S]], S: Foo and S: Bar, SHADOWED
+ * def convToEnrichedA(x: T) // enrichA0: with no constraints, SHADOWED
+ * def convToTraversableOps(x: T) // enrichA7: with 2 constraints: T: Manifest and T <: Double
* // should not be abstract!
* }}}
*/
class A[T] {
- /** This should prevent the implicitly inherited `def convToPimpedA: T` from `pimpA0` from showing up */
- def convToPimpedA(x: T): T = sys.error("Let's check it out!")
+ /** This should prevent the implicitly inherited `def convToEnrichedA: T` from `enrichA0` from showing up */
+ def convToEnrichedA(x: T): T = sys.error("Let's check it out!")
/** This should check implicit member elimination in the case of subtyping */
def foo(a: T, b: AnyRef): T
}
@@ -33,15 +33,15 @@ class A[T] {
object A {
import language.implicitConversions // according to SIP18
- implicit def pimpA0[V](a: A[V]) = new PimpedA(a)
- implicit def pimpA1[ZBUR: Numeric](a: A[ZBUR]) = new NumericA[ZBUR](a)
- implicit def pimpA2(a: A[Int]) = new IntA(a)
- implicit def pimpA3(a: A[T] forSome { type T <: Double }) = new GtColonDoubleA(a)
- implicit def pimpA4[S](a: A[Foo[Bar[S]]])(implicit foo: Foo[S], bar: Bar[S]): PimpedA[S] = sys.error("not implemented")
- implicit def pimpA5[Z](a: A[Z]): PimpedA[Bar[Foo[Z]]] = sys.error("not implemented")
- implicit def pimpA6[Z: MyNumeric](a: A[Z]) = new MyNumericA[Z](a)
+ implicit def enrichA0[V](a: A[V]) = new EnrichedA(a)
+ implicit def enrichA1[ZBUR: Numeric](a: A[ZBUR]) = new NumericA[ZBUR](a)
+ implicit def enrichA2(a: A[Int]) = new IntA(a)
+ implicit def enrichA3(a: A[T] forSome { type T <: Double }) = new GtColonDoubleA(a)
+ implicit def enrichA4[S](a: A[Foo[Bar[S]]])(implicit foo: Foo[S], bar: Bar[S]): EnrichedA[S] = sys.error("not implemented")
+ implicit def enrichA5[Z](a: A[Z]): EnrichedA[Bar[Foo[Z]]] = sys.error("not implemented")
+ implicit def enrichA6[Z: MyNumeric](a: A[Z]) = new MyNumericA[Z](a)
// TODO: Add H <: Double and see why it crashes for C and D -- context bounds, need to check!
- implicit def pimpA7[H <: Double : Manifest](a: A[H]) = new ManifestA[H](a) with MyTraversableOps[H] { def convToTraversableOps(x: H): H = sys.error("no") }
+ implicit def enrichA7[H <: Double : Manifest](a: A[H]) = new ManifestA[H](a) with MyTraversableOps[H] { def convToTraversableOps(x: H): H = sys.error("no") }
}
@@ -49,14 +49,14 @@ object A {
* - tests the existential type solving
* - the following inherited methods should appear:
* {{{
- * def convToGtColonDoubleA(x: Double) // pimpA3: no constraints
- * def convToManifestA(x: Double) // pimpA7: no constraints
- * def convToMyNumericA(x: Double) // pimpA6: (if showAll is set) with a constraint that there is x: MyNumeric[Double] implicit in scope
- * def convToNumericA(x: Double) // pimpA1: no constraintsd
- * def convToPimpedA(x: Bar[Foo[Double]]) // pimpA5: no constraints, SHADOWED
- * def convToPimpedA(x: Double) // pimpA0: no constraints, SHADOWED
- * def convToTraversableOps(x: Double) // pimpA7: no constraints
- * // should not be abstract!
+ * def convToGtColonDoubleA(x: Double) // enrichA3: no constraints
+ * def convToManifestA(x: Double) // enrichA7: no constraints
+ * def convToMyNumericA(x: Double) // enrichA6: (if showAll is set) with a constraint that there is x: MyNumeric[Double] implicit in scope
+ * def convToNumericA(x: Double) // enrichA1: no constraintsd
+ * def convToEnrichedA(x: Bar[Foo[Double]]) // enrichA5: no constraints, SHADOWED
+ * def convToEnrichedA(x: Double) // enrichA0: no constraints, SHADOWED
+ * def convToTraversableOps(x: Double) // enrichA7: no constraints
+ * // should not be abstract!
* }}}
*/
class B extends A[Double]
@@ -67,11 +67,11 @@ object B extends A
* - tests asSeenFrom
* - the following inherited methods should appear:
* {{{
- * def convToIntA(x: Int) // pimpA2: no constraints
- * def convToMyNumericA(x: Int) // pimpA6: (if showAll is set) with a constraint that there is x: MyNumeric[Int] implicit in scope
- * def convToNumericA(x: Int) // pimpA1: no constraints
- * def convToPimpedA(x: Int) // pimpA0: no constraints, SHADOWED
- * def convToPimpedA(x: Bar[Foo[Int]]) // pimpA5: no constraints, SHADOWED
+ * def convToIntA(x: Int) // enrichA2: no constraints
+ * def convToMyNumericA(x: Int) // enrichA6: (if showAll is set) with a constraint that there is x: MyNumeric[Int] implicit in scope
+ * def convToNumericA(x: Int) // enrichA1: no constraints
+ * def convToEnrichedA(x: Int) // enrichA0: no constraints, SHADOWED
+ * def convToEnrichedA(x: Bar[Foo[Int]]) // enrichA5: no constraints, SHADOWED
* }}}
*/
class C extends A[Int]
@@ -82,10 +82,10 @@ object C extends A
* - tests implicit elimination
* - the following inherited methods should appear:
* {{{
- * def convToMyNumericA(x: String) // pimpA6: (if showAll is set) with a constraint that there is x: MyNumeric[String] implicit in scope
- * def convToNumericA(x: String) // pimpA1: (if showAll is set) with a constraint that there is x: Numeric[String] implicit in scope
- * def convToPimpedA(x: Bar[Foo[String]]) // pimpA5: no constraints, SHADOWED
- * def convToPimpedA(x: String) // pimpA0: no constraints, SHADOWED
+ * def convToMyNumericA(x: String) // enrichA6: (if showAll is set) with a constraint that there is x: MyNumeric[String] implicit in scope
+ * def convToNumericA(x: String) // enrichA1: (if showAll is set) with a constraint that there is x: Numeric[String] implicit in scope
+ * def convToEnrichedA(x: Bar[Foo[String]]) // enrichA5: no constraints, SHADOWED
+ * def convToEnrichedA(x: String) // enrichA0: no constraints, SHADOWED
* }}}
*/
class D extends A[String]
@@ -93,12 +93,12 @@ class D extends A[String]
object D extends A
-/** PimpedA class <br/>
+/** EnrichedA class <br/>
* - tests simple inheritance and asSeenFrom
* - A, B and C should be implicitly converted to this */
-class PimpedA[V](a: A[V]) {
- /** The convToPimpedA: V documentation... */
- def convToPimpedA(x: V): V = sys.error("Not implemented")
+class EnrichedA[V](a: A[V]) {
+ /** The convToEnrichedA: V documentation... */
+ def convToEnrichedA(x: V): V = sys.error("Not implemented")
}
/** NumericA class <br/>
diff --git a/test/scaladoc/resources/links.scala b/test/scaladoc/resources/links.scala
index bd69665357..ecac9c63cf 100644
--- a/test/scaladoc/resources/links.scala
+++ b/test/scaladoc/resources/links.scala
@@ -25,6 +25,7 @@ package scala.test.scaladoc.links {
object Target {
type T = Int => Int
type S = Int
+ type ::[X] = scala.collection.immutable.::[X]
class C
def foo(i: Int) = 2
def foo(z: String) = 3
@@ -46,6 +47,7 @@ package scala.test.scaladoc.links {
* - [[[[Target!.foo[A[_[_]]]* trait Target -> def foo with 3 nested tparams]]]] (should exercise nested parens)
* - [[Target$.T object Target -> type T]]
* - [[Target$.S object Target -> type S]]
+ * - [[Target$.:: object Target -> type ::]]
* - [[Target$.foo(z:Str* object Target -> def foo]]
* - [[Target$.bar object Target -> def bar]]
* - [[[[Target$.foo[A[_[_]]]* trait Target -> def foo with 3 nested tparams]]]] (should exercise nested parens)
diff --git a/test/scaladoc/run/SI-191-deprecated.check b/test/scaladoc/run/SI-191-deprecated.check
deleted file mode 100755
index 3925a0d464..0000000000
--- a/test/scaladoc/run/SI-191-deprecated.check
+++ /dev/null
@@ -1 +0,0 @@
-Done. \ No newline at end of file
diff --git a/test/scaladoc/run/SI-191-deprecated.scala b/test/scaladoc/run/SI-191-deprecated.scala
deleted file mode 100755
index 4ed24ff8d1..0000000000
--- a/test/scaladoc/run/SI-191-deprecated.scala
+++ /dev/null
@@ -1,72 +0,0 @@
-import scala.tools.nsc.doc.model._
-import scala.tools.nsc.doc.base._
-import scala.tools.nsc.doc.base.comment._
-import scala.tools.partest.ScaladocModelTest
-import java.net.{URI, URL}
-import java.io.File
-
-object Test extends ScaladocModelTest {
-
- override def code =
- """
- /** See:
- * - [[scala.collection.Map]] Simple linking
- * - [[scala.collection.immutable.::]] Linking with symbolic name
- * - [[scala.Int]].toLong Linking to a class
- * - [[scala.Predef]] Linking to an object
- * - [[scala.Int.toLong]] Linking to a method
- * - [[scala]] Linking to a package
- * - [[scala.AbstractMethodError]] Linking to a member in the package object
- * - [[scala.Predef.String]] Linking to a member in an object
- *
- * Don't look at:
- * - [[scala.NoLink]] Not linking :)
- */
- object Test {
- def foo(param: Any) {}
- def barr(l: scala.collection.immutable.List[Any]) {}
- def bar(l: List[String]) {} // TODO: Should be able to link to type aliases
- def baz(d: java.util.Date) {} // Should not be resolved
- }
- """
-
- def scalaURL = "http://bog.us"
-
- override def scaladocSettings = "-no-link-warnings -external-urls scala=" + scalaURL
-
- def testModel(rootPackage: Package) {
- import access._
- val test = rootPackage._object("Test")
-
- def check(memberDef: Def, expected: Int) {
- val externals = memberDef.valueParams(0)(0).resultType.refEntity collect {
- case (_, (LinkToExternal(name, url), _)) => assert(url.contains(scalaURL)); name
- }
- assert(externals.size == expected)
- }
-
- check(test._method("foo"), 1)
- check(test._method("bar"), 0)
- check(test._method("barr"), 2)
- check(test._method("baz"), 0)
-
- val expectedUrls = collection.mutable.Set[String](
- "scala.collection.Map",
- "scala.collection.immutable.::",
- "scala.Int",
- "scala.Predef$",
- "scala.Int@toLong:Long",
- "scala.package",
- "scala.package@AbstractMethodError=AbstractMethodError",
- "scala.Predef$@String=String"
- ).map(scalaURL + "/index.html#" + _)
-
- def isExpectedExternalLink(l: EntityLink) = l.link match {
- case LinkToExternal(name, url) => assert(expectedUrls contains url, url); true
- case _ => false
- }
-
- assert(countLinks(test.comment.get, isExpectedExternalLink) == 8,
- countLinks(test.comment.get, isExpectedExternalLink) + " == 8")
- }
-}
diff --git a/test/scaladoc/run/SI-6812.scala b/test/scaladoc/run/SI-6812.scala
deleted file mode 100644
index fbd9588ede..0000000000
--- a/test/scaladoc/run/SI-6812.scala
+++ /dev/null
@@ -1,24 +0,0 @@
-import scala.tools.nsc.doc.model._
-import scala.tools.partest.ScaladocModelTest
-import language._
-
-object Test extends ScaladocModelTest {
-
- override def code = """
- import scala.reflect.macros.Context
- import language.experimental.macros
-
- object Macros {
- def impl(c: Context) = c.literalUnit
- def foo = macro impl
- }
-
- class C {
- def bar = Macros.foo
- }
- """
-
- def scaladocSettings = ""
- override def extraSettings = super.extraSettings + " -Ymacro-no-expand"
- def testModel(root: Package) = ()
-}
diff --git a/test/scaladoc/run/implicits-base.scala b/test/scaladoc/run/implicits-base.scala
index 3d57306f5d..8f8652cdb3 100644
--- a/test/scaladoc/run/implicits-base.scala
+++ b/test/scaladoc/run/implicits-base.scala
@@ -25,54 +25,54 @@ object Test extends ScaladocModelTest {
val A = base._class("A")
- // def convToPimpedA(x: T) // pimpA0: with no constraints, SHADOWED
- conv = A._conversion(A.qualifiedName + ".pimpA0")
+ // def convToEnrichedA(x: T) // enrichA0: with no constraints, SHADOWED
+ conv = A._conversion(A.qualifiedName + ".enrichA0")
assert(conv.members.length == 1)
assert(conv.constraints.length == 0)
- assert(isShadowed(conv._member("convToPimpedA")))
- assert(conv._member("convToPimpedA").resultType.name == "T")
+ assert(isShadowed(conv._member("convToEnrichedA")))
+ assert(conv._member("convToEnrichedA").resultType.name == "T")
- // def convToNumericA: T // pimpA1: with a constraint that there is x: Numeric[T] implicit in scope
- conv = A._conversion(A.qualifiedName + ".pimpA1")
+ // def convToNumericA: T // enrichA1: with a constraint that there is x: Numeric[T] implicit in scope
+ conv = A._conversion(A.qualifiedName + ".enrichA1")
assert(conv.members.length == 1)
assert(conv.constraints.length == 1)
assert(conv._member("convToNumericA").resultType.name == "T")
- // def convToIntA: Int // pimpA2: with a constraint that T = Int
- conv = A._conversion(A.qualifiedName + ".pimpA2")
+ // def convToIntA: Int // enrichA2: with a constraint that T = Int
+ conv = A._conversion(A.qualifiedName + ".enrichA2")
assert(conv.members.length == 1)
assert(conv.constraints.length == 1)
assert(conv._member("convToIntA").resultType.name == "Int")
- // def convToGtColonDoubleA: Double // pimpA3: with a constraint that T <: Double
- conv = A._conversion(A.qualifiedName + ".pimpA3")
+ // def convToGtColonDoubleA: Double // enrichA3: with a constraint that T <: Double
+ conv = A._conversion(A.qualifiedName + ".enrichA3")
assert(conv.members.length == 1)
assert(conv.constraints.length == 1)
assert(conv._member("convToGtColonDoubleA").resultType.name == "Double")
- // def convToPimpedA: S // pimpA4: with 3 constraints: T = Foo[Bar[S]], S: Foo and S: Bar
- conv = A._conversion(A.qualifiedName + ".pimpA4")
+ // def convToEnrichedA: S // enrichA4: with 3 constraints: T = Foo[Bar[S]], S: Foo and S: Bar
+ conv = A._conversion(A.qualifiedName + ".enrichA4")
assert(conv.members.length == 1)
assert(conv.constraints.length == 3)
- assert(conv._member("convToPimpedA").resultType.name == "S")
+ assert(conv._member("convToEnrichedA").resultType.name == "S")
- // def convToPimpedA: Bar[Foo[T]] // pimpA5: no constraints
- conv = A._conversion(A.qualifiedName + ".pimpA5")
+ // def convToEnrichedA: Bar[Foo[T]] // enrichA5: no constraints
+ conv = A._conversion(A.qualifiedName + ".enrichA5")
assert(conv.members.length == 1)
assert(conv.constraints.length == 0)
- assert(isShadowed(conv._member("convToPimpedA")))
- assert(conv._member("convToPimpedA").resultType.name == "Bar[Foo[T]]")
+ assert(isShadowed(conv._member("convToEnrichedA")))
+ assert(conv._member("convToEnrichedA").resultType.name == "Bar[Foo[T]]")
- // def convToMyNumericA: T // pimpA6: with a constraint that there is x: MyNumeric[T] implicit in scope
- conv = A._conversion(A.qualifiedName + ".pimpA6")
+ // def convToMyNumericA: T // enrichA6: with a constraint that there is x: MyNumeric[T] implicit in scope
+ conv = A._conversion(A.qualifiedName + ".enrichA6")
assert(conv.members.length == 1)
assert(conv.constraints.length == 1)
assert(conv._member("convToMyNumericA").resultType.name == "T")
- // def convToManifestA: T // pimpA7: with 2 constraints: T: Manifest and T <: Double
- // def convToTraversableOps: T // pimpA7: with 2 constraints: T: Manifest and T <: Double
+ // def convToManifestA: T // enrichA7: with 2 constraints: T: Manifest and T <: Double
+ // def convToTraversableOps: T // enrichA7: with 2 constraints: T: Manifest and T <: Double
// should not be abstract!
- conv = A._conversion(A.qualifiedName + ".pimpA7")
+ conv = A._conversion(A.qualifiedName + ".enrichA7")
assert(conv.members.length == 2)
assert(conv.constraints.length == 2)
assert(conv._member("convToManifestA").resultType.name == "T")
@@ -84,45 +84,45 @@ object Test extends ScaladocModelTest {
val B = base._class("B")
// these conversions should not affect B
- assert(B._conversions(A.qualifiedName + ".pimpA2").isEmpty)
- assert(B._conversions(A.qualifiedName + ".pimpA4").isEmpty)
+ assert(B._conversions(A.qualifiedName + ".enrichA2").isEmpty)
+ assert(B._conversions(A.qualifiedName + ".enrichA4").isEmpty)
- // def convToPimpedA(x: Double) // pimpA0: no constraints, SHADOWED
- conv = B._conversion(A.qualifiedName + ".pimpA0")
+ // def convToEnrichedA(x: Double) // enrichA0: no constraints, SHADOWED
+ conv = B._conversion(A.qualifiedName + ".enrichA0")
assert(conv.members.length == 1)
assert(conv.constraints.length == 0)
- assert(isShadowed(conv._member("convToPimpedA")))
- assert(conv._member("convToPimpedA").resultType.name == "Double")
+ assert(isShadowed(conv._member("convToEnrichedA")))
+ assert(conv._member("convToEnrichedA").resultType.name == "Double")
- // def convToNumericA: Double // pimpA1: no constraintsd
- conv = B._conversion(A.qualifiedName + ".pimpA1")
+ // def convToNumericA: Double // enrichA1: no constraintsd
+ conv = B._conversion(A.qualifiedName + ".enrichA1")
assert(conv.members.length == 1)
assert(conv.constraints.length == 0)
assert(conv._member("convToNumericA").resultType.name == "Double")
- // def convToGtColonDoubleA: Double // pimpA3: no constraints
- conv = B._conversion(A.qualifiedName + ".pimpA3")
+ // def convToGtColonDoubleA: Double // enrichA3: no constraints
+ conv = B._conversion(A.qualifiedName + ".enrichA3")
assert(conv.members.length == 1)
assert(conv.constraints.length == 0)
assert(conv._member("convToGtColonDoubleA").resultType.name == "Double")
- // def convToPimpedA: Bar[Foo[Double]] // pimpA5: no constraints
- conv = B._conversion(A.qualifiedName + ".pimpA5")
+ // def convToEnrichedA: Bar[Foo[Double]] // enrichA5: no constraints
+ conv = B._conversion(A.qualifiedName + ".enrichA5")
assert(conv.members.length == 1)
assert(conv.constraints.length == 0)
- assert(isShadowed(conv._member("convToPimpedA")))
- assert(conv._member("convToPimpedA").resultType.name == "Bar[Foo[Double]]")
+ assert(isShadowed(conv._member("convToEnrichedA")))
+ assert(conv._member("convToEnrichedA").resultType.name == "Bar[Foo[Double]]")
- // def convToMyNumericA: Double // pimpA6: (if showAll is set) with a constraint that there is x: MyNumeric[Double] implicit in scope
- conv = B._conversion(A.qualifiedName + ".pimpA6")
+ // def convToMyNumericA: Double // enrichA6: (if showAll is set) with a constraint that there is x: MyNumeric[Double] implicit in scope
+ conv = B._conversion(A.qualifiedName + ".enrichA6")
assert(conv.members.length == 1)
assert(conv.constraints.length == 1)
assert(conv._member("convToMyNumericA").resultType.name == "Double")
- // def convToManifestA: Double // pimpA7: no constraints
- // def convToTraversableOps: Double // pimpA7: no constraints
+ // def convToManifestA: Double // enrichA7: no constraints
+ // def convToTraversableOps: Double // enrichA7: no constraints
// // should not be abstract!
- conv = B._conversion(A.qualifiedName + ".pimpA7")
+ conv = B._conversion(A.qualifiedName + ".enrichA7")
assert(conv.members.length == 2)
assert(conv.constraints.length == 0)
assert(conv._member("convToManifestA").resultType.name == "Double")
@@ -134,38 +134,38 @@ object Test extends ScaladocModelTest {
val C = base._class("C")
// these conversions should not affect C
- assert(C._conversions(A.qualifiedName + ".pimpA3").isEmpty)
- assert(C._conversions(A.qualifiedName + ".pimpA4").isEmpty)
- assert(C._conversions(A.qualifiedName + ".pimpA7").isEmpty)
+ assert(C._conversions(A.qualifiedName + ".enrichA3").isEmpty)
+ assert(C._conversions(A.qualifiedName + ".enrichA4").isEmpty)
+ assert(C._conversions(A.qualifiedName + ".enrichA7").isEmpty)
- // def convToPimpedA(x: Int) // pimpA0: no constraints, SHADOWED
- conv = C._conversion(A.qualifiedName + ".pimpA0")
+ // def convToEnrichedA(x: Int) // enrichA0: no constraints, SHADOWED
+ conv = C._conversion(A.qualifiedName + ".enrichA0")
assert(conv.members.length == 1)
assert(conv.constraints.length == 0)
- assert(isShadowed(conv._member("convToPimpedA")))
- assert(conv._member("convToPimpedA").resultType.name == "Int")
+ assert(isShadowed(conv._member("convToEnrichedA")))
+ assert(conv._member("convToEnrichedA").resultType.name == "Int")
- // def convToNumericA: Int // pimpA1: no constraints
- conv = C._conversion(A.qualifiedName + ".pimpA1")
+ // def convToNumericA: Int // enrichA1: no constraints
+ conv = C._conversion(A.qualifiedName + ".enrichA1")
assert(conv.members.length == 1)
assert(conv.constraints.length == 0)
assert(conv._member("convToNumericA").resultType.name == "Int")
- // def convToIntA: Int // pimpA2: no constraints
- conv = C._conversion(A.qualifiedName + ".pimpA2")
+ // def convToIntA: Int // enrichA2: no constraints
+ conv = C._conversion(A.qualifiedName + ".enrichA2")
assert(conv.members.length == 1)
assert(conv.constraints.length == 0)
assert(conv._member("convToIntA").resultType.name == "Int")
- // def convToPimpedA: Bar[Foo[Int]] // pimpA5: no constraints
- conv = C._conversion(A.qualifiedName + ".pimpA5")
+ // def convToEnrichedA: Bar[Foo[Int]] // enrichA5: no constraints
+ conv = C._conversion(A.qualifiedName + ".enrichA5")
assert(conv.members.length == 1)
assert(conv.constraints.length == 0)
- assert(isShadowed(conv._member("convToPimpedA")))
- assert(conv._member("convToPimpedA").resultType.name == "Bar[Foo[Int]]")
+ assert(isShadowed(conv._member("convToEnrichedA")))
+ assert(conv._member("convToEnrichedA").resultType.name == "Bar[Foo[Int]]")
- // def convToMyNumericA: Int // pimpA6: (if showAll is set) with a constraint that there is x: MyNumeric[Int] implicit in scope
- conv = C._conversion(A.qualifiedName + ".pimpA6")
+ // def convToMyNumericA: Int // enrichA6: (if showAll is set) with a constraint that there is x: MyNumeric[Int] implicit in scope
+ conv = C._conversion(A.qualifiedName + ".enrichA6")
assert(conv.members.length == 1)
assert(conv.constraints.length == 1)
assert(conv._member("convToMyNumericA").resultType.name == "Int")
@@ -175,33 +175,33 @@ object Test extends ScaladocModelTest {
val D = base._class("D")
// these conversions should not affect D
- assert(D._conversions(A.qualifiedName + ".pimpA2").isEmpty)
- assert(D._conversions(A.qualifiedName + ".pimpA3").isEmpty)
- assert(D._conversions(A.qualifiedName + ".pimpA4").isEmpty)
- assert(D._conversions(A.qualifiedName + ".pimpA7").isEmpty)
+ assert(D._conversions(A.qualifiedName + ".enrichA2").isEmpty)
+ assert(D._conversions(A.qualifiedName + ".enrichA3").isEmpty)
+ assert(D._conversions(A.qualifiedName + ".enrichA4").isEmpty)
+ assert(D._conversions(A.qualifiedName + ".enrichA7").isEmpty)
- // def convToPimpedA(x: String) // pimpA0: no constraints, SHADOWED
- conv = D._conversion(A.qualifiedName + ".pimpA0")
+ // def convToEnrichedA(x: String) // enrichA0: no constraints, SHADOWED
+ conv = D._conversion(A.qualifiedName + ".enrichA0")
assert(conv.members.length == 1)
assert(conv.constraints.length == 0)
- assert(isShadowed(conv._member("convToPimpedA")))
- assert(conv._member("convToPimpedA").resultType.name == "String")
+ assert(isShadowed(conv._member("convToEnrichedA")))
+ assert(conv._member("convToEnrichedA").resultType.name == "String")
- // def convToNumericA: String // pimpA1: (if showAll is set) with a constraint that there is x: Numeric[String] implicit in scope
- conv = D._conversion(A.qualifiedName + ".pimpA1")
+ // def convToNumericA: String // enrichA1: (if showAll is set) with a constraint that there is x: Numeric[String] implicit in scope
+ conv = D._conversion(A.qualifiedName + ".enrichA1")
assert(conv.members.length == 1)
assert(conv.constraints.length == 1)
assert(conv._member("convToNumericA").resultType.name == "String")
- // def convToPimpedA: Bar[Foo[String]] // pimpA5: no constraints
- conv = D._conversion(A.qualifiedName + ".pimpA5")
+ // def convToEnrichedA: Bar[Foo[String]] // enrichA5: no constraints
+ conv = D._conversion(A.qualifiedName + ".enrichA5")
assert(conv.members.length == 1)
assert(conv.constraints.length == 0)
- assert(isShadowed(conv._member("convToPimpedA")))
- assert(conv._member("convToPimpedA").resultType.name == "Bar[Foo[String]]")
+ assert(isShadowed(conv._member("convToEnrichedA")))
+ assert(conv._member("convToEnrichedA").resultType.name == "Bar[Foo[String]]")
- // def convToMyNumericA: String // pimpA6: (if showAll is set) with a constraint that there is x: MyNumeric[String] implicit in scope
- conv = D._conversion(A.qualifiedName + ".pimpA6")
+ // def convToMyNumericA: String // enrichA6: (if showAll is set) with a constraint that there is x: MyNumeric[String] implicit in scope
+ conv = D._conversion(A.qualifiedName + ".enrichA6")
assert(conv.members.length == 1)
assert(conv.constraints.length == 1)
assert(conv._member("convToMyNumericA").resultType.name == "String")
diff --git a/test/scaladoc/run/links.scala b/test/scaladoc/run/links.scala
index fde24edb2a..64441c2d95 100644
--- a/test/scaladoc/run/links.scala
+++ b/test/scaladoc/run/links.scala
@@ -26,7 +26,7 @@ object Test extends ScaladocModelTest {
val memberLinks = countLinks(TEST.comment.get, _.link.isInstanceOf[LinkToMember[_, _]])
val templateLinks = countLinks(TEST.comment.get, _.link.isInstanceOf[LinkToTpl[_]])
- assert(memberLinks == 17, memberLinks + " == 17 (the member links in object TEST)")
+ assert(memberLinks == 18, memberLinks + " == 18 (the member links in object TEST)")
assert(templateLinks == 6, templateLinks + " == 6 (the template links in object TEST)")
}
}
diff --git a/test/scaladoc/run/t5527.check b/test/scaladoc/run/t5527.check
new file mode 100644
index 0000000000..bfaa4ad0ed
--- /dev/null
+++ b/test/scaladoc/run/t5527.check
@@ -0,0 +1,132 @@
+newSource1.scala:47: warning: discarding unmoored doc comment
+ /** Document this crucial constant for posterity.
+ ^
+newSource1.scala:64: warning: discarding unmoored doc comment
+ /*************************\
+ ^
+newSource1.scala:73: warning: discarding unmoored doc comment
+ val i = 10 */** Important!
+ ^
+[[syntax trees at end of parser]] // newSource1.scala
+package <empty> {
+ object UselessComments extends scala.AnyRef {
+ def <init>() = {
+ super.<init>();
+ ()
+ };
+ var z = 0;
+ def test1 = {
+ object Maybe extends scala.AnyRef {
+ def <init>() = {
+ super.<init>();
+ ()
+ };
+ /** Some comment inside */
+ def nothing() = ()
+ };
+ ()
+ };
+ def test2 = {
+ var x = 4;
+ if (true)
+ {
+ x = 5;
+ val y = 6;
+ ()
+ }
+ else
+ ()
+ };
+ def test3 = {
+ if (true)
+ z = 3
+ else
+ ();
+ val t = 4;
+ 0.to(4).foreach(((i) => println(i)))
+ };
+ val test4 = 'a' match {
+ case ('0'| '1'| '2'| '3'| '4'| '5'| '6'| '7'| '8'| '9') => true
+ case _ => false
+ };
+ def test5: scala.Unit = if (true)
+ $qmark$qmark$qmark
+ else
+ ();
+ def test6 = {
+ val u = 4;
+ 0.to(u).foreach(((i) => println(i)))
+ };
+ def test7 = {
+ val u = 4;
+ 0.to(u).foreach(((i) => println(i)))
+ };
+ def test8 = {
+ val z = "fancy";
+ z.replace("fanc", "arts")
+ };
+ def test9 = {
+ val i = 10.$times(10);
+ assert(i.$eq$eq(100))
+ }
+ };
+ /** comments that we should keep */
+ object UsefulComments extends scala.AnyRef {
+ def <init>() = {
+ super.<init>();
+ ()
+ };
+ /** class A */
+ class A extends scala.AnyRef {
+ def <init>() = {
+ super.<init>();
+ ()
+ };
+ /** f */
+ def f(i: Int) = i;
+ /** v */
+ val v = 1;
+ /** u */
+ var u = 2
+ };
+ /** trait B */
+ abstract trait B extends scala.AnyRef {
+ def $init$() = {
+ ()
+ };
+ /** T */
+ type T;
+ /** f */
+ def f(i: Int): scala.Unit;
+ /** v */
+ val v = 1;
+ /** u */
+ var u = 2
+ };
+ /** object C */
+ object C extends scala.AnyRef {
+ def <init>() = {
+ super.<init>();
+ ()
+ };
+ /** f */
+ def f(i: Int) = i;
+ /** v */
+ val v = 1;
+ /** u */
+ var u = 2
+ };
+ /** class D */
+ @new deprecated("use ... instead", "2.10.0") class D extends scala.AnyRef {
+ def <init>() = {
+ super.<init>();
+ ()
+ }
+ };
+ /** Get the simple value.
+ * @return the default value
+ */
+ def value: Int = 7
+ }
+}
+
diff --git a/test/scaladoc/run/t5527.scala b/test/scaladoc/run/t5527.scala
new file mode 100644
index 0000000000..60ae23c1a7
--- /dev/null
+++ b/test/scaladoc/run/t5527.scala
@@ -0,0 +1,155 @@
+import scala.tools.partest._
+import java.io._
+import scala.tools.nsc._
+import scala.tools.nsc.util.CommandLineParser
+import scala.tools.nsc.doc.{Settings, DocFactory}
+import scala.tools.nsc.reporters.ConsoleReporter
+
+object Test extends DirectTest {
+
+ override def extraSettings: String = "-usejavacp -Xprint:parser -Yrangepos -Ystop-after:parser -d " + testOutput.path
+
+ override def code = """
+ // SI-5527
+ object UselessComments {
+
+ var z = 0
+
+ def test1 = {
+ /** Some comment here */
+ object Maybe {
+ /** Some comment inside */
+ def nothing() = ()
+ }
+ }
+
+ def test2 = {
+ var x = 4
+ if (true) {
+ /** Testing 123 */
+ x = 5
+ val y = 6
+ }
+ }
+
+ def test3 = {
+ if (true)
+ z = 3
+
+ /** Calculate this result. */
+ val t = 4
+ for (i <- 0 to 4)
+ println(i)
+ }
+
+ val test4 = ('a') match {
+ /** Another digit is a giveaway. */
+ case '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' =>
+ true
+ case _ =>
+ false
+ }
+
+ def test5 {
+ /** @martin is this right? It shouldn't flag me as scaladoc. */
+ if (true) ???
+ }
+
+ def test6 = {
+ /** Document this crucial constant for posterity.
+ * Don't forget to dedoc this comment if you refactor to a local.
+ * @author Paul Phillips
+ */
+ val u = 4
+ for (i <- 0 to u)
+ println(i)
+ }
+ def test7 = {
+ /** Some standard tags are tolerated locally and shouldn't trigger a warning.
+ * @note Don't change this unless you know what you're doing. This means you.
+ */
+ val u = 4
+ for (i <- 0 to u)
+ println(i)
+ }
+ def test8 = {
+ /*************************\
+ * Fancy ASCII Art Block *
+ * @author som-snytt *
+ \*************************/
+ // this is just a local
+ val z = "fancy"
+ z replace ("fanc", "arts")
+ }
+ def test9 = {
+ val i = 10 */** Important!
+ * We have to multiply here!
+ * @author community
+ * @see SI-1234
+ */
+ 10
+ assert(i == 100)
+ }
+ }
+
+ /** comments that we should keep */
+ object UsefulComments {
+ /** class A */
+ class A {
+ /** f */
+ def f(i: Int) = i
+ /** v */
+ val v = 1
+ /** u */
+ var u = 2
+ }
+ /** trait B */
+ trait B {
+ /** T */
+ type T
+ /** f */
+ def f(i: Int)
+ /** v */
+ val v = 1
+ /** u */
+ var u = 2
+ }
+ /** object C */
+ object C {
+ /** f */
+ def f(i: Int) = i
+ /** v */
+ val v = 1
+ /** u */
+ var u = 2
+ }
+ /** class D */
+ @deprecated("use ... instead", "2.10.0")
+ class D
+
+ /** Get the simple value.
+ * @return the default value
+ */
+ // an intervening line comment
+ /* I had more to say, but didn't want to pollute the scaladoc. */
+ def value: Int = 7
+ }
+ """.trim
+
+ override def show(): Unit = {
+ // redirect err to out, for logging
+ val prevErr = System.err
+ System.setErr(System.out)
+ compile()
+ System.setErr(prevErr)
+ }
+
+ override def newCompiler(args: String*): Global = {
+ // we want the Scaladoc compiler here, because it keeps DocDef nodes in the tree
+ val settings = new Settings(_ => ())
+ val command = new ScalaDoc.Command((CommandLineParser tokenize extraSettings) ++ args.toList, settings)
+ new DocFactory(new ConsoleReporter(settings), settings).compiler
+ }
+
+ override def isDebug = false // so we don't get the newSettings warning
+}
diff --git a/test/scaladoc/scalacheck/CommentFactoryTest.scala b/test/scaladoc/scalacheck/CommentFactoryTest.scala
index 96174d29d1..ff64a25602 100644
--- a/test/scaladoc/scalacheck/CommentFactoryTest.scala
+++ b/test/scaladoc/scalacheck/CommentFactoryTest.scala
@@ -25,10 +25,10 @@ class Factory(val g: Global, val s: doc.Settings)
}
def parseComment(s: String): Option[Inline] =
- strip(parse(s, "", scala.tools.nsc.util.NoPosition))
+ strip(parse(s, "", scala.tools.nsc.util.NoPosition, null))
def createBody(s: String) =
- parse(s, "", scala.tools.nsc.util.NoPosition).body
+ parse(s, "", scala.tools.nsc.util.NoPosition, null).body
}
object Test extends Properties("CommentFactory") {
@@ -45,7 +45,7 @@ object Test extends Properties("CommentFactory") {
with MemberLookup)
}
- def parse(src: String, dst: Inline) = {
+ def parse(src: String, dst: Inline): Boolean = {
factory.parseComment(src) match {
case Some(inline) =>
inline == dst
diff --git a/test/scaladoc/scalacheck/HtmlFactoryTest.scala b/test/scaladoc/scalacheck/HtmlFactoryTest.scala
index 13eacf79a5..03348b81d2 100644
--- a/test/scaladoc/scalacheck/HtmlFactoryTest.scala
+++ b/test/scaladoc/scalacheck/HtmlFactoryTest.scala
@@ -2,6 +2,8 @@ import org.scalacheck._
import org.scalacheck.Prop._
import java.net.{URLClassLoader, URLDecoder}
+import scala.collection.mutable
+import scala.xml.NodeSeq
object XMLUtil {
import scala.xml._
@@ -34,21 +36,24 @@ object Test extends Properties("HtmlFactory") {
// this test previously relied on the assumption that the current thread's classloader is an url classloader and contains all the classpaths
// does partest actually guarantee this? to quote Leonard Nimoy: The answer, of course, is no.
// this test _will_ fail again some time in the future.
- val paths = Thread.currentThread.getContextClassLoader.asInstanceOf[URLClassLoader].getURLs.map(u => URLDecoder.decode(u.getPath))
- val morepaths = Thread.currentThread.getContextClassLoader.getParent.asInstanceOf[URLClassLoader].getURLs.map(u => URLDecoder.decode(u.getPath))
- (paths ++ morepaths).mkString(java.io.File.pathSeparator)
+ // Footnote: java.lang.ClassCastException: org.apache.tools.ant.loader.AntClassLoader5 cannot be cast to java.net.URLClassLoader
+ val loader = Thread.currentThread.getContextClassLoader.asInstanceOf[URLClassLoader]
+ val paths = loader.getURLs.map(u => URLDecoder.decode(u.getPath))
+ paths mkString java.io.File.pathSeparator
}
def createFactory = {
val settings = new Settings({Console.err.println(_)})
+ settings.scaladocQuietRun = true
+ settings.nowarn.value = true
settings.classpath.value = getClasspath
val reporter = new scala.tools.nsc.reporters.ConsoleReporter(settings)
new DocFactory(reporter, settings)
}
- def createTemplates(basename: String) = {
- val result = scala.collection.mutable.Map[String, scala.xml.NodeSeq]()
+ def createTemplates(basename: String): collection.Map[String, NodeSeq] = {
+ val result = mutable.Map[String, NodeSeq]()
createFactory.makeUniverse(Left(List(RESOURCES+basename))) match {
case Some(universe) => {
@@ -57,7 +62,7 @@ object Test extends Properties("HtmlFactory") {
result += (page.absoluteLinkTo(page.path) -> page.body)
})
}
- case _ => ;
+ case _ =>
}
result
@@ -680,7 +685,7 @@ object Test extends Properties("HtmlFactory") {
property("package object") = files("com/example/p1/package.html") match {
case node: scala.xml.Node =>
- node.toString contains "com.example.p1.package#packageObjectMethod"
+ node.toString contains "com.example.p1#packageObjectMethod"
case _ => false
}
diff --git a/test/scaladoc/scalacheck/IndexScriptTest.scala b/test/scaladoc/scalacheck/IndexScriptTest.scala
index 5aef38e00a..b8b9f92965 100644
--- a/test/scaladoc/scalacheck/IndexScriptTest.scala
+++ b/test/scaladoc/scalacheck/IndexScriptTest.scala
@@ -8,14 +8,20 @@ import java.net.{URLClassLoader, URLDecoder}
object Test extends Properties("IndexScript") {
def getClasspath = {
- val loader = Thread.currentThread.getContextClassLoader
- val paths = loader.asInstanceOf[URLClassLoader].getURLs
- val morepaths = loader.getParent.asInstanceOf[URLClassLoader].getURLs
- (paths ++ morepaths).map(u => URLDecoder.decode(u.getPath)).mkString(java.io.File.pathSeparator)
+ // these things can be tricky
+ // this test previously relied on the assumption that the current thread's classloader is an url classloader and contains all the classpaths
+ // does partest actually guarantee this? to quote Leonard Nimoy: The answer, of course, is no.
+ // this test _will_ fail again some time in the future.
+ // Footnote: java.lang.ClassCastException: org.apache.tools.ant.loader.AntClassLoader5 cannot be cast to java.net.URLClassLoader
+ val loader = Thread.currentThread.getContextClassLoader.asInstanceOf[URLClassLoader]
+ val paths = loader.getURLs.map(u => URLDecoder.decode(u.getPath))
+ paths mkString java.io.File.pathSeparator
}
val docFactory = {
val settings = new doc.Settings({Console.err.println(_)})
+ settings.scaladocQuietRun = true
+ settings.nowarn.value = true
settings.classpath.value = getClasspath
val reporter = new scala.tools.nsc.reporters.ConsoleReporter(settings)
new doc.DocFactory(reporter, settings)
@@ -35,7 +41,7 @@ object Test extends Properties("IndexScript") {
}
property("allPackages") = {
- createIndexScript("src/compiler/scala/tools/nsc/doc/html/page/Index.scala") match {
+ createIndexScript("src/scaladoc/scala/tools/nsc/doc/html/page/Index.scala") match {
case Some(index) =>
index.allPackages.map(_.toString) == List(
"scala",
diff --git a/test/scaladoc/scalacheck/IndexTest.scala b/test/scaladoc/scalacheck/IndexTest.scala
index e114767264..abc0e5da01 100644
--- a/test/scaladoc/scalacheck/IndexTest.scala
+++ b/test/scaladoc/scalacheck/IndexTest.scala
@@ -12,19 +12,19 @@ object Test extends Properties("Index") {
// this test previously relied on the assumption that the current thread's classloader is an url classloader and contains all the classpaths
// does partest actually guarantee this? to quote Leonard Nimoy: The answer, of course, is no.
// this test _will_ fail again some time in the future.
- val paths = Thread.currentThread.getContextClassLoader.asInstanceOf[URLClassLoader].getURLs.map(u => URLDecoder.decode(u.getPath))
- val morepaths = Thread.currentThread.getContextClassLoader.getParent.asInstanceOf[URLClassLoader].getURLs.map(u => URLDecoder.decode(u.getPath))
- (paths ++ morepaths).mkString(java.io.File.pathSeparator)
+ // Footnote: java.lang.ClassCastException: org.apache.tools.ant.loader.AntClassLoader5 cannot be cast to java.net.URLClassLoader
+ val loader = Thread.currentThread.getContextClassLoader.asInstanceOf[URLClassLoader]
+ val paths = loader.getURLs.map(u => URLDecoder.decode(u.getPath))
+ paths mkString java.io.File.pathSeparator
}
val docFactory = {
val settings = new doc.Settings({Console.err.println(_)})
-
+ settings.scaladocQuietRun = true
+ settings.nowarn.value = true
settings.classpath.value = getClasspath
- println(settings.classpath.value)
val reporter = new scala.tools.nsc.reporters.ConsoleReporter(settings)
-
new doc.DocFactory(reporter, settings)
}
@@ -56,7 +56,7 @@ object Test extends Properties("Index") {
}
property("path") = {
- createIndex("src/compiler/scala/tools/nsc/doc/html/page/Index.scala") match {
+ createIndex("src/scaladoc/scala/tools/nsc/doc/html/page/Index.scala") match {
case Some(index) =>
index.path == List("index.html")
case None => false
@@ -64,14 +64,21 @@ object Test extends Properties("Index") {
}
property("title") = {
- createIndex("src/compiler/scala/tools/nsc/doc/html/page/Index.scala") match {
+ createIndex("src/scaladoc/scala/tools/nsc/doc/html/page/Index.scala") match {
case Some(index) =>
index.title == ""
case None => false
}
}
+ property("browser contants a script element") = {
+ createIndex("src/scaladoc/scala/tools/nsc/doc/html/page/Index.scala") match {
+ case Some(index) =>
+ (index.browser \ "script").size == 1
+ case None => false
+ }
+ }
property("package objects in index") = {
createIndex("test/scaladoc/resources/SI-5558.scala") match {
case Some(index) =>