fix error from new HUnit export

This commit is contained in:
Greg Weber 2015-08-21 14:24:54 -07:00
parent 57f9bd6ff6
commit ad7326aaaa

View File

@ -5,7 +5,7 @@ import Control.Applicative
import Control.Monad (when) import Control.Monad (when)
import Data.List (sortBy) import Data.List (sortBy)
import Language.Haskell.TH import Language.Haskell.TH
import Test.HUnit import Test.HUnit hiding (Location)
import Yesod.EmbeddedStatic.Types import Yesod.EmbeddedStatic.Types
import qualified Data.ByteString.Lazy as BL import qualified Data.ByteString.Lazy as BL
@ -38,11 +38,11 @@ testOneEntry :: Maybe String -> Location -> IO BL.ByteString -> [Entry] -> ExpQ
testOneEntry name loc ct [e] = testEntry name loc ct e testOneEntry name loc ct [e] = testEntry name loc ct e
testOneEntry _ _ _ _ = [| GenError "not exactly one entry" |] testOneEntry _ _ _ _ = [| GenError "not exactly one entry" |]
-- | Tests a list of entries -- | Tests a list of entries
testEntries :: [(Maybe String, Location, IO BL.ByteString)] -> [Entry] -> ExpQ testEntries :: [(Maybe String, Location, IO BL.ByteString)] -> [Entry] -> ExpQ
testEntries a b | length a /= length b = [| [GenError "lengths differ"] |] testEntries a b | length a /= length b = [| [GenError "lengths differ"] |]
testEntries a b = listE $ zipWith f a' b' testEntries a b = listE $ zipWith f a' b'
where where
a' = sortBy (\(_,l1,_) (_,l2,_) -> compare l1 l2) a a' = sortBy (\(_,l1,_) (_,l2,_) -> compare l1 l2) a
b' = sortBy (\e1 e2 -> ebLocation e1 `compare` ebLocation e2) b b' = sortBy (\e1 e2 -> ebLocation e1 `compare` ebLocation e2) b
f (name, loc, ct) e = testEntry name loc ct e f (name, loc, ct) e = testEntry name loc ct e