git @ Cat's Eye Technologies Falderal / 2197d0d
Haskell tests require only runhaskell now. catseye 13 years ago
2 changed file(s) with 5 addition(s) and 12 deletion(s). Raw diff Collapse all Expand all
6363 ""
6464
6565 prelude blocks =
66 "module GeneratedFalderalTests where\n\
67 \\n\
68 \-- This file was automatically generated by Test.Falderal.Formatter.Haskell\n\
66 "-- This file was automatically generated by Test.Falderal.Formatter.Haskell\n\
6967 \-- Edit at your own risk!\n\
7068 \\n\
7169 \import qualified Control.Exception as Exc\n\
72 \\n" ++ (gatherImports blocks []) ++ "\
70 \" ++ (gatherImports blocks []) ++ "\
7371 \\n\
7472 \runFun testFun inputText = do\n\
7573 \ Exc.catch (Exc.evaluate (Left $! (testFun inputText)))\n\
9694 \ putStrLn (getText result)\n\
9795 \ report rest\n\
9896 \\n\
99 \testModule = report [\n"
97 \main = report [\n"
10098
10199 postlude =
102100 " (-1,id,\"\")\n\
3636 determineVerbosity (Verbosity v:_) = (read v) :: Int
3737 determineVerbosity (_:rest) = determineVerbosity rest
3838
39 determineHaskellRunCommand [] = "ghc -e testModule"
39 determineHaskellRunCommand [] = "runhaskell"
4040 determineHaskellRunCommand (HaskellRunCommand s:_) = s
4141 determineHaskellRunCommand (_:rest) = determineHaskellRunCommand rest
4242
6363
6464 options :: [OptDescr Flag]
6565 options = [
66 Option ['h'] ["haskell-command"] (ReqArg HaskellRunCommand "CMD") "command to run Haskell tests (default: 'ghc -e testModule')",
66 Option ['h'] ["haskell-command"] (ReqArg HaskellRunCommand "CMD") "command to run Haskell tests (default: 'runhaskell')",
6767 Option ['m'] ["messy"] (NoArg Messy) "messy: do not delete generated files (default: clean)",
6868 Option ['r'] ["report-format"] (ReqArg ReportFormat "FORMAT") "success/failure report format (default: standard)",
6969 Option ['s'] ["shell-command"] (ReqArg ShellRunCommand "CMD") "command to run shell scripts (default: 'sh')",
9292
9393 dispatch _ _ = putStrLn header
9494
95 --
96 -- Requires ghc. Requires Test.Falderal in the package path
97 -- (easiest way to ensure this is to install it as a Cabal package)
98 -- TODO: require only runhaskell.
99 --
10095 testHaskell blocks flags =
10196 runTests blocks "GeneratedFalderalTests.hs" "haskell" ((determineHaskellRunCommand flags) ++ " GeneratedFalderalTests.hs") (Messy `elem` flags)
10297