mirror of
https://github.com/NorfairKing/feedback.git
synced 2024-11-27 00:47:13 +03:00
test optparse
This commit is contained in:
parent
45274a7637
commit
dce335cb25
@ -24,6 +24,7 @@ library
|
||||
Feedback.Loop
|
||||
Feedback.Loop.OptParse
|
||||
Feedback.Test
|
||||
Feedback.Test.OptParse
|
||||
other-modules:
|
||||
Paths_feedback
|
||||
hs-source-dirs:
|
||||
|
@ -1,6 +1,3 @@
|
||||
{-# LANGUAGE DerivingVia #-}
|
||||
{-# LANGUAGE OverloadedLists #-}
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE RecordWildCards #-}
|
||||
|
||||
module Feedback.Loop.OptParse where
|
||||
|
@ -1,5 +1,9 @@
|
||||
module Feedback.Test where
|
||||
|
||||
import Feedback.Test.OptParse
|
||||
|
||||
runFeedbackTest :: IO ()
|
||||
runFeedbackTest = do
|
||||
sets <- getSettings
|
||||
print sets
|
||||
pure ()
|
||||
|
31
feedback/src/Feedback/Test/OptParse.hs
Normal file
31
feedback/src/Feedback/Test/OptParse.hs
Normal file
@ -0,0 +1,31 @@
|
||||
{-# LANGUAGE RecordWildCards #-}
|
||||
|
||||
module Feedback.Test.OptParse where
|
||||
|
||||
import Control.Applicative
|
||||
import Control.Monad
|
||||
import Data.Map (Map)
|
||||
import qualified Data.Map as M
|
||||
import Feedback.Common.OptParse
|
||||
import GHC.Generics (Generic)
|
||||
import Text.Show.Pretty (pPrint)
|
||||
|
||||
getSettings :: IO TestSettings
|
||||
getSettings = do
|
||||
flags <- getFlags
|
||||
env <- getEnvironment
|
||||
config <- getConfiguration flags env
|
||||
combineToTestSettings flags env config
|
||||
|
||||
data TestSettings = TestSettings
|
||||
{ testSettingLoops :: !(Map String LoopSettings)
|
||||
}
|
||||
deriving (Show, Eq)
|
||||
|
||||
combineToTestSettings :: Flags -> Environment -> Maybe Configuration -> IO TestSettings
|
||||
combineToTestSettings flags@Flags {..} environment mConf = do
|
||||
testSettingLoops <-
|
||||
traverse
|
||||
(combineToLoopSettings flags environment (mConf >>= configOutputConfiguration))
|
||||
(maybe M.empty configLoops mConf)
|
||||
pure TestSettings {..}
|
Loading…
Reference in New Issue
Block a user