diff options
author | joe <joe@jerkface.net> | 2017-01-01 01:10:44 -0500 |
---|---|---|
committer | joe <joe@jerkface.net> | 2017-01-01 01:10:44 -0500 |
commit | 80c860df8c29f99e0a82b454c1c0f0c6902764ef (patch) | |
tree | afb7a07440b308179252f7e5a79cc85870705358 | |
parent | b0cb559c503e791c2a2297a6316d59dab6c49202 (diff) |
Fixed build of testsuite.
-rw-r--r-- | bittorrent.cabal | 1 | ||||
-rw-r--r-- | tests/Config.hs | 9 | ||||
-rw-r--r-- | tests/Network/BitTorrent/DHT/RoutingSpec.hs | 3 | ||||
-rw-r--r-- | tests/Network/BitTorrent/Exchange/BitfieldSpec.hs | 5 | ||||
-rw-r--r-- | tests/Network/BitTorrent/Tracker/RPC/UDPSpec.hs | 2 |
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 #-} |
2 | module Config | 3 | module Config |
3 | ( -- * Types | 4 | ( -- * Types |
@@ -39,8 +40,10 @@ import Network.BitTorrent.Address (IP, PeerAddr (PeerAddr), genPeerId) | |||
39 | type ClientName = String | 40 | type ClientName = String |
40 | 41 | ||
41 | 42 | ||
43 | #if !MIN_VERSION_network(2,6,3) | ||
42 | instance Read PortNumber where | 44 | instance Read PortNumber where |
43 | readsPrec = error "readsPrec" | 45 | readsPrec = error "readsPrec" |
46 | #endif | ||
44 | 47 | ||
45 | data ClientOpts = ClientOpts | 48 | data ClientOpts = ClientOpts |
46 | { peerPort :: PortNumber -- tcp port | 49 | { peerPort :: PortNumber -- tcp port |
@@ -64,13 +67,13 @@ defThisOpts = def | |||
64 | 67 | ||
65 | clientOptsParser :: Parser ClientOpts | 68 | clientOptsParser :: Parser ClientOpts |
66 | clientOptsParser = ClientOpts | 69 | clientOptsParser = 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 #-} | ||
2 | module Network.BitTorrent.DHT.RoutingSpec (spec) where | 3 | module Network.BitTorrent.DHT.RoutingSpec (spec) where |
3 | import Control.Applicative | 4 | import Control.Applicative |
4 | import Control.Monad.State | 5 | import 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 #-} |
2 | module Network.BitTorrent.Exchange.BitfieldSpec (spec) where | 2 | module Network.BitTorrent.Exchange.BitfieldSpec (spec) where |
3 | import Control.Applicative | 3 | import Control.Applicative |
4 | import Data.ByteString.Arbitrary | ||
4 | import Test.Hspec | 5 | import Test.Hspec |
5 | import Test.QuickCheck | 6 | import Test.QuickCheck |
6 | 7 | ||
7 | import Network.BitTorrent.Exchange.Bitfield | 8 | import Network.BitTorrent.Exchange.Bitfield |
8 | 9 | ||
9 | instance Arbitrary Bitfield where | 10 | instance Arbitrary Bitfield where |
10 | arbitrary = fromBitmap <$> arbitrary | 11 | arbitrary = fromBitmap . fromABS <$> arbitrary |
11 | 12 | ||
12 | spec :: Spec | 13 | spec :: Spec |
13 | spec = return () \ No newline at end of file | 14 | spec = 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 | ||
20 | validateInfo :: AnnounceQuery -> AnnounceInfo -> Expectation | 20 | validateInfo :: AnnounceQuery -> AnnounceInfo -> Expectation |
21 | validateInfo _ Message.Failure {..} = error "validateInfo: failure" | 21 | validateInfo _ Message.Failure {} = error "validateInfo: failure" |
22 | validateInfo AnnounceQuery {..} AnnounceInfo {..} = do | 22 | validateInfo AnnounceQuery {..} AnnounceInfo {..} = do |
23 | respComplete `shouldSatisfy` isJust | 23 | respComplete `shouldSatisfy` isJust |
24 | respIncomplete `shouldSatisfy` isJust | 24 | respIncomplete `shouldSatisfy` isJust |