ghcup-hs/test/optparse-test/OtherCommandTest.hs

39 lines
1.1 KiB
Haskell
Raw Permalink Normal View History

2023-07-22 09:14:49 +00:00
module OtherCommandTest where
import Test.Tasty
import Test.Tasty.HUnit
import GHCup.OptParse
import Utils
import Control.Monad.IO.Class
otherCommandTests :: TestTree
otherCommandTests = testGroup "other command"
[ testCase "debug-info" $ do
res <- parseWith ["debug-info"]
liftIO $ assertBool "debug-info parse failed" (isDInfo res)
, testCase "tool-requirements" $ do
ToolRequirements opt <- parseWith ["tool-requirements"]
liftIO $ tlrRaw opt @?= False
, testCase "tool-requirements -r" $ do
ToolRequirements opt <- parseWith ["tool-requirements", "--raw-format"]
liftIO $ tlrRaw opt @?= True
2023-07-22 09:20:42 +00:00
, testCase "nuke" $ do
res <- parseWith ["nuke"]
liftIO $ assertBool "nuke parse failed" (isNuke res)
2023-07-23 07:19:13 +00:00
, testCase "test ghc" $ do
res <- parseWith ["test", "ghc"]
liftIO $ assertBool "test parse failed" (isTest res)
2023-07-22 09:14:49 +00:00
]
isDInfo :: Command -> Bool
isDInfo DInfo = True
isDInfo _ = False
2023-07-22 09:20:42 +00:00
isNuke :: Command -> Bool
isNuke Nuke = True
isNuke _ = False
2023-07-23 07:19:13 +00:00
isTest :: Command -> Bool
isTest (Test _) = True
isTest _ = False