summaryrefslogtreecommitdiff
path: root/tests/Client.hs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/Client.hs')
-rw-r--r--tests/Client.hs18
1 files changed, 17 insertions, 1 deletions
diff --git a/tests/Client.hs b/tests/Client.hs
index c2ac6d01..d762976d 100644
--- a/tests/Client.hs
+++ b/tests/Client.hs
@@ -1,8 +1,12 @@
1{-# LANGUAGE OverloadedStrings #-} 1{-# LANGUAGE OverloadedStrings #-}
2module Main (main) where 2module Main (main) where
3 3
4import Control.Concurrent
5import Control.Exception
4import qualified Data.ByteString as B 6import qualified Data.ByteString as B
5import System.Environment 7import System.Environment
8import System.Process
9import System.FilePath
6 10
7import Test.HUnit hiding (Test) 11import Test.HUnit hiding (Test)
8import Test.Framework 12import Test.Framework
@@ -15,8 +19,20 @@ import Shared
15addr :: RemoteAddr 19addr :: RemoteAddr
16addr = (0, 6000) 20addr = (0, 6000)
17 21
22withServ :: FilePath -> IO () -> IO ()
23withServ serv_path = bracket up terminateProcess . const
24 where
25 up = do
26 (_, _, _, h) <- createProcess (proc serv_path [])
27 threadDelay 1000000
28 return h
29
18main :: IO () 30main :: IO ()
19main = defaultMain tests 31main = do
32 let serv_path = "dist" </> "build" </> "test-server" </> "test-server"
33 withServ serv_path $
34 defaultMain tests
35
20 36
21(==?) :: (Eq a, Show a) => a -> IO a -> Assertion 37(==?) :: (Eq a, Show a) => a -> IO a -> Assertion
22expected ==? action = do 38expected ==? action = do