`cabal check`: clearly mark Errors (#8908)
[cabal.git] / cabal-install / tests / UnitTests / Options.hs
blob232f80a271147cbeab56580a3ca96c788e2e38aa
1 {-# LANGUAGE DeriveDataTypeable #-}
3 module UnitTests.Options
4 ( OptionShowSolverLog (..)
5 , OptionMtimeChangeDelay (..)
6 , RunNetworkTests (..)
7 , extraOptions
9 where
11 import Data.Proxy
12 import Data.Typeable
14 import Test.Tasty.Options
16 {-------------------------------------------------------------------------------
17 Test options
18 -------------------------------------------------------------------------------}
20 extraOptions :: [OptionDescription]
21 extraOptions =
22 [ Option (Proxy :: Proxy OptionShowSolverLog)
23 , Option (Proxy :: Proxy OptionMtimeChangeDelay)
24 , Option (Proxy :: Proxy RunNetworkTests)
27 newtype OptionShowSolverLog = OptionShowSolverLog Bool
28 deriving (Typeable)
30 instance IsOption OptionShowSolverLog where
31 defaultValue = OptionShowSolverLog False
32 parseValue = fmap OptionShowSolverLog . safeReadBool
33 optionName = return "show-solver-log"
34 optionHelp = return "Show full log from the solver"
35 optionCLParser = flagCLParser Nothing (OptionShowSolverLog True)
37 newtype OptionMtimeChangeDelay = OptionMtimeChangeDelay Int
38 deriving (Typeable)
40 instance IsOption OptionMtimeChangeDelay where
41 defaultValue = OptionMtimeChangeDelay 0
42 parseValue = fmap OptionMtimeChangeDelay . safeRead
43 optionName = return "mtime-change-delay"
44 optionHelp =
45 return $
46 "How long to wait before attempting to detect"
47 ++ "file modification, in microseconds"
49 newtype RunNetworkTests = RunNetworkTests Bool
50 deriving (Typeable)
52 instance IsOption RunNetworkTests where
53 defaultValue = RunNetworkTests True
54 parseValue = fmap RunNetworkTests . safeReadBool
55 optionName = return "run-network-tests"
56 optionHelp = return "Run tests that need network access (default true)."