diff options
Diffstat (limited to 'tests/Network/BitTorrent/Tracker/MessageSpec.hs')
-rw-r--r-- | tests/Network/BitTorrent/Tracker/MessageSpec.hs | 14 |
1 files changed, 1 insertions, 13 deletions
diff --git a/tests/Network/BitTorrent/Tracker/MessageSpec.hs b/tests/Network/BitTorrent/Tracker/MessageSpec.hs index 44dc2c7a..a95cf0d7 100644 --- a/tests/Network/BitTorrent/Tracker/MessageSpec.hs +++ b/tests/Network/BitTorrent/Tracker/MessageSpec.hs | |||
@@ -40,23 +40,11 @@ instance Arbitrary AnnounceQuery where | |||
40 | <$> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary | 40 | <$> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary |
41 | <*> arbitrary <*> arbitrary <*> arbitrary | 41 | <*> arbitrary <*> arbitrary <*> arbitrary |
42 | 42 | ||
43 | baseURI :: URI | ||
44 | baseURI = fromJust $ parseURI "http://a" | ||
45 | |||
46 | parseUriQuery :: URI -> SimpleQuery | ||
47 | parseUriQuery = filterMaybes . parseQuery . BC.pack . uriQuery | ||
48 | where | ||
49 | filterMaybes :: [(a, Maybe b)] -> [(a, b)] | ||
50 | filterMaybes = catMaybes . L.map f | ||
51 | where | ||
52 | f (a, Nothing) = Nothing | ||
53 | f (a, Just b ) = Just (a, b) | ||
54 | |||
55 | spec :: Spec | 43 | spec :: Spec |
56 | spec = do | 44 | spec = do |
57 | describe "Announce" $ do | 45 | describe "Announce" $ do |
58 | it "properly url encoded" $ property $ \ q -> | 46 | it "properly url encoded" $ property $ \ q -> |
59 | parseAnnounceQuery (parseUriQuery (renderAnnounceQuery baseURI q)) | 47 | parseAnnounceQuery (renderAnnounceQuery q) |
60 | `shouldBe` Right q | 48 | `shouldBe` Right q |
61 | 49 | ||
62 | describe "Scrape" $ do | 50 | describe "Scrape" $ do |