From 1447fda22339c992167a4c2b633e26b43b707c6a Mon Sep 17 00:00:00 2001 From: Rebecca Turner Date: Fri, 4 Oct 2024 15:15:27 -0700 Subject: [PATCH] Add `--tasty-arg` to `validate.sh` This lets you add custom arguments to `Tasty` test suites. This can be used to set `--keep-tmp-files` for debugging, or to run a particular test in `cabal-testsuite`: ./validate.sh -v -s build -s cli-suite \ --tasty-arg PackageTests/HaddockKeepTmpsCustom/cabal.test.hs --- cabal-validate/src/Cli.hs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/cabal-validate/src/Cli.hs b/cabal-validate/src/Cli.hs index ef01d907594..423769cd1d9 100644 --- a/cabal-validate/src/Cli.hs +++ b/cabal-validate/src/Cli.hs @@ -234,9 +234,11 @@ resolveOpts opts = do tastyArgs' = "--hide-successes" - : case rawTastyPattern opts of - Just tastyPattern -> ["--pattern", tastyPattern] - Nothing -> [] + : maybe + [] + (\tastyPattern -> ["--pattern", tastyPattern]) + (rawTastyPattern opts) + ++ rawTastyArgs opts when (rawListSteps opts) $ do -- TODO: This should probably list _all_ available steps, not just the selected ones! @@ -279,6 +281,7 @@ data RawOpts = RawOpts , rawCabal :: FilePath , rawExtraCompilers :: [FilePath] , rawTastyPattern :: Maybe String + , rawTastyArgs :: [String] , rawDoctest :: Bool , rawSteps :: [Step] , rawListSteps :: Bool @@ -343,6 +346,12 @@ rawOptsParser = <> help "Pattern to filter tests by" <> value Nothing ) + <*> many + ( strOption + ( long "tasty-arg" + <> help "Extra arguments to pass to Tasty test suites" + ) + ) <*> boolOption False "doctest"