File tree Expand file tree Collapse file tree 2 files changed +29
-3
lines changed Expand file tree Collapse file tree 2 files changed +29
-3
lines changed Original file line number Diff line number Diff line change 11#!/usr/bin/env runhaskell
22> import Distribution. Simple
3- > import qualified Data. List as L
4- > import System. Directory
3+ > import System. Directory (setCurrentDirectory)
54> import System. Process (runCommand,waitForProcess)
65
76
8- > main = defaultMainWithHooks simpleUserHooks
7+ > main = defaultMainWithHooks simpleUserHooks { runTests = tests }
8+
9+ > tests _ _ _ _ = do
10+ > setCurrentDirectory " src"
11+ > h <- runCommand " /usr/bin/env runhaskell Database.CouchDB.Tests"
12+ > waitForProcess h
13+ > return ()
Original file line number Diff line number Diff line change 1+ module Database.CouchDB.Tests where
2+
3+ import Test.HUnit
4+ import Database.CouchDB
5+
6+ assertDBEqual :: (Eq a , Show a ) => String -> a -> CouchMonad a -> Assertion
7+ assertDBEqual msg v m = do
8+ v' <- runCouchDB' m
9+ assertEqual msg v' v
10+
11+ testCreate = TestCase $ assertDBEqual " create/drop database" True $ do
12+ createDB " test1"
13+ dropDB " test1" -- returns True since the database exists.
14+
15+ allTests = TestList [ testCreate ]
16+
17+ main = do
18+ putStrLn " Running CouchDB test suite..."
19+ runTestTT allTests
20+ putStrLn " Testing complete."
21+ return ()
You can’t perform that action at this time.
0 commit comments