Testsuite: report which module failed the tests

This also fixes the problem that the testsuite threw `exitFailure`
even when it succeeded (which I found inexplicable).

Once this is published, the testsuite could be enabled in Stackage again.
This commit is contained in:
Andreas Abel 2023-12-06 18:41:53 +01:00
parent a71a13c2fc
commit b6d4952e2e
2 changed files with 21 additions and 17 deletions

1
.gitignore vendored
View File

@ -20,3 +20,4 @@ cabal.config
/parts/ /parts/
/prime/ /prime/
*.snap *.snap
/dist-newstyle/

View File

@ -18,21 +18,24 @@ import qualified ShellCheck.Parser
main = do main = do
putStrLn "Running ShellCheck tests..." putStrLn "Running ShellCheck tests..."
results <- sequence [ failures <- filter (not . snd) <$> mapM sequenceA tests
ShellCheck.Analytics.runTests if null failures then exitSuccess else do
,ShellCheck.AnalyzerLib.runTests putStrLn "Tests failed for the following module(s):"
,ShellCheck.ASTLib.runTests mapM (putStrLn . ("- ShellCheck." ++) . fst) failures
,ShellCheck.CFG.runTests exitFailure
,ShellCheck.CFGAnalysis.runTests where
,ShellCheck.Checker.runTests tests =
,ShellCheck.Checks.Commands.runTests [ ("Analytics" , ShellCheck.Analytics.runTests)
,ShellCheck.Checks.ControlFlow.runTests , ("AnalyzerLib" , ShellCheck.AnalyzerLib.runTests)
,ShellCheck.Checks.Custom.runTests , ("ASTLib" , ShellCheck.ASTLib.runTests)
,ShellCheck.Checks.ShellSupport.runTests , ("CFG" , ShellCheck.CFG.runTests)
,ShellCheck.Fixer.runTests , ("CFGAnalysis" , ShellCheck.CFGAnalysis.runTests)
,ShellCheck.Formatter.Diff.runTests , ("Checker" , ShellCheck.Checker.runTests)
,ShellCheck.Parser.runTests , ("Checks.Commands" , ShellCheck.Checks.Commands.runTests)
, ("Checks.ControlFlow" , ShellCheck.Checks.ControlFlow.runTests)
, ("Checks.Custom" , ShellCheck.Checks.Custom.runTests)
, ("Checks.ShellSupport", ShellCheck.Checks.ShellSupport.runTests)
, ("Fixer" , ShellCheck.Fixer.runTests)
, ("Formatter.Diff" , ShellCheck.Formatter.Diff.runTests)
, ("Parser" , ShellCheck.Parser.runTests)
] ]
if and results
then exitSuccess
else exitFailure