summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjoe <joe@jerkface.net>2017-01-01 01:10:44 -0500
committerjoe <joe@jerkface.net>2017-01-01 01:10:44 -0500
commit80c860df8c29f99e0a82b454c1c0f0c6902764ef (patch)
treeafb7a07440b308179252f7e5a79cc85870705358
parentb0cb559c503e791c2a2297a6316d59dab6c49202 (diff)
Fixed build of testsuite.
-rw-r--r--bittorrent.cabal1
-rw-r--r--tests/Config.hs9
-rw-r--r--tests/Network/BitTorrent/DHT/RoutingSpec.hs3
-rw-r--r--tests/Network/BitTorrent/Exchange/BitfieldSpec.hs5
-rw-r--r--tests/Network/BitTorrent/Tracker/RPC/UDPSpec.hs2
5 files changed, 13 insertions, 7 deletions
diff --git a/bittorrent.cabal b/bittorrent.cabal
index 600b2587..71f82589 100644
--- a/bittorrent.cabal
+++ b/bittorrent.cabal
@@ -232,6 +232,7 @@ test-suite spec
232 232
233 -- * Data 233 -- * Data
234 , bytestring 234 , bytestring
235 , bytestring-arbitrary
235 , containers 236 , containers
236 , convertible 237 , convertible
237 , data-default 238 , data-default
diff --git a/tests/Config.hs b/tests/Config.hs
index 9ffb0d8c..55e30867 100644
--- a/tests/Config.hs
+++ b/tests/Config.hs
@@ -1,3 +1,4 @@
1{-# LANGUAGE CPP #-}
1{-# LANGUAGE RecordWildCards #-} 2{-# LANGUAGE RecordWildCards #-}
2module Config 3module Config
3 ( -- * Types 4 ( -- * Types
@@ -39,8 +40,10 @@ import Network.BitTorrent.Address (IP, PeerAddr (PeerAddr), genPeerId)
39type ClientName = String 40type ClientName = String
40 41
41 42
43#if !MIN_VERSION_network(2,6,3)
42instance Read PortNumber where 44instance Read PortNumber where
43 readsPrec = error "readsPrec" 45 readsPrec = error "readsPrec"
46#endif
44 47
45data ClientOpts = ClientOpts 48data ClientOpts = ClientOpts
46 { peerPort :: PortNumber -- tcp port 49 { peerPort :: PortNumber -- tcp port
@@ -64,13 +67,13 @@ defThisOpts = def
64 67
65clientOptsParser :: Parser ClientOpts 68clientOptsParser :: Parser ClientOpts
66clientOptsParser = ClientOpts 69clientOptsParser = ClientOpts
67 <$> option 70 <$> option auto
68 ( long "peer-port" <> short 'p' 71 ( long "peer-port" <> short 'p'
69 <> value 6881 <> showDefault 72 <> value 6881 <> showDefault
70 <> metavar "NUM" 73 <> metavar "NUM"
71 <> help "port to bind the specified bittorrent client" 74 <> help "port to bind the specified bittorrent client"
72 ) 75 )
73 <*> option 76 <*> option auto
74 ( long "node-port" <> short 'n' 77 ( long "node-port" <> short 'n'
75 <> value 6881 <> showDefault 78 <> value 6881 <> showDefault
76 <> metavar "NUM" 79 <> metavar "NUM"
@@ -177,4 +180,4 @@ getOpts = do
177 exitFailure 180 exitFailure
178 181
179 writeIORef envOptsRef envOpts 182 writeIORef envOptsRef envOpts
180 return (envOpts, hspecOpts) \ No newline at end of file 183 return (envOpts, hspecOpts)
diff --git a/tests/Network/BitTorrent/DHT/RoutingSpec.hs b/tests/Network/BitTorrent/DHT/RoutingSpec.hs
index aeccff5f..3077a52a 100644
--- a/tests/Network/BitTorrent/DHT/RoutingSpec.hs
+++ b/tests/Network/BitTorrent/DHT/RoutingSpec.hs
@@ -1,4 +1,5 @@
1{-# LANGUAGE ScopedTypeVariables #-} 1{-# LANGUAGE ScopedTypeVariables #-}
2{-# LANGUAGE FlexibleContexts #-}
2module Network.BitTorrent.DHT.RoutingSpec (spec) where 3module Network.BitTorrent.DHT.RoutingSpec (spec) where
3import Control.Applicative 4import Control.Applicative
4import Control.Monad.State 5import Control.Monad.State
@@ -73,4 +74,4 @@ spec = do
73 let t1 = runSimulation e (T.insert n t) 74 let t1 = runSimulation e (T.insert n t)
74 let t2 = runSimulation e (T.insert n t >>= T.insert n) 75 let t2 = runSimulation e (T.insert n t >>= T.insert n)
75 t1 `shouldBe` t2 76 t1 `shouldBe` t2
76-} \ No newline at end of file 77-}
diff --git a/tests/Network/BitTorrent/Exchange/BitfieldSpec.hs b/tests/Network/BitTorrent/Exchange/BitfieldSpec.hs
index 234965fa..1ba772f6 100644
--- a/tests/Network/BitTorrent/Exchange/BitfieldSpec.hs
+++ b/tests/Network/BitTorrent/Exchange/BitfieldSpec.hs
@@ -1,13 +1,14 @@
1{-# OPTIONS -fno-warn-orphans #-} 1{-# OPTIONS -fno-warn-orphans #-}
2module Network.BitTorrent.Exchange.BitfieldSpec (spec) where 2module Network.BitTorrent.Exchange.BitfieldSpec (spec) where
3import Control.Applicative 3import Control.Applicative
4import Data.ByteString.Arbitrary
4import Test.Hspec 5import Test.Hspec
5import Test.QuickCheck 6import Test.QuickCheck
6 7
7import Network.BitTorrent.Exchange.Bitfield 8import Network.BitTorrent.Exchange.Bitfield
8 9
9instance Arbitrary Bitfield where 10instance Arbitrary Bitfield where
10 arbitrary = fromBitmap <$> arbitrary 11 arbitrary = fromBitmap . fromABS <$> arbitrary
11 12
12spec :: Spec 13spec :: Spec
13spec = return () \ No newline at end of file 14spec = return ()
diff --git a/tests/Network/BitTorrent/Tracker/RPC/UDPSpec.hs b/tests/Network/BitTorrent/Tracker/RPC/UDPSpec.hs
index 3a3dddf5..73acb3fa 100644
--- a/tests/Network/BitTorrent/Tracker/RPC/UDPSpec.hs
+++ b/tests/Network/BitTorrent/Tracker/RPC/UDPSpec.hs
@@ -18,7 +18,7 @@ import Network.BitTorrent.Tracker.RPC.UDP
18 18
19 19
20validateInfo :: AnnounceQuery -> AnnounceInfo -> Expectation 20validateInfo :: AnnounceQuery -> AnnounceInfo -> Expectation
21validateInfo _ Message.Failure {..} = error "validateInfo: failure" 21validateInfo _ Message.Failure {} = error "validateInfo: failure"
22validateInfo AnnounceQuery {..} AnnounceInfo {..} = do 22validateInfo AnnounceQuery {..} AnnounceInfo {..} = do
23 respComplete `shouldSatisfy` isJust 23 respComplete `shouldSatisfy` isJust
24 respIncomplete `shouldSatisfy` isJust 24 respIncomplete `shouldSatisfy` isJust