Skip to content

Instantly share code, notes, and snippets.

@cammckinnon
Created March 23, 2015 18:30
Show Gist options
  • Save cammckinnon/21aa2bf99fb6eb29f3ec to your computer and use it in GitHub Desktop.
Save cammckinnon/21aa2bf99fb6eb29f3ec to your computer and use it in GitHub Desktop.
-- to use, type the following in the commandline: runhaskell tests.hs
expect :: (Eq a, Show a, Monad m) => a -> a -> m ()
expect a b = do
if a == b then
return ()
else
fail ("Expected " ++ (show a) ++ " but got " ++ (show b) ++ " instead.")
main = do
expect 1 1
expect 1 2
print "All tests passed"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment