summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.ghci1
-rw-r--r--tests/Network/KRPCSpec.hs9
2 files changed, 7 insertions, 3 deletions
diff --git a/.ghci b/.ghci
index 0c692119..829e5e3d 100644
--- a/.ghci
+++ b/.ghci
@@ -1,3 +1,4 @@
1:set -isrc -itests -XRecordWildCards
1import Control.Concurrent 2import Control.Concurrent
2import Data.BEncode 3import Data.BEncode
3import Network 4import Network
diff --git a/tests/Network/KRPCSpec.hs b/tests/Network/KRPCSpec.hs
index 0a6dc8fb..eabcc817 100644
--- a/tests/Network/KRPCSpec.hs
+++ b/tests/Network/KRPCSpec.hs
@@ -25,6 +25,9 @@ opts = def { optQueryTimeout = 1 }
25 25
26spec :: Spec 26spec :: Spec
27spec = do 27spec = do
28 let qr :: MonadKRPC h m => SockAddr -> Echo Int -> m (Echo Int)
29 qr = query
30
28 describe "manager" $ do 31 describe "manager" $ do
29 it "is active until closeManager called" $ do 32 it "is active until closeManager called" $ do
30 m <- newManager opts servAddr [] 33 m <- newManager opts servAddr []
@@ -43,14 +46,14 @@ spec = do
43 it "count transactions properly" $ do 46 it "count transactions properly" $ do
44 (withManager opts servAddr handlers $ runReaderT $ do 47 (withManager opts servAddr handlers $ runReaderT $ do
45 listen 48 listen
46 _ <- query servAddr (Echo (0xabcd :: Int)) 49 _ <- qr servAddr (Echo 0xabcd)
47 _ <- query servAddr (Echo (0xabcd :: Int)) 50 _ <- qr servAddr (Echo 0xabcd)
48 getQueryCount 51 getQueryCount
49 ) 52 )
50 `shouldReturn` 2 53 `shouldReturn` 2
51 54
52 it "throw timeout exception" $ do 55 it "throw timeout exception" $ do
53 (withManager opts servAddr handlers $ runReaderT $ do 56 (withManager opts servAddr handlers $ runReaderT $ do
54 query servAddr (Echo (0xabcd :: Int)) 57 qr servAddr (Echo 0xabcd)
55 ) 58 )
56 `shouldThrow` (== TimeoutExpired) 59 `shouldThrow` (== TimeoutExpired)