Skip to content
Snippets Groups Projects
Commit 9ead3f7f authored by andreas.abel's avatar andreas.abel Committed by Mikolaj
Browse files

Test that the last line `--help` is the name of the config file

Ensure that the last line of the help text is the name of the config file.
This invariant is used by clients such as the Haskell setup github action.

See: https://github.com/haskell-actions/setup/pull/63
parent c58e17d8
No related branches found
No related tags found
No related merge requests found
# cabal --help
-- Andreas Abel, 2024-01-13
--
-- Ensure that the last line of the help text is the name of the config file.
-- This invariant is used by clients such as the Haskell setup github action.
-- See: https://github.com/haskell-actions/setup/pull/63
import Distribution.Utils.String (trim)
import Test.Cabal.Prelude
main = cabalTest $ do
env <- getTestEnv
res <- cabal' "--help" []
-- The end of the help text should be something like:
--
-- > You can edit the cabal configuration file to set defaults:
-- > <<HOME>>/.cabal/config
--
-- So trimming the last line will give us the name of the config file.
let configFile = trim . last . lines . resultOutput $ res
-- Verify that this is indeed the config file.
assertEqual "Last line of help text should be name of the config file"
(testUserCabalConfigFile env)
configFile
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment