-- Copyright: 2009 Dino Morelli -- License: BSD3 (see LICENSE) -- Author: Dino Morelli module Main where import Data.Map ( fromList ) import Test.HUnit ( Test (..) , assertBool, assertEqual, runTestTT ) import Fez.Data.Conf ( parseToArgs, parseToMap ) configFileContents :: String configFileContents = init $ unlines [ "foo=one" , "# a comment" , "" , "bar" , "baz-blorp=2" ] test_parseToMap :: Test test_parseToMap = TestCase $ assertEqual "parseToMap" (fromList [("bar",""),("baz-blorp","2"),("foo","one")]) (parseToMap configFileContents) test_parseToArgs :: Test test_parseToArgs = TestCase $ assertEqual "parseToArgs" ["--foo=one","--bar","--baz-blorp=2"] (parseToArgs configFileContents) main :: IO () main = do runTestTT $ TestList [ test_parseToMap , test_parseToArgs ] return ()