git.iko.soy/typeable/postgresql-simple
on aa84100 help sign in
23 lines 680 B history raw
1{-# LANGUAGE OverloadedStrings #-}
2{-# LANGUAGE NamedFieldPuns #-}
4import Control.Exception (bracket)
5import Control.Monad (when)
6import Database.PostgreSQL.Simple
7import System.Exit (exitFailure)
8import System.IO
9import Test.HUnit
11import Bytea
13tests :: Connection -> [Test]
14tests conn =
15 [ TestLabel "Bytea" $ testBytea conn
16 ]
18main :: IO ()
19main = do
20 mapM_ (`hSetBuffering` LineBuffering) [stdout, stderr]
21 bracket (connectPostgreSQL "") close $ \conn -> do
22 Counts{cases, tried, errors, failures} <- runTestTT $ TestList $ tests conn
23 when (cases /= tried || errors /= 0 || failures /= 0) $ exitFailure