Add storage tests for acid-state, both memory and local storage.

This commit is contained in:
Felipe Lessa 2015-05-28 01:27:13 -03:00
parent 80f121f57b
commit b446b0ea92
3 changed files with 37 additions and 0 deletions

View File

@ -0,0 +1 @@
state

View File

@ -32,6 +32,21 @@ library
TypeFamilies
ghc-options: -Wall
test-suite tests
type: exitcode-stdio-1.0
hs-source-dirs: tests
build-depends:
base, acid-state, containers, mtl, safecopy
, hspec >= 2.1 && < 3
, serversession
, serversession-backend-acid-state
main-is: Main.hs
ghc-options: -Wall -threaded -with-rtsopts=-N
source-repository head
type: git
location: https://github.com/yesodweb/serversession

View File

@ -0,0 +1,21 @@
module Main (main) where
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 $ parallel $ do
acidMem <- runIO $ AcidStorage <$> openMemoryState emptyState
describe "AcidStorage on memory only" $
allStorageTests acidMem it runIO shouldBe shouldReturn shouldThrow
describe "AcidStorage on local storage" $
allStorageTests acidLocal it runIO shouldBe shouldReturn shouldThrow