Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Use hspec-expectations to check for error thrown by 'findMin'

  • Loading branch information...
commit f239a1f63c228357d12763e6ae7df0b490cf5b8e 1 parent c5e7224
@bovinespirit authored
Showing with 9 additions and 0 deletions.
  1. +2 −0  enummapmap.cabal
  2. +7 −0 test/UnitEnumMapMap.hs
View
2  enummapmap.cabal
@@ -37,6 +37,7 @@ Test-Suite test-enummapmap-lazy
HUnit,
QuickCheck >= 2,
hspec >= 1.3,
+ hspec-expectations,
deepseq >= 1.2 && < 1.4,
enummapmap
cpp-options: -DTESTING -DLAZY
@@ -66,6 +67,7 @@ Test-Suite test-enummapmap-strict
HUnit,
QuickCheck >= 2,
hspec >= 1.3,
+ hspec-expectations,
deepseq >= 1.2 && < 1.4,
enummapmap
cpp-options: -DTESTING -DSTRICT
View
7 test/UnitEnumMapMap.hs
@@ -1,7 +1,9 @@
{-# LANGUAGE CPP, GeneralizedNewtypeDeriving, ScopedTypeVariables, TypeOperators #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
+import Control.Exception
import Control.Monad (liftM, liftM2)
+import Test.Hspec.Expectations
import Test.Hspec.HUnit ()
import Test.Hspec.Monadic
import Test.Hspec.QuickCheck (prop)
@@ -334,3 +336,8 @@ main =
it "leaves correct subtree" $
(EMM.differenceSet l2odds $ EMS.fromList [s 3, s 4, s 5])
@?= EMM.fromList [(1 :& k 1, 1), (1 :& k 3, 3), (1 :& k 5, 5)]
+
+ describe "findMin" $ do
+ it "throws an error when it is passed an empty EnumMapMap" $ do
+ evaluate (EMM.findMin (EMM.empty :: EnumMapMap (K Int) Int))
+ `shouldThrow` anyErrorCall
Please sign in to comment.
Something went wrong with that request. Please try again.