add test suite
This commit is contained in:
parent
a047c309e5
commit
4696355085
4 changed files with 46 additions and 1 deletions
|
@ -14,13 +14,14 @@ Maintainer: Fedor Gogolev <knsd@knsd.net>
|
||||||
Copyright: Copyright (c) 2010-2012 10gen Inc.
|
Copyright: Copyright (c) 2010-2012 10gen Inc.
|
||||||
License: OtherLicense
|
License: OtherLicense
|
||||||
License-file: LICENSE
|
License-file: LICENSE
|
||||||
Cabal-version: >= 1.6
|
Cabal-version: >= 1.10
|
||||||
Build-type: Simple
|
Build-type: Simple
|
||||||
Stability: alpha
|
Stability: alpha
|
||||||
|
|
||||||
Library
|
Library
|
||||||
GHC-options: -Wall
|
GHC-options: -Wall
|
||||||
GHC-prof-options: -auto-all
|
GHC-prof-options: -auto-all
|
||||||
|
default-language: Haskell2010
|
||||||
|
|
||||||
Build-depends: array -any
|
Build-depends: array -any
|
||||||
, base <5
|
, base <5
|
||||||
|
@ -51,3 +52,18 @@ Library
|
||||||
Source-repository head
|
Source-repository head
|
||||||
Type: git
|
Type: git
|
||||||
Location: https://github.com/mongodb-haskell/mongodb
|
Location: https://github.com/mongodb-haskell/mongodb
|
||||||
|
|
||||||
|
test-suite test
|
||||||
|
hs-source-dirs: test
|
||||||
|
main-is: main.hs
|
||||||
|
ghc-options: -Wall
|
||||||
|
type: exitcode-stdio-1.0
|
||||||
|
|
||||||
|
build-depends: mongoDB
|
||||||
|
, base
|
||||||
|
, mtl
|
||||||
|
, hspec
|
||||||
|
|
||||||
|
default-language: Haskell2010
|
||||||
|
default-extensions: OverloadedStrings
|
||||||
|
|
||||||
|
|
14
test/QueryTest.hs
Normal file
14
test/QueryTest.hs
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
module QueryTest (querySpec) where
|
||||||
|
import TestImport
|
||||||
|
|
||||||
|
fakeDB :: MonadIO m => Action m a -> m a
|
||||||
|
fakeDB = access (error "Pipe") (error "AccessMode") "fake"
|
||||||
|
|
||||||
|
querySpec :: Spec
|
||||||
|
querySpec =
|
||||||
|
describe "useDb" $
|
||||||
|
it "changes the db" $ do
|
||||||
|
db1 <- fakeDB thisDatabase
|
||||||
|
db1 `shouldBe` "fake"
|
||||||
|
db2 <- fakeDB $ useDb "use" thisDatabase
|
||||||
|
db2 `shouldBe` "use"
|
7
test/TestImport.hs
Normal file
7
test/TestImport.hs
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
module TestImport (
|
||||||
|
module Export
|
||||||
|
) where
|
||||||
|
|
||||||
|
import Test.Hspec as Export hiding (Selector)
|
||||||
|
import Database.MongoDB as Export
|
||||||
|
import Control.Monad.Trans as Export (MonadIO, liftIO)
|
8
test/main.hs
Normal file
8
test/main.hs
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
module Main where
|
||||||
|
import Test.Hspec (hspec)
|
||||||
|
|
||||||
|
import QueryTest
|
||||||
|
|
||||||
|
main :: IO ()
|
||||||
|
main = hspec $ do
|
||||||
|
querySpec
|
Loading…
Reference in a new issue