From 5d283f3f68a6b855afbfc01df784cd972f5b4ced Mon Sep 17 00:00:00 2001 From: Kato Kazuyoshi Date: Tue, 4 Oct 2011 12:24:45 +0000 Subject: Add some basic tests for Scaladoc. --- test/scaladoc/resources/basic.scala | 20 +++++++++++++++++ test/scaladoc/scala/html/HtmlFactoryTest.scala | 31 ++++++++++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 test/scaladoc/resources/basic.scala (limited to 'test') diff --git a/test/scaladoc/resources/basic.scala b/test/scaladoc/resources/basic.scala new file mode 100644 index 0000000000..8645efd818 --- /dev/null +++ b/test/scaladoc/resources/basic.scala @@ -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 + } +} diff --git a/test/scaladoc/scala/html/HtmlFactoryTest.scala b/test/scaladoc/scala/html/HtmlFactoryTest.scala index ba9058724c..2c81be5d08 100644 --- a/test/scaladoc/scala/html/HtmlFactoryTest.scala +++ b/test/scaladoc/scala/html/HtmlFactoryTest.scala @@ -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 "implicit " + 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 + } + } } -- cgit v1.2.3