diff options
author | Sam Truzjan <pxqr.sta@gmail.com> | 2013-12-09 06:45:55 +0400 |
---|---|---|
committer | Sam Truzjan <pxqr.sta@gmail.com> | 2013-12-09 06:45:55 +0400 |
commit | 5727e7f6f9022cc40a07e17398c8bf619e0a690f (patch) | |
tree | 93cb1fd923c91a170933981718ed540313550ec0 /tests/Network/BitTorrent/Exchange/MessageSpec.hs | |
parent | b00f17874babc0a63a501a4fb33f4f9c8b7d5c7d (diff) |
Rename ProtocolString newtype to ProtocolName
Diffstat (limited to 'tests/Network/BitTorrent/Exchange/MessageSpec.hs')
-rw-r--r-- | tests/Network/BitTorrent/Exchange/MessageSpec.hs | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/tests/Network/BitTorrent/Exchange/MessageSpec.hs b/tests/Network/BitTorrent/Exchange/MessageSpec.hs index 5d332eaa..6a794ce2 100644 --- a/tests/Network/BitTorrent/Exchange/MessageSpec.hs +++ b/tests/Network/BitTorrent/Exchange/MessageSpec.hs | |||
@@ -2,8 +2,6 @@ module Network.BitTorrent.Exchange.MessageSpec (spec) where | |||
2 | import Control.Applicative | 2 | import Control.Applicative |
3 | import Control.Exception | 3 | import Control.Exception |
4 | import Data.ByteString as BS | 4 | import Data.ByteString as BS |
5 | import Data.ByteString.Lazy as BL | ||
6 | import Data.Default | ||
7 | import Data.List as L | 5 | import Data.List as L |
8 | import Data.Set as S | 6 | import Data.Set as S |
9 | import Data.Serialize as S | 7 | import Data.Serialize as S |
@@ -14,7 +12,7 @@ import Test.QuickCheck | |||
14 | import Data.Torrent.BitfieldSpec () | 12 | import Data.Torrent.BitfieldSpec () |
15 | import Data.Torrent.InfoHashSpec () | 13 | import Data.Torrent.InfoHashSpec () |
16 | import Network.BitTorrent.CoreSpec () | 14 | import Network.BitTorrent.CoreSpec () |
17 | import Network.BitTorrent.Core | 15 | import Network.BitTorrent.Core () |
18 | import Network.BitTorrent.Exchange.BlockSpec () | 16 | import Network.BitTorrent.Exchange.BlockSpec () |
19 | import Network.BitTorrent.Exchange.Message | 17 | import Network.BitTorrent.Exchange.Message |
20 | 18 | ||
@@ -24,7 +22,7 @@ instance Arbitrary Extension where | |||
24 | instance Arbitrary Caps where | 22 | instance Arbitrary Caps where |
25 | arbitrary = toCaps <$> arbitrary | 23 | arbitrary = toCaps <$> arbitrary |
26 | 24 | ||
27 | instance Arbitrary ProtocolString where | 25 | instance Arbitrary ProtocolName where |
28 | arbitrary = fromString <$> (arbitrary `suchThat` ((200 <) . L.length)) | 26 | arbitrary = fromString <$> (arbitrary `suchThat` ((200 <) . L.length)) |
29 | 27 | ||
30 | instance Arbitrary Handshake where | 28 | instance Arbitrary Handshake where |
@@ -85,12 +83,12 @@ spec = do | |||
85 | byteLength (stats msg) `shouldBe` | 83 | byteLength (stats msg) `shouldBe` |
86 | fromIntegral (BS.length (S.encode (msg :: Message))) | 84 | fromIntegral (BS.length (S.encode (msg :: Message))) |
87 | 85 | ||
88 | describe "ProtocolString" $ do | 86 | describe "ProtocolName" $ do |
89 | it "fail to construct invalid string" $ do | 87 | it "fail to construct invalid string" $ do |
90 | let str = L.replicate 500 'x' | 88 | let str = L.replicate 500 'x' |
91 | evaluate (fromString str :: ProtocolString) | 89 | evaluate (fromString str :: ProtocolName) |
92 | `shouldThrow` | 90 | `shouldThrow` |
93 | errorCall ("fromString: ProtocolString too long: " ++ str) | 91 | errorCall ("fromString: ProtocolName too long: " ++ str) |
94 | 92 | ||
95 | describe "Handshake" $ do | 93 | describe "Handshake" $ do |
96 | it "properly serialized" $ property $ \ hs -> | 94 | it "properly serialized" $ property $ \ hs -> |