Add some basic tests for Scaladoc. Review by ureche.

git-svn-id: http://lampsvn.epfl.ch/svn-repos/scala/scala/trunk@25786 5e8d7ff9-d8ef-0310-90f0-a4852d11357a
This commit is contained in:
kzys 2011-10-04 12:24:45 +00:00
parent ed53b0ad25
commit cbe4220571
3 changed files with 54 additions and 2 deletions

View File

@ -1603,12 +1603,13 @@ BOOTRAPING TEST AND TEST SUITE
</target>
<target name="test.scaladoc" depends="pack.done">
<partest erroronfailed="yes" scalacopts="${scalac.args.optimise}">
<partest erroronfailed="yes" scalacopts="${scalac.args.optimise}"
showlog="yes">
<compilationpath>
<path refid="pack.classpath"/>
</compilationpath>
<scalachecktests dir="test/scaladoc/scala">
<include name="*.scala"/>
<include name="**/*.scala"/>
</scalachecktests>
</partest>
</target>

View File

@ -0,0 +1,20 @@
package com.example {
package object p1 {
def packageObjectMethod = 0
}
}
package com.example.p1 {
class Clazz {
def foo = packageObjectMethod
implicit def intToClass1(n: Int) = new Clazz
}
class UpperBound[T <: Int]
class LowerBound[T >: Int]
class ExistentialType {
def foo(array: Array[T] forSome { type T <: AnyVal }) = 0
}
}

View File

@ -372,4 +372,35 @@ object Test extends Properties("HtmlFactory") {
case _ => false
}
}
{
val files = createTemplates("basic.scala")
println(files)
property("class") = files.get("com/example/p1/Clazz.html") match {
case Some(node: scala.xml.Node) => {
property("implicit convertion") =
node.toString contains "<span class=\"modifier\">implicit </span>"
true
}
case _ => false
}
property("package") = files.get("com/example/p1/package.html") != None
property("package object") = files("com/example/p1/package.html") match {
case node: scala.xml.Node =>
node.toString contains "com.example.p1.package#packageObjectMethod"
case _ => false
}
property("lower bound") = files("com/example/p1/LowerBound.html") match {
case node: scala.xml.Node => true
case _ => false
}
property("upper bound") = files("com/example/p1/UpperBound.html") match {
case node: scala.xml.Node => true
case _ => false
}
}
}