Add storage tests for acid-state, both memory and local storage.
This commit is contained in:
parent
80f121f57b
commit
b446b0ea92
1
serversession-backend-acid-state/.gitignore
vendored
Normal file
1
serversession-backend-acid-state/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
state
|
||||
@ -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
|
||||
|
||||
21
serversession-backend-acid-state/tests/Main.hs
Normal file
21
serversession-backend-acid-state/tests/Main.hs
Normal 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
|
||||
Loading…
Reference in New Issue
Block a user