blob: f348dd0669a13062636b685308db3cf00bfa4f13 (
plain) (
tree)
|
|
--------------------------------------------------------------------------------
module Spec where
--------------------------------------------------------------------------------
import Test.Hspec
import Test.QuickCheck
import Control.Exception (evaluate)
--------------------------------------------------------------------------------
main :: IO ()
main = hspec $ do
describe "Prelude.head" $ do
it "returns the first element of a list" $ do
head [23 ..] `shouldBe` (23 :: Integer)
it "returns the first element of an arbitrary list" $
property $ \x xs -> head (x:xs) == (x :: Integer)
it "throws an exception if used with an empty list" $ do
evaluate (head []) `shouldThrow` anyException
|