i'm a haskell noob and have problems with testing functions with acid-states.This ist my Datastructure
data UserState = UserState { name :: String }
deriving (Eq, Ord, Read, Show, Data, Typeable)
and this is the function i want to test:
setName :: String -> Update UserState String
setName n =
do c@UserState{..} <- get
let newName = name
put $ c { name = newName }
return newName
$(makeAcidic ''UserState ['setName ])
This is my test:
spec :: Spec
spec = do
describe "test" $
it "test" $ do
setName "Mike" `shouldBe` expected
I have no idea how to model my expected values.
Aucun commentaire:
Enregistrer un commentaire