diff options
author | Kato Kazuyoshi <kato.kazuyoshi@gmail.com> | 2011-10-04 15:18:54 +0000 |
---|---|---|
committer | Kato Kazuyoshi <kato.kazuyoshi@gmail.com> | 2011-10-04 15:18:54 +0000 |
commit | d1a7af8e27227c7625762fe10560e70853f6529a (patch) | |
tree | 2b3aa9f2d4558e3c45f685f6a29d1c95d5d5234e /test | |
parent | 5d283f3f68a6b855afbfc01df784cd972f5b4ced (diff) | |
download | scala-d1a7af8e27227c7625762fe10560e70853f6529a.tar.gz scala-d1a7af8e27227c7625762fe10560e70853f6529a.tar.bz2 scala-d1a7af8e27227c7625762fe10560e70853f6529a.zip |
Add a small "template engine" and separete HTML...
Add a small "template engine" and separete HTML from Scaladoc's source
code. Review by ureche.
Diffstat (limited to 'test')
-rw-r--r-- | test/scaladoc/scala/IndexTest.scala | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/test/scaladoc/scala/IndexTest.scala b/test/scaladoc/scala/IndexTest.scala index 7679bab0c6..ec8011bf41 100644 --- a/test/scaladoc/scala/IndexTest.scala +++ b/test/scaladoc/scala/IndexTest.scala @@ -5,6 +5,23 @@ import scala.tools.nsc.doc import scala.tools.nsc.doc.html.page.Index import java.net.URLClassLoader +object XMLUtil { + import scala.xml._ + + def stripGroup(seq: Node): Node = { + seq match { + case group: Group => { + <div class="group">{ group.nodes.map(stripGroup _) }</div> + } + case e: Elem => { + val child = e.child.map(stripGroup _) + Elem(e.prefix, e.label, e.attributes, e.scope, child : _*) + } + case _ => seq + } + } +} + object Test extends Properties("Index") { def getClasspath = { @@ -71,10 +88,10 @@ object Test extends Properties("Index") { case None => false } } - property("browser contants a script element") = { + property("body contants a script element") = { createIndex("src/compiler/scala/tools/nsc/doc/html/page/Index.scala") match { case Some(index) => - (index.browser \ "script").size == 1 + (XMLUtil.stripGroup(index.body) \\ "script").size == 1 case None => false } |