Skip to content

Commit

Permalink
Apply requested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
BarkingBad committed Oct 11, 2021
1 parent f5fd510 commit 36d1798
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 20 deletions.
38 changes: 19 additions & 19 deletions scaladoc/test/dotty/tools/scaladoc/BaseHtmlTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -23,26 +23,26 @@ class BaseHtmlTest:
withGeneratedDoc(Seq("site"), docsRoot = Some(base.toAbsolutePath.toString))(op)

def withGeneratedDoc(
pcks: Seq[String],
docsRoot: Option[String] = None,
customArgs: Option[Scaladoc.Args] = None,
)(
op: ProjectContext ?=> Unit,
): Unit =
val dest = customArgs.map(_.output).getOrElse(Files.createTempDirectory("test-doc").toFile)
try
val args = customArgs.getOrElse(Scaladoc.Args(
name = projectName,
tastyFiles = pcks.flatMap(tastyFiles(_)),
output = dest,
docsRoot = docsRoot,
projectVersion = Some(projectVersion)
))
Scaladoc.run(args)(using testContext)
op(using ProjectContext(args.output.toPath))

finally IO.delete(dest)
pcks: Seq[String],
docsRoot: Option[String] = None,
customArgs: Option[Scaladoc.Args] = None,
)(
op: ProjectContext ?=> Unit,
): Unit =
val dest = customArgs.fold(Files.createTempDirectory("test-doc").toFile)(_.output)
try
val args = customArgs.getOrElse(Scaladoc.Args(
name = projectName,
tastyFiles = pcks.flatMap(tastyFiles(_)),
output = dest,
docsRoot = docsRoot,
projectVersion = Some(projectVersion)
))
Scaladoc.run(args)(using testContext)
op(using ProjectContext(args.output.toPath))

finally IO.delete(dest)
end withGeneratedDoc
class DocumentContext(d: Document, path: Path):
import collection.JavaConverters._

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ class IndexPagesTest extends BaseHtmlTest:
def NOstaticSiteAndNOApiSubdirectory = gridTest(baseArgs.copy(docsRoot = None, apiSubdirectory = false))

private def gridTest(args: Scaladoc.Args) = withGeneratedDoc(Seq.empty, None, customArgs = Some(args)) {
println(args.output)
withHtmlFile("index.html") { content =>
content.fileExists
}
Expand Down

0 comments on commit 36d1798

Please sign in to comment.