Skip to content

Instantly share code, notes, and snippets.

@oropon
Created March 14, 2014 05:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oropon/9542555 to your computer and use it in GitHub Desktop.
Save oropon/9542555 to your computer and use it in GitHub Desktop.
import Test.Hspec (Spec, hspec, describe, it, shouldBe)
import Control.Monad (forM_)
samplef :: String -> String
samplef = concat . replicate 2
main :: IO ()
main = test
test :: IO ()
test = hspec spec
spec :: Spec
spec = do
describe "samplef" $ do
forM_ testSet $ \(n,input,expect) ->
it (show n ++ ": " ++ input ++ " -> " ++ expect) $
samplef input `shouldBe` expect
testSet :: [(Int, String, String)]
testSet = let f n (inp,exp) = (n,inp,exp) in zipWith f [1..] [
("hoge", "hogehoge")
,("fuga", "fugafuga")]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment