Skip to content

Commit

Permalink
test(cli): Add a test to ensure shell completions are up-to-date
Browse files Browse the repository at this point in the history
Signed-off-by: Marcel Bochtler <[email protected]>
  • Loading branch information
MarcelBochtler committed Jan 29, 2025
1 parent 53792fb commit 466b782
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions cli/src/funTest/kotlin/OrtMainFunTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -215,5 +215,26 @@ class OrtMainFunTest : StringSpec() {
EnvironmentVariableFilter.isAllowed("PASSPORT") shouldBe true
EnvironmentVariableFilter.isAllowed("DB_PASS") shouldBe false
}

"shell completions should be up-to-date" {
val bashResult = OrtMain().test("--generate-completion=bash")
val fishResult = OrtMain().test("--generate-completion=fish")
val zshResult = OrtMain().test("--generate-completion=zsh")

withClue(
"""
Please update the completions by running the following command:
```
ort --generate-completion=bash > integrations/completions/ort-completion.bash; \
ort --generate-completion=fish > integrations/completions/ort-completion.fish; \
ort --generate-completion=zsh > integrations/completions/ort-completion.zsh;
```
""".trimIndent()
) {
bashResult.stdout shouldBe File("../integrations/completions/ort-completion.bash").readText()
fishResult.stdout shouldBe File("../integrations/completions/ort-completion.fish").readText()
zshResult.stdout shouldBe File("../integrations/completions/ort-completion.zsh").readText()
}
}
}
}

0 comments on commit 466b782

Please sign in to comment.