diff options
author | Joris | 2016-03-18 09:50:39 +0100 |
---|---|---|
committer | Joris | 2016-03-18 09:50:39 +0100 |
commit | bf804f73ce3494be430054499c5ce18f232f68ca (patch) | |
tree | 6b89c204b9f997d6f6d4134cfaa72ecc6f2234f6 /tests/Test.hs | |
parent | 9c3c43835addc950c3af7fab8fd53e24e7e29ad9 (diff) |
Add optional imports
Diffstat (limited to 'tests/Test.hs')
-rw-r--r-- | tests/Test.hs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/tests/Test.hs b/tests/Test.hs index 957f3ae..03dc979 100644 --- a/tests/Test.hs +++ b/tests/Test.hs @@ -14,7 +14,7 @@ import Test.Framework.Providers.HUnit import Test.HUnit hiding (Test) import Data.ConfigManager -import Data.ConfigManager.Config +import Data.ConfigManager.Types (Config(..)) import qualified Data.Text as T import Helper (forceGetConfig, getConfig, eitherToMaybe) @@ -115,3 +115,12 @@ importAssertion = do assertEqual "d" (Just "zap") (lookup "d" config :: Maybe String) assertEqual "e" (Just "re nam") (lookup "e" config :: Maybe String) assertEqual "f" (Just 8.5) (lookup "f" config :: Maybe Double) + + missingConfig <- getConfig "import \"required.conf\"" + assertEqual "missing config" Nothing missingConfig + + missingOptionalConfig <- forceGetConfig $ T.unlines + [ "importMaybe \"required.conf\"" + , "x = 4" + ] + assertEqual "missing optional config" (Just 4) (lookup "x" missingOptionalConfig :: Maybe Int) |