Skip to content

Commit

Permalink
Add an integration test to check if scaladoc correctly links local me…
Browse files Browse the repository at this point in the history
…mbers to local links
  • Loading branch information
KacperFKorban committed Jul 22, 2024
1 parent b761a79 commit 28a868f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
3 changes: 2 additions & 1 deletion build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ object `scala-cli-bsp` extends JavaModule with ScalaCliPublishModule {
object integration extends CliIntegration {
object test extends IntegrationScalaTests {
def ivyDeps = super.ivyDeps() ++ Seq(
Deps.jgit
Deps.jgit,
Deps.jsoup
)
}
object docker extends CliIntegrationDocker {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package scala.cli.integration

import com.eed3si9n.expecty.Expecty.expect
import org.jsoup._
import scala.jdk.CollectionConverters._

abstract class DocTestDefinitions extends ScalaCliSuite with TestScalaVersionArgs {
_: TestScalaVersion =>
Expand Down Expand Up @@ -55,8 +57,16 @@ abstract class DocTestDefinitions extends ScalaCliSuite with TestScalaVersionArg
"lib/Messages$.html"
)
val entries =
os.walk(root / dest).map(_.relativeTo(expectedDestDocPath)).map(_.toString()).toList
os.walk(root / dest).filter(!os.isDir(_)).map { path =>
path.relativeTo(expectedDestDocPath).toString() -> os.read(path)
}.toMap
expect(expectedEntries.forall(e => entries.contains(e)))

val documentableNameElement =
Jsoup.parse(entries("index.html")).select(".documentableName").asScala
documentableNameElement.filter(_.text().contains("lib")).foreach { element =>
expect(!element.attr("href").startsWith("http"))
}
}
}
}
2 changes: 2 additions & 0 deletions project/deps.sc
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ object Deps {
def coursierM1Cli = coursierDefault
def jsoniterScala = "2.23.2"
def jsoniterScalaJava8 = "2.13.5.2"
def jsoup = "1.18.1"
def scalaMeta = "4.9.8"
def scalaNative04 = "0.4.17"
def scalaNative05 = "0.5.4"
Expand Down Expand Up @@ -156,6 +157,7 @@ object Deps {
ivy"com.github.plokhotnyuk.jsoniter-scala::jsoniter-scala-macros:${Versions.jsoniterScalaJava8}"
def jsoniterMacrosJava8 =
ivy"com.github.plokhotnyuk.jsoniter-scala::jsoniter-scala-macros:${Versions.jsoniterScalaJava8}"
def jsoup = ivy"org.jsoup:jsoup:${Versions.jsoup}"
def libsodiumjni = ivy"org.virtuslab.scala-cli:libsodiumjni:0.0.4"
def macroParadise = ivy"org.scalamacros:::paradise:2.1.1"
def metaconfigTypesafe =
Expand Down

0 comments on commit 28a868f

Please sign in to comment.