From 18dffc982de12798408e0acc85b8fb4637ae2118 Mon Sep 17 00:00:00 2001 From: Victor Denisov Date: Fri, 20 May 2016 23:41:24 -0700 Subject: [PATCH] Report the version of mongodb we run tests against --- mongoDB.cabal | 2 +- test/Main.hs | 15 +++++++++++++++ test/Spec.hs | 2 +- 3 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 test/Main.hs diff --git a/mongoDB.cabal b/mongoDB.cabal index b389aef..11a4ec1 100644 --- a/mongoDB.cabal +++ b/mongoDB.cabal @@ -62,7 +62,7 @@ Source-repository head test-suite test hs-source-dirs: test - main-is: Spec.hs + main-is: Main.hs ghc-options: -Wall -with-rtsopts "-K32m" type: exitcode-stdio-1.0 build-depends: mongoDB diff --git a/test/Main.hs b/test/Main.hs new file mode 100644 index 0000000..cf3f876 --- /dev/null +++ b/test/Main.hs @@ -0,0 +1,15 @@ +module Main where + +import Database.MongoDB.Admin (serverVersion) +import Database.MongoDB.Connection (connect, host) +import Database.MongoDB.Query (access, slaveOk) +import Data.Text (unpack) +import Test.Hspec.Runner +import qualified Spec + +main :: IO () +main = do + p <- connect $ host "localhost" + version <- access p slaveOk "admin" serverVersion + putStrLn $ "Running tests with mongodb version: " ++ (unpack version) + hspecWith defaultConfig Spec.spec diff --git a/test/Spec.hs b/test/Spec.hs index a824f8c..5416ef6 100644 --- a/test/Spec.hs +++ b/test/Spec.hs @@ -1 +1 @@ -{-# OPTIONS_GHC -F -pgmF hspec-discover #-} +{-# OPTIONS_GHC -F -pgmF hspec-discover -optF --module-name=Spec #-}