aboutsummaryrefslogtreecommitdiff
path: root/tests/Test.hs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/Test.hs')
-rw-r--r--tests/Test.hs11
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)