Skip to content

Commit bd9f46a

Browse files
committed
Ensure all website/reference docs are included in sclicheck.DocTests
1 parent 4ef3475 commit bd9f46a

File tree

3 files changed

+15
-11
lines changed

3 files changed

+15
-11
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,12 +197,13 @@ To just check the documents, run:
197197
./mill -i docs-tests.test 'sclicheck.DocTests.*'
198198
```
199199

200-
You can also check all root docs, commands, guides or cookbooks:
200+
You can also check all root docs, commands, reference docs, guides or cookbooks:
201201
```bash
202202
./mill -i docs-tests.test 'sclicheck.DocTests.root*'
203203
./mill -i docs-tests.test 'sclicheck.DocTests.guide*'
204204
./mill -i docs-tests.test 'sclicheck.DocTests.command*'
205205
./mill -i docs-tests.test 'sclicheck.DocTests.cookbook*'
206+
./mill -i docs-tests.test 'sclicheck.DocTests.reference*'
206207
```
207208

208209
Similarly, you can check single files:

modules/docs-tests/src/test/scala/sclicheck/DocTests.scala

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
package sclicheck
22

33
class DocTests extends munit.FunSuite {
4+
case class DocTestEntry(name: String, path: os.Path, depth: Int = Int.MaxValue)
5+
46
val docsRootPath: os.Path = os.pwd / "website" / "docs"
5-
val dirs: Seq[(String, os.Path)] = Seq(
6-
"cookbook" -> docsRootPath / "cookbooks",
7-
"command" -> docsRootPath / "commands",
8-
"guide" -> docsRootPath / "guides"
7+
val entries: Seq[DocTestEntry] = Seq(
8+
DocTestEntry("root", docsRootPath, depth = 1),
9+
DocTestEntry("cookbook", docsRootPath / "cookbooks"),
10+
DocTestEntry("command", docsRootPath / "commands"),
11+
DocTestEntry("guide", docsRootPath / "guides"),
12+
DocTestEntry("reference", docsRootPath / "reference")
913
)
1014

1115
val options: Options = Options(scalaCliCommand = Seq(TestUtil.scalaCliPath))
@@ -19,9 +23,8 @@ class DocTests extends munit.FunSuite {
1923
os.read.lines(f).exists(lineContainsAnyChecks)
2024

2125
for {
22-
(tpe, dir) <- dirs :+ ("root", docsRootPath)
23-
maxDepth = if dir == docsRootPath then 1 else Int.MaxValue
24-
inputs = os.walk(dir, maxDepth = maxDepth)
26+
DocTestEntry(tpe, dir, depth) <- entries
27+
inputs = os.walk(dir, maxDepth = depth)
2528
.filter(_.last.endsWith(".md"))
2629
.filter(os.isFile(_))
2730
.filter(fileContainsAnyChecks)

website/docs/reference/scala-command/index.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ There are two recommended ways to test and use Scala CLI:
1818

1919
- with brew:
2020

21-
```bash
21+
```bash ignore
2222
brew install virtuslab/scala-experimental/scala
2323
```
2424

2525
- with coursier:
2626

27-
```bash
27+
```bash ignore
2828
cs setup
2929
cs install scala-experimental ← this command will replace the default scala runner
3030
```
3131

32-
Alternatively, you can rename your `scala-cli` executable or alias it as `scala`
32+
Alternatively, you can rename your `scala-cli` executable or alias it as `scala`

0 commit comments

Comments
 (0)