diff options
author | Josh Suereth <Joshua.Suereth@gmail.com> | 2012-10-11 10:49:03 -0700 |
---|---|---|
committer | Josh Suereth <Joshua.Suereth@gmail.com> | 2012-10-11 10:49:03 -0700 |
commit | 553ee0118dbc052bed8c4580376b48cd9cb5d0f9 (patch) | |
tree | 4926c23ca47a334a5bba5863d90102ced446389c /test/scaladoc | |
parent | 90c7596c0736d56ff7b8d699bd958d28cb213bdf (diff) | |
parent | 2edf78f3a05112961ed6ad56452e9b5dc150fc3c (diff) | |
download | scala-553ee0118dbc052bed8c4580376b48cd9cb5d0f9.tar.gz scala-553ee0118dbc052bed8c4580376b48cd9cb5d0f9.tar.bz2 scala-553ee0118dbc052bed8c4580376b48cd9cb5d0f9.zip |
Merge pull request #1491 from VladUreche/topic/scaladoc2
Scaladoc bugfixes for reflection
Diffstat (limited to 'test/scaladoc')
-rw-r--r-- | test/scaladoc/resources/SI-6509.scala | 24 | ||||
-rw-r--r-- | test/scaladoc/resources/SI-6511.scala | 24 | ||||
-rw-r--r-- | test/scaladoc/resources/links.scala | 14 | ||||
-rw-r--r-- | test/scaladoc/run/SI-6509.check | 1 | ||||
-rw-r--r-- | test/scaladoc/run/SI-6509.scala | 30 | ||||
-rw-r--r-- | test/scaladoc/run/SI-6511.check | 1 | ||||
-rw-r--r-- | test/scaladoc/run/SI-6511.scala | 22 | ||||
-rw-r--r-- | test/scaladoc/run/groups.scala | 94 | ||||
-rw-r--r-- | test/scaladoc/run/links.scala | 7 |
9 files changed, 171 insertions, 46 deletions
diff --git a/test/scaladoc/resources/SI-6509.scala b/test/scaladoc/resources/SI-6509.scala new file mode 100644 index 0000000000..540ba243bd --- /dev/null +++ b/test/scaladoc/resources/SI-6509.scala @@ -0,0 +1,24 @@ +package test.scaladoc.template.owners + +trait X { + /** @template */ + type Symbol >: Null <: SymbolApi + + /** @template */ + type TypeSymbol >: Null <: Symbol with TypeSymbolApi + + /** @template */ + type TermSymbol >: Null <: Symbol with TermSymbolApi + + /** @template */ + type MethodSymbol >: Null <: TermSymbol with MethodSymbolApi + + trait SymbolApi { this: Symbol => def x: Int} + trait TermSymbolApi extends SymbolApi { this: TermSymbol => def y: Int} + trait TypeSymbolApi extends SymbolApi { this: TypeSymbol => def z: Int} + trait MethodSymbolApi extends TermSymbolApi { this: MethodSymbol => def t: Int } +} + +trait Y extends X +trait Z extends Y +trait T extends Z diff --git a/test/scaladoc/resources/SI-6511.scala b/test/scaladoc/resources/SI-6511.scala new file mode 100644 index 0000000000..1f153caeb0 --- /dev/null +++ b/test/scaladoc/resources/SI-6511.scala @@ -0,0 +1,24 @@ +package test.scaladoc.template.diagrams + +/** @contentDiagram hideNodes "*Api" */ +trait X { + /** @template */ + type Symbol >: Null <: SymbolApi + + /** @template */ + type TypeSymbol >: Null <: Symbol with TypeSymbolApi + + /** @template */ + type TermSymbol >: Null <: Symbol with TermSymbolApi + + /** @template */ + type MethodSymbol >: Null <: TermSymbol with MethodSymbolApi + + trait SymbolApi { this: Symbol => def x: Int} + trait TermSymbolApi extends SymbolApi { this: TermSymbol => def y: Int} + trait TypeSymbolApi extends SymbolApi { this: TypeSymbol => def z: Int} + trait MethodSymbolApi extends TermSymbolApi { this: MethodSymbol => def t: Int } +} + +/** @contentDiagram hideNodes "*Api" */ +trait Y extends X diff --git a/test/scaladoc/resources/links.scala b/test/scaladoc/resources/links.scala index 09a52a4334..bd69665357 100644 --- a/test/scaladoc/resources/links.scala +++ b/test/scaladoc/resources/links.scala @@ -3,6 +3,9 @@ // SI-4497 "Links in ScalaDoc - Spec and implementation unsufficient" // SI-4224 "Wiki-links should support method targets" // SI-3695 "support non-fully-qualified type links in scaladoc comments" +// SI-6487 "Scaladoc can't link to inner classes" +// SI-6495 "Scaladoc won't pick up group name, priority and description from owner chain" +// SI-6501 "Scaladoc won't link to a @template type T as a template but as a member" package scala.test.scaladoc.links { import language.higherKinds class C @@ -54,9 +57,18 @@ package scala.test.scaladoc.links { * - [[localMethod object TEST -> localMethod]] (should use the current template to resolve link instead of inTpl, that's the package) * - [[#localMethod object TEST -> localMethod]] (should exercise Java-style links to empty members) * - [[ImOutside class ImOutside (check correct lookup in EmptyPackage)]] + * - [[ImOutside.Inner#foo class ImOutside#class Inner#method foo (check correct lookup in EmptyPackage)]] + * - [[ImOutside.T class ImOutside#type T (check correct linking to templates)]] + * - [[ImOutside.T#foo class ImOutside#type T#method foo (check correct interaction between @template and links)]] */ object TEST { def localMethod = 3 } } -class ImOutside
\ No newline at end of file +trait ImOutside { + /** @template */ + type T <: Inner + class Inner { + def foo: Any + } +} diff --git a/test/scaladoc/run/SI-6509.check b/test/scaladoc/run/SI-6509.check new file mode 100644 index 0000000000..3925a0d464 --- /dev/null +++ b/test/scaladoc/run/SI-6509.check @@ -0,0 +1 @@ +Done.
\ No newline at end of file diff --git a/test/scaladoc/run/SI-6509.scala b/test/scaladoc/run/SI-6509.scala new file mode 100644 index 0000000000..3857949d14 --- /dev/null +++ b/test/scaladoc/run/SI-6509.scala @@ -0,0 +1,30 @@ +import scala.tools.nsc.doc.model._ +import scala.tools.partest.ScaladocModelTest + +object Test extends ScaladocModelTest { + + override def resourceFile: String = "SI-6509.scala" + + // no need for special settings + def scaladocSettings = "" + + 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._ + + val main = rootPackage._package("test")._package("scaladoc")._package("template")._package("owners") + val X = main._trait("X") + val Y = main._trait("Y") + val Z = main._trait("Z") + val T = main._trait("T") + + def checkTemplateOwner(d: DocTemplateEntity) = + for (mbr <- List("Symbol", "TypeSymbol", "TermSymbol", "MethodSymbol")) { + val tpl = d._absTypeTpl(mbr).inTemplate + assert(tpl == X, tpl + " == X") + } + + for (tpl <- List(X, Y, Z, T)) + checkTemplateOwner(tpl) + } +}
\ No newline at end of file diff --git a/test/scaladoc/run/SI-6511.check b/test/scaladoc/run/SI-6511.check new file mode 100644 index 0000000000..3925a0d464 --- /dev/null +++ b/test/scaladoc/run/SI-6511.check @@ -0,0 +1 @@ +Done.
\ No newline at end of file diff --git a/test/scaladoc/run/SI-6511.scala b/test/scaladoc/run/SI-6511.scala new file mode 100644 index 0000000000..cc950a98d6 --- /dev/null +++ b/test/scaladoc/run/SI-6511.scala @@ -0,0 +1,22 @@ +import scala.tools.nsc.doc.model._ +import scala.tools.partest.ScaladocModelTest + +object Test extends ScaladocModelTest { + + override def resourceFile: String = "SI-6511.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._ + + val main = rootPackage._package("test")._package("scaladoc")._package("template")._package("diagrams") + val X = main._trait("X") + val Y = main._trait("Y") + + testDiagram(X, X.contentDiagram, nodes = 4, edges = 3) + testDiagram(Y, Y.contentDiagram, nodes = 4, edges = 3) + } +}
\ No newline at end of file diff --git a/test/scaladoc/run/groups.scala b/test/scaladoc/run/groups.scala index 05324c2ec9..c9e4a8679b 100644 --- a/test/scaladoc/run/groups.scala +++ b/test/scaladoc/run/groups.scala @@ -4,49 +4,54 @@ import scala.tools.partest.ScaladocModelTest object Test extends ScaladocModelTest { override def code = """ - package test.scaladoc.groups { - - /** - * The trait A - * @groupdesc A Group A is the group that contains functions starting with f - * For example: - * {{{ - * this is an example - * }}} - * @groupdesc B Group B is the group that contains functions starting with b - * @groupname B Group B has a nice new name and a high priority - * @groupprio B -10 - * @group Traits - * @note This is a note - */ - trait A { - /** foo description - * @group A */ - def foo = 1 - - /** bar description - * @group B */ - def bar = 2 - } - - /** The trait B - * @group Traits - * @groupdesc C Group C is introduced by B - */ - trait B { - /** baz descriptopn - * @group C */ - def baz = 3 - } - - /** The class C which inherits from both A and B - * @group Classes - * @groupdesc B Look ma, I'm overriding group descriptions!!! - * @groupname B And names - */ - class C extends A with B { - /** Oh noes, I lost my group -- or did I?!? */ - override def baz = 4 + package test.scaladoc { + + /** @groupname Z From owner chain */ + package object `groups` + + package groups { + /** + * The trait A + * @groupdesc A Group A is the group that contains functions starting with f + * For example: + * {{{ + * this is an example + * }}} + * @groupdesc B Group B is the group that contains functions starting with b + * @groupname B Group B has a nice new name and a high priority + * @groupprio B -10 + * @group Traits + * @note This is a note + */ + trait A { + /** foo description + * @group A */ + def foo = 1 + + /** bar description + * @group B */ + def bar = 2 + } + + /** The trait B + * @group Traits + * @groupdesc C Group C is introduced by B + */ + trait B { + /** baz descriptopn + * @group C */ + def baz = 3 + } + + /** The class C which inherits from both A and B + * @group Classes + * @groupdesc B Look ma, I'm overriding group descriptions!!! + * @groupname B And names + */ + class C extends A with B { + /** Oh noes, I lost my group -- or did I?!? */ + override def baz = 4 + } } } """ @@ -101,10 +106,12 @@ object Test extends ScaladocModelTest { checkGroupDesc(A, "B", "Group B is the group that contains functions starting with b") checkGroupName(A, "B", "Group B has a nice new name and a high priority") checkGroupPrio(A, "B", -10) + checkGroupName(A, "Z", "From owner chain") checkGroupDesc(B, "C", "Group C is introduced by B") checkGroupName(B, "C", "C") checkGroupPrio(B, "C", 0) + checkGroupName(B, "Z", "From owner chain") checkGroupDesc(C, "A", "Group A is the group that contains functions starting with f") checkGroupName(C, "A", "A") @@ -115,5 +122,6 @@ object Test extends ScaladocModelTest { checkGroupDesc(C, "C", "Group C is introduced by B") checkGroupName(C, "C", "C") checkGroupPrio(C, "C", 0) + checkGroupName(C, "Z", "From owner chain") } }
\ No newline at end of file diff --git a/test/scaladoc/run/links.scala b/test/scaladoc/run/links.scala index de359539cf..0c67857e1c 100644 --- a/test/scaladoc/run/links.scala +++ b/test/scaladoc/run/links.scala @@ -5,6 +5,9 @@ import scala.tools.partest.ScaladocModelTest // SI-4497 "Links in ScalaDoc - Spec and implementation unsufficient" // SI-4224 "Wiki-links should support method targets" // SI-3695 "support non-fully-qualified type links in scaladoc comments" +// SI-6487 "Scaladoc can't link to inner classes" +// SI-6495 "Scaladoc won't pick up group name, priority and description from owner chain" +// SI-6501 "Scaladoc won't link to a @template type T as a template but as a member" object Test extends ScaladocModelTest { override def resourceFile = "links.scala" @@ -22,7 +25,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 == 15, memberLinks + " == 15 (the member links in object TEST)") - assert(templateLinks == 5, templateLinks + " == 5 (the template links in object TEST)") + assert(memberLinks == 17, memberLinks + " == 17 (the member links in object TEST)") + assert(templateLinks == 6, templateLinks + " == 6 (the template links in object TEST)") } }
\ No newline at end of file |