@@ -1,7 +1,7 @@
1{-# LANGUAGE OverloadedStrings #-}
1{-# LANGUAGE OverloadedStrings #-}
2{-# LANGUAGE QuasiQuotes #-}
2{-# LANGUAGE QuasiQuotes #-}
4−module Stack.Config.YamlSpec where
4+module Stack.Config.YamlSpec (spec) where
6import Data.ByteString
6import Data.ByteString
7import Data.Text.Encoding as T
7import Data.Text.Encoding as T
@@ -150,8 +150,11 @@ configNew = Config
150spec :: Spec
150spec :: Spec
151spec = describe "Config" $ do
151spec = describe "Config" $ do
152 specify "minimal" $
152 specify "minimal" $
153− (Y.decode configYamlMinimal :: Maybe Config) `shouldBe` Just configMinimal
153+ (decodeMaybe configYamlMinimal :: Maybe Config) `shouldBe` Just configMinimal
154 specify "full" $
154 specify "full" $
155− (Y.decode configYaml :: Maybe Config) `shouldBe` Just config
155+ (decodeMaybe configYaml :: Maybe Config) `shouldBe` Just config
156 specify "new" $
156 specify "new" $
157− (Y.decode configNewYaml :: Maybe Config) `shouldBe` Just configNew
157+ (decodeMaybe configNewYaml :: Maybe Config) `shouldBe` Just configNew
159+decodeMaybe :: ByteString -> Maybe Config
160+decodeMaybe = either (const Nothing) id . Y.decodeEither'