Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13705 from pikinier20/scaladoc/cats-feedback
Scaladoc: Fix bugs found while setting up cats
- Loading branch information
Showing
11 changed files
with
136 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package tests | ||
|
||
/** Some documentation that should be present in Scaladoc | ||
* | ||
* It's a test | ||
* | ||
*/ | ||
package object packageobjdocs { | ||
def placeholder: Int = 42 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
scaladoc/test/dotty/tools/scaladoc/PackageDocumentationTest.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package dotty.tools.scaladoc | ||
|
||
import org.junit.Assert._ | ||
import com.vladsch.flexmark.util.{ast => mdu, sequence} | ||
import com.vladsch.flexmark.{ast => mda} | ||
import collection.JavaConverters._ | ||
|
||
|
||
class PackageDocumentationTest extends ScaladocTest("packageobjdocs"): | ||
override def runTest: Unit = withModule { module => | ||
module.members.values.find { | ||
case member if member.kind == Kind.Package => true | ||
case _ => false | ||
}.flatMap(_.docs).map(_.body).fold(throw AssertionError("No package found or documentation is not present")) { | ||
case node: mdu.ContentNode => | ||
val text = node.getDescendants().asScala.toList.map { | ||
case node: mdu.ContentNode => node.getContentChars().toString() | ||
case _ => "" | ||
}.mkString | ||
assertTrue("Documentation for package is incorrect", text.contains("It's a test")) | ||
case _ => throw AssertionError("No documentation node found in package docs") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters