diff options
Diffstat (limited to 'test/scaladoc/run')
-rw-r--r-- | test/scaladoc/run/SI-6017.scala | 28 | ||||
-rw-r--r-- | test/scaladoc/run/SI-6580.scala | 1 | ||||
-rw-r--r-- | test/scaladoc/run/SI-9620.check (renamed from test/scaladoc/run/SI-6017.check) | 0 | ||||
-rw-r--r-- | test/scaladoc/run/SI-9620.scala | 42 | ||||
-rw-r--r-- | test/scaladoc/run/shortDescription-annotation.check | 1 | ||||
-rw-r--r-- | test/scaladoc/run/shortDescription-annotation.scala | 55 | ||||
-rw-r--r-- | test/scaladoc/run/t7905.check | 1 | ||||
-rw-r--r-- | test/scaladoc/run/t7905.scala | 36 | ||||
-rw-r--r-- | test/scaladoc/run/t9752.check | 5 | ||||
-rw-r--r-- | test/scaladoc/run/t9752.scala | 28 |
10 files changed, 168 insertions, 29 deletions
diff --git a/test/scaladoc/run/SI-6017.scala b/test/scaladoc/run/SI-6017.scala deleted file mode 100644 index 9951534c6d..0000000000 --- a/test/scaladoc/run/SI-6017.scala +++ /dev/null @@ -1,28 +0,0 @@ -import scala.tools.nsc.doc -import scala.tools.nsc.doc.model._ -import scala.tools.nsc.doc.html.page.{Index, ReferenceIndex} -import scala.tools.partest.ScaladocModelTest - -object Test extends ScaladocModelTest { - override def scaladocSettings = "" - override def code = """ - class STAR - class Star - """ - - def testModel(rootPackage: Package) { - model match { - case Some(universe) => { - val index = IndexModelFactory.makeIndex(universe) - // Because "STAR" and "Star" are different - assert(index.firstLetterIndex('s').keys.toSeq.length == 2) - - val indexPage = new Index(universe, index) - val letters = indexPage.letters - assert(letters.length > 1) - assert(letters(0).toString == "<span>#</span>") - } - case _ => assert(false) - } - } -} diff --git a/test/scaladoc/run/SI-6580.scala b/test/scaladoc/run/SI-6580.scala index c544138f44..55168a060b 100644 --- a/test/scaladoc/run/SI-6580.scala +++ b/test/scaladoc/run/SI-6580.scala @@ -1,6 +1,5 @@ import scala.tools.nsc.doc import scala.tools.nsc.doc.model._ -import scala.tools.nsc.doc.html.page.{Index, ReferenceIndex} import scala.tools.partest.ScaladocModelTest object Test extends ScaladocModelTest { diff --git a/test/scaladoc/run/SI-6017.check b/test/scaladoc/run/SI-9620.check index 619c56180b..619c56180b 100644 --- a/test/scaladoc/run/SI-6017.check +++ b/test/scaladoc/run/SI-9620.check diff --git a/test/scaladoc/run/SI-9620.scala b/test/scaladoc/run/SI-9620.scala new file mode 100644 index 0000000000..cac34d1c18 --- /dev/null +++ b/test/scaladoc/run/SI-9620.scala @@ -0,0 +1,42 @@ +import scala.tools.nsc.doc.model._ +import scala.tools.partest.ScaladocModelTest + +object Test extends ScaladocModelTest { + override def code = """ + package a + + trait Foo[S] { + def foo(t: S): Int = 123 + } + + /** Boo with only one foo method, hopefully! + * @hideImplicitConversion BooShouldNotAppearIsFoo + */ + trait Boo[T] + + object Boo { + sealed trait ShouldNotAppear + implicit class BooShouldNotAppearIsFoo(boo: Boo[ShouldNotAppear]) extends Foo[ShouldNotAppear] + implicit class BooLongIsFoo(boo: Boo[Long]) extends Foo[Long] + } + """ + + def scaladocSettings = "-implicits" + + def testModel(rootPackage: Package) = { + import access._ + + // Assert Boo only has one implicit conversion + val boo = rootPackage._package("a")._trait("Boo") + val conversions = boo._conversions("a.Boo.BooShouldNotAppearIsFoo") ++ boo._conversions("a.Boo.BooLongIsFoo") + assert(conversions.length == 1, conversions.length + " == 1") + + // Assert that the implicit conversion is not "BooShouldNotAppearIsFoo" + assert(conversions.head.conversionShortName == "BooLongIsFoo", + conversions.head.conversionShortName + " == BooLongIsFoo") + + // Assert that the same for full path + assert(conversions.head.conversionQualifiedName == "a.Boo.BooLongIsFoo", + conversions.head.conversionQualifiedName + " == a.Boo.BooLongIsFoo") + } +} diff --git a/test/scaladoc/run/shortDescription-annotation.check b/test/scaladoc/run/shortDescription-annotation.check new file mode 100644 index 0000000000..619c56180b --- /dev/null +++ b/test/scaladoc/run/shortDescription-annotation.check @@ -0,0 +1 @@ +Done. diff --git a/test/scaladoc/run/shortDescription-annotation.scala b/test/scaladoc/run/shortDescription-annotation.scala new file mode 100644 index 0000000000..0e2950f4f9 --- /dev/null +++ b/test/scaladoc/run/shortDescription-annotation.scala @@ -0,0 +1,55 @@ +import scala.tools.nsc.doc.model._ +import scala.tools.partest.ScaladocModelTest + +object Test extends ScaladocModelTest { + override def code = """ + package a + + /** This comment should not appear + * @shortDescription This one should appear + */ + class Foo { + /** This comment should appear */ + def foo: Int = 1 + + /** This comment should not appear + * @shortDescription This comment should appear + */ + def goo: Int = 2 + } + """ + + // no need for special settings + def scaladocSettings = "" + + def testModel(rootPackage: Package) = { + import scala.tools.nsc.doc.base.comment._ + import access._ + + def inlineToStr(inl: Inline): String = inl match { + case Chain(items) => items flatMap (inlineToStr(_)) mkString "" + case Italic(in) => inlineToStr(in) + case Bold(in) => inlineToStr(in) + case Underline(in) => inlineToStr(in) + case Monospace(in) => inlineToStr(in) + case Text(text) => text + case Summary(in) => inlineToStr(in) + case EntityLink(Text(text), _) => text + case _ => inl.toString + } + + val foo = rootPackage._package("a")._class("Foo") + + // Assert that the class has the correct short description + val classDesc = inlineToStr(foo.comment.get.short) + assert(classDesc == "This one should appear", classDesc) + + // Assert that the `foo` method has the correct short description + val fooDesc = inlineToStr(foo._method("foo").comment.get.short) + assert(fooDesc == "This comment should appear", fooDesc) + + // Assert that the `goo` method has the correct short description + val gooDesc = inlineToStr(foo._method("goo").comment.get.short) + assert(gooDesc == "This comment should appear", gooDesc) + } +} diff --git a/test/scaladoc/run/t7905.check b/test/scaladoc/run/t7905.check new file mode 100644 index 0000000000..619c56180b --- /dev/null +++ b/test/scaladoc/run/t7905.check @@ -0,0 +1 @@ +Done. diff --git a/test/scaladoc/run/t7905.scala b/test/scaladoc/run/t7905.scala new file mode 100644 index 0000000000..8570724470 --- /dev/null +++ b/test/scaladoc/run/t7905.scala @@ -0,0 +1,36 @@ +import scala.tools.nsc.doc.model._ +import scala.tools.partest.ScaladocModelTest + +object Test extends ScaladocModelTest { + override def code = """ + object A { + val foo = new B { + val bar = new C { + val baz: A.this.type = A.this + } + } + } + + trait B { + type E = bar.D + + val bar: C + } + + trait C { + trait D + } + + trait G { + type F = A.foo.E + + def m(f: F) = f match { + case _: A.foo.bar.D => // error here + } + } + """ + + def scaladocSettings = "" + + def testModel(root: Package) = () +} diff --git a/test/scaladoc/run/t9752.check b/test/scaladoc/run/t9752.check new file mode 100644 index 0000000000..daeafb8ecc --- /dev/null +++ b/test/scaladoc/run/t9752.check @@ -0,0 +1,5 @@ +List(Body(List(Paragraph(Chain(List(Summary(Text())))), Code(class A + + +class B)))) +Done. diff --git a/test/scaladoc/run/t9752.scala b/test/scaladoc/run/t9752.scala new file mode 100644 index 0000000000..b11c7f5c32 --- /dev/null +++ b/test/scaladoc/run/t9752.scala @@ -0,0 +1,28 @@ +import scala.tools.nsc.doc.model._ +import scala.tools.partest.ScaladocModelTest + +object Test extends ScaladocModelTest { + + override def code = s""" + /** + * Foo + * + * @example + * {{{ + * class A + * + * + * class B + * }}} + */ + object Foo + """ + + def scaladocSettings = "" + + def testModel(root: Package) = { + import access._ + val obj = root._object("Foo") + println(obj.comment.get.example) + } +} |