conferer-hspec 0.2.0.0 → 0.3.0.0
raw patch · 3 files changed
+100/−97 lines, 3 filesdep ~confererPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: conferer
API changes (from Hackage documentation)
- Conferer.FetchFromConfig.Hspec: instance Conferer.Types.DefaultConfig Test.Hspec.Core.Config.Options.Config
- Conferer.FetchFromConfig.Hspec: instance Conferer.Types.FetchFromConfig Test.Hspec.Core.Config.Options.ColorMode
- Conferer.FetchFromConfig.Hspec: instance Conferer.Types.FetchFromConfig Test.Hspec.Core.Config.Options.Config
- Conferer.FetchFromConfig.Hspec: instance Conferer.Types.FetchFromConfig Test.Hspec.Core.Formatters.Monad.Formatter
+ Conferer.FromConfig.Hspec: instance Conferer.Types.DefaultConfig Test.Hspec.Core.Config.Options.Config
+ Conferer.FromConfig.Hspec: instance Conferer.Types.FromConfig Test.Hspec.Core.Config.Options.ColorMode
+ Conferer.FromConfig.Hspec: instance Conferer.Types.FromConfig Test.Hspec.Core.Config.Options.Config
+ Conferer.FromConfig.Hspec: instance Conferer.Types.FromConfig Test.Hspec.Core.Formatters.Monad.Formatter
Files
- conferer-hspec.cabal +6/−6
- src/Conferer/FetchFromConfig/Hspec.hs +0/−91
- src/Conferer/FromConfig/Hspec.hs +94/−0
conferer-hspec.cabal view
@@ -4,10 +4,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: ec0432f07b29a7101c5004991c7cd9e80bbc6f12fc077f67f9b9c60e6dc7668b+-- hash: 23f94309bd33cc015e5a963e13e899bda40c3bebc3ed2a2eb3c5b9e8eda26f9a name: conferer-hspec-version: 0.2.0.0+version: 0.3.0.0 synopsis: conferer's FromConfig instances for hspec Config description: Library to abstract the parsing of many haskell config values from different config sources@@ -25,7 +25,7 @@ library exposed-modules:- Conferer.FetchFromConfig.Hspec+ Conferer.FromConfig.Hspec other-modules: Paths_conferer_hspec hs-source-dirs:@@ -33,12 +33,12 @@ default-extensions: OverloadedStrings LambdaCase QuasiQuotes ScopedTypeVariables build-depends: base >=4.3 && <5- , conferer >=0.2.0.0 && <0.3.0.0+ , conferer >=0.3.0.0 && <0.4.0.0 , hspec-core >=2.0.0 && <2.8.0 , text >=1.1 && <1.3 default-language: Haskell2010 -test-suite conferer-hspec-test+test-suite specs type: exitcode-stdio-1.0 main-is: Spec.hs other-modules:@@ -48,7 +48,7 @@ default-extensions: OverloadedStrings LambdaCase QuasiQuotes ScopedTypeVariables build-depends: base >=4.3 && <5- , conferer >=0.2.0.0 && <0.3.0.0+ , conferer >=0.3.0.0 && <0.4.0.0 , conferer-hspec , hspec , hspec-core >=2.0.0 && <2.8.0
− src/Conferer/FetchFromConfig/Hspec.hs
@@ -1,91 +0,0 @@-{-# LANGUAGE CPP #-}-module Conferer.FetchFromConfig.Hspec- (- -- * How to use this- -- | FetchFromConfig instance for snap server configuration- --- -- @- -- import Conferer- -- import Conferer.FetchFromConfig.Snap ()- --- -- main = do- -- config <- 'defaultConfig' \"awesomeapp\"- -- snapConfig <- 'getFromConfig' \"snap\" config- -- @- --- -- * Internal utility functions- -- | These may be useful for someone but are subject to change at any point so- -- use with care- ) where--import Conferer.Core-import Conferer.Types-import Conferer.FetchFromConfig.Basics--import Data.Either (rights)-import Data.String (fromString)-import Data.Text (Text, unpack, toLower)-import Data.Maybe (fromMaybe)--import qualified Test.Hspec.Core.Runner as Hspec-import qualified Test.Hspec.Core.Formatters as Hspec--instance FetchFromConfig Hspec.ColorMode where- fetch =- fetchFromConfigWith- (\t -> case t of- "ColorAuto" -> Just Hspec.ColorAuto- "ColorNever" -> Just Hspec.ColorNever- "ColorAlways" -> Just Hspec.ColorAlways- _ -> Nothing- )--instance FetchFromConfig Hspec.Formatter where- fetch =- fetchFromConfigWith- (\t -> case toLower t of- "silent" -> Just Hspec.silent- "specdoc" -> Just Hspec.specdoc- "progress" -> Just Hspec.progress- "failed_examples" -> Just Hspec.failed_examples- _ -> Nothing- )--instance DefaultConfig Hspec.Config where- configDef = Hspec.defaultConfig--instance FetchFromConfig Hspec.Config where- fetch k config = do- pure configDef- >>= findKeyAndApplyConfig config k "dry-run" (\v c -> c { Hspec.configDryRun = v })- >>= findKeyAndApplyConfig config k "fast-fail" (\v c -> c { Hspec.configFastFail = v })- >>= findKeyAndApplyConfig config k "rerun" (\v c -> c { Hspec.configRerun = v })- >>= findKeyAndApplyConfig config k "quickCheck-max-success" (\v c -> c { Hspec.configQuickCheckMaxSuccess = v })- >>= findKeyAndApplyConfig config k "quickCheck-max-discard-ratio" (\v c -> c { Hspec.configQuickCheckMaxDiscardRatio = v })- >>= findKeyAndApplyConfig config k "quickCheck-max-size" (\v c -> c { Hspec.configQuickCheckMaxSize = v })- >>= findKeyAndApplyConfig config k "quickCheck-seed" (\v c -> c { Hspec.configQuickCheckSeed = v })- >>= findKeyAndApplyConfig config k "smallCheck-depth" (\v c -> c { Hspec.configSmallCheckDepth = v })- >>= findKeyAndApplyConfig config k "color-mode" (\v c -> c { Hspec.configColorMode = v })- >>= findKeyAndApplyConfig config k "html-output" (\v c -> c { Hspec.configHtmlOutput = v })- >>= findKeyAndApplyConfig config k "formatter" (\v c -> c { Hspec.configFormatter = v })-#if MIN_VERSION_hspec_core(2,1,1)- -- We ignore configuration of type function that don't have defaults provided by the lib- -- >>= findKeyAndApplyConfig config k "skip-predicate" (\v c -> c { Hspec.configSkipPredicate = v })-#endif-#if MIN_VERSION_hspec_core(2,1,9)- >>= findKeyAndApplyConfig config k "concurrent-jobs" (\v c -> c { Hspec.configConcurrentJobs = v })-#endif-#if MIN_VERSION_hspec_core(2,4,0)- >>= findKeyAndApplyConfig config k "ignore-config-file" (\v c -> c { Hspec.configIgnoreConfigFile = v })- >>= findKeyAndApplyConfig config k "print-cpu-time" (\v c -> c { Hspec.configPrintCpuTime = v })- >>= findKeyAndApplyConfig config k "diff" (\v c -> c { Hspec.configDiff = v })-#endif-#if MIN_VERSION_hspec_core(2,4,2)- >>= findKeyAndApplyConfig config k "failure-report" (\v c -> c { Hspec.configFailureReport = v })-#endif-#if MIN_VERSION_hspec_core(2,7,0)- >>= findKeyAndApplyConfig config k "focused-only" (\v c -> c { Hspec.configFocusedOnly = v })- >>= findKeyAndApplyConfig config k "fail-on-focused" (\v c -> c { Hspec.configFailOnFocused = v })-#endif- >>= (return . return)-
+ src/Conferer/FromConfig/Hspec.hs view
@@ -0,0 +1,94 @@+{-# LANGUAGE CPP #-}+module Conferer.FromConfig.Hspec+ (+ -- * How to use this+ -- | FromConfig instance for snap server configuration+ --+ -- @+ -- import Conferer+ -- import Conferer.FromConfig.Snap ()+ --+ -- main = do+ -- config <- 'defaultConfig' \"awesomeapp\"+ -- snapConfig <- 'getFromConfig' \"snap\" config+ -- @+ --+ -- * Internal utility functions+ -- | These may be useful for someone but are subject to change at any point so+ -- use with care+ ) where++import Conferer.Core+import Conferer.Types+import Conferer.FromConfig.Basics++import Data.Either (rights)+import Data.String (fromString)+import Data.Text (Text, unpack, toLower)+import Data.Maybe (fromMaybe)++import qualified Test.Hspec.Core.Runner as Hspec+import qualified Test.Hspec.Core.Formatters as Hspec++instance FromConfig Hspec.ColorMode where+ updateFromConfig = updateAllAtOnceUsingFetch+ fetchFromConfig =+ fetchFromConfigWith+ (\t -> case t of+ "ColorAuto" -> Just Hspec.ColorAuto+ "ColorNever" -> Just Hspec.ColorNever+ "ColorAlways" -> Just Hspec.ColorAlways+ _ -> Nothing+ )++instance FromConfig Hspec.Formatter where+ updateFromConfig = updateAllAtOnceUsingFetch+ fetchFromConfig =+ fetchFromConfigWith+ (\t -> case toLower t of+ "silent" -> Just Hspec.silent+ "specdoc" -> Just Hspec.specdoc+ "progress" -> Just Hspec.progress+ "failed_examples" -> Just Hspec.failed_examples+ _ -> Nothing+ )++instance DefaultConfig Hspec.Config where+ configDef = Hspec.defaultConfig++instance FromConfig Hspec.Config where+ fetchFromConfig key config = return Nothing+ updateFromConfig k config original = do+ pure original+ >>= findKeyAndApplyConfig config k "dryRun" Hspec.configDryRun (\v c -> c { Hspec.configDryRun = v })+ >>= findKeyAndApplyConfig config k "fastFail" Hspec.configFastFail (\v c -> c { Hspec.configFastFail = v })+ >>= findKeyAndApplyConfig config k "rerun" Hspec.configRerun (\v c -> c { Hspec.configRerun = v })+ >>= findKeyAndApplyConfig config k "quickCheckMaxSuccess" Hspec.configQuickCheckMaxSuccess (\v c -> c { Hspec.configQuickCheckMaxSuccess = v })+ >>= findKeyAndApplyConfig config k "quickCheckMaxDiscardRatio" Hspec.configQuickCheckMaxDiscardRatio (\v c -> c { Hspec.configQuickCheckMaxDiscardRatio = v })+ >>= findKeyAndApplyConfig config k "quickCheckMaxSize" Hspec.configQuickCheckMaxSize (\v c -> c { Hspec.configQuickCheckMaxSize = v })+ >>= findKeyAndApplyConfig config k "quickCheckSeed" Hspec.configQuickCheckSeed (\v c -> c { Hspec.configQuickCheckSeed = v })+ >>= findKeyAndApplyConfig config k "smallCheckDepth" Hspec.configSmallCheckDepth (\v c -> c { Hspec.configSmallCheckDepth = v })+ >>= findKeyAndApplyConfig config k "colorMode" Hspec.configColorMode (\v c -> c { Hspec.configColorMode = v })+ >>= findKeyAndApplyConfig config k "htmlOutput" Hspec.configHtmlOutput (\v c -> c { Hspec.configHtmlOutput = v })+ >>= findKeyAndApplyConfig config k "formatter" Hspec.configFormatter (\v c -> c { Hspec.configFormatter = v })+#if MIN_VERSION_hspec_core(2,1,1)+ -- We ignore configuration of type function that don't have defaults provided by the lib+ -- >>= findKeyAndApplyConfig config k "skip-predicate" (\v c -> c { Hspec.configSkipPredicate = v })+#endif+#if MIN_VERSION_hspec_core(2,1,9)+ >>= findKeyAndApplyConfig config k "concurrentJobs" Hspec.configConcurrentJobs (\v c -> c { Hspec.configConcurrentJobs = v })+#endif+#if MIN_VERSION_hspec_core(2,4,0)+ >>= findKeyAndApplyConfig config k "ignoreConfigFile" Hspec.configIgnoreConfigFile (\v c -> c { Hspec.configIgnoreConfigFile = v })+ >>= findKeyAndApplyConfig config k "printCpuTime" Hspec.configPrintCpuTime (\v c -> c { Hspec.configPrintCpuTime = v })+ >>= findKeyAndApplyConfig config k "diff" Hspec.configDiff (\v c -> c { Hspec.configDiff = v })+#endif+#if MIN_VERSION_hspec_core(2,4,2)+ >>= findKeyAndApplyConfig config k "failureReport" Hspec.configFailureReport (\v c -> c { Hspec.configFailureReport = v })+#endif+#if MIN_VERSION_hspec_core(2,7,0)+ >>= findKeyAndApplyConfig config k "focusedOnly" Hspec.configFocusedOnly (\v c -> c { Hspec.configFocusedOnly = v })+ >>= findKeyAndApplyConfig config k "failOnFocused" Hspec.configFailOnFocused (\v c -> c { Hspec.configFailOnFocused = v })+#endif+ >>= return+