From 89a1cbdbb440a339552e76a79d3a0acb000e5705 Mon Sep 17 00:00:00 2001 From: Joris Date: Sat, 19 Mar 2016 17:22:12 +0100 Subject: Fix lookupDefault --- tests/Test.hs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'tests') diff --git a/tests/Test.hs b/tests/Test.hs index 03dc979..03f9d39 100644 --- a/tests/Test.hs +++ b/tests/Test.hs @@ -25,6 +25,7 @@ main = defaultMain tests tests :: [Test] tests = [ testCase "binding" bindingAssertion + , testCase "lookupDefault" lookupDefaultAssertion , testCase "name" nameAssertion , testCase "value" valueAssertion , testCase "skip" skipAssertion @@ -57,6 +58,12 @@ bindingAssertion = do assertEqual "overlapping bindings count" 2 (M.size . hashMap $ overlappingBindings) assertEqual "overlapping bindings redefinition" (Just "baz") (lookup "x" overlappingBindings :: Maybe String) +lookupDefaultAssertion :: Assertion +lookupDefaultAssertion = do + config <- forceGetConfig "x = 5" + assertEqual "x" 5 (lookupDefault 10 "x" config :: Int) + assertEqual "y" 10 (lookupDefault 10 "y" config :: Int) + nameAssertion :: Assertion nameAssertion = do validNames <- forceGetConfig $ T.unlines -- cgit v1.2.3