serversession/serversession-backend-acid-state/tests/Main.hs
2015-06-01 03:59:57 -03:00

29 lines
1010 B
Haskell

module Main (main) where
import Control.Applicative ((<$>))
import Data.Acid.Local (openLocalState, createCheckpointAndClose)
import Data.Acid.Memory (openMemoryState)
import Test.Hspec
import Web.ServerSession.Backend.Acid
import Web.ServerSession.Core.StorageTests
import qualified Control.Exception as E
main :: IO ()
main =
E.bracket
(AcidStorage <$> openLocalState emptyState)
(createCheckpointAndClose . acidState) $
\acidLocal -> hspec $ do
acidMem <- runIO $ AcidStorage <$> openMemoryState emptyState
describe "AcidStorage on memory only" $
allStorageTests acidMem it runIO parallel shouldBe shouldReturn shouldThrow
describe "AcidStorage on local storage" $
#if MIN_VERSION_base(4,8,0)
allStorageTests acidLocal it runIO parallel shouldBe shouldReturn shouldThrow
#else
it "is not tested on GHC < 7.10.1" $ do
let _ = acidMem `asTypeOf` acidLocal
pendingWith "<https://github.com/acid-state/acid-state/issues/55>"
#endif