diff options
author | Vlad Ureche <vlad.ureche@gmail.com> | 2012-07-12 14:08:34 +0200 |
---|---|---|
committer | Vlad Ureche <vlad.ureche@gmail.com> | 2012-07-16 23:41:43 +0200 |
commit | f881249ba19084b194c0db07fd36ab2a68af5228 (patch) | |
tree | fddbf2a6106e158cf0762e9cc37c0eab9d5c0800 /test/scaladoc/run/SI-3314-diagrams.scala | |
parent | f916434c119289773e5aad88c633c30f68a12e14 (diff) | |
download | scala-f881249ba19084b194c0db07fd36ab2a68af5228.tar.gz scala-f881249ba19084b194c0db07fd36ab2a68af5228.tar.bz2 scala-f881249ba19084b194c0db07fd36ab2a68af5228.zip |
Scaladoc: Inherited templates in diagrams
Related to SI-3314, where we started showing inherited templates
that were normally not documented. This patch corrects a problem
in parentTypes that was preventing inherited templates from being
displayed in diagrams.
Also renamed:
PackageDiagram => ContentDiagram
ClassDiagram => InheritanceDiagram
which should have been done much earlier
Diffstat (limited to 'test/scaladoc/run/SI-3314-diagrams.scala')
-rw-r--r-- | test/scaladoc/run/SI-3314-diagrams.scala | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/test/scaladoc/run/SI-3314-diagrams.scala b/test/scaladoc/run/SI-3314-diagrams.scala new file mode 100644 index 0000000000..0b07e4c5bd --- /dev/null +++ b/test/scaladoc/run/SI-3314-diagrams.scala @@ -0,0 +1,37 @@ +import scala.tools.nsc.doc.model._ +import scala.tools.nsc.doc.model.diagram._ +import scala.tools.partest.ScaladocModelTest + +object Test extends ScaladocModelTest { + + override def resourceFile = "SI-3314-diagrams.scala" + + // no need for special settings + def scaladocSettings = "-diagrams" + + def testModel(rootPackage: Package) = { + // get the quick access implicit defs in scope (_package(s), _class(es), _trait(s), object(s) _method(s), _value(s)) + import access._ + + // just need to check the member exists, access methods will throw an error if there's a problem + val base = rootPackage._package("scala")._package("test")._package("scaladoc") + + val diagrams = base._package("diagrams") + def testDiagram(doc: DocTemplateEntity, diag: Option[Diagram], nodes: Int, edges: Int) = { + assert(diag.isDefined, doc.qualifiedName + " diagram missing") + assert(diag.get.nodes.length == nodes, + doc.qualifiedName + "'s diagram: node count " + diag.get.nodes.length + " == " + nodes) + assert(diag.get.edges.length == edges, + doc.qualifiedName + "'s diagram: edge count " + diag.get.edges.length + " == " + edges) + } + + val templates = List(diagrams._trait("WeekDayTraitWithDiagram"), diagrams._class("WeekDayClassWithDiagram"), diagrams._object("WeekDayObjectWithDiagram")) + + for (template <- templates) { + testDiagram(template, template.contentDiagram, 8, 7) + val subtemplates = List("Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun").map(template._object(_)) + for (subtemplate <- subtemplates) + testDiagram(subtemplate, subtemplate.inheritanceDiagram, 2, 1) + } + } +}
\ No newline at end of file |