summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/Network/BitTorrent/Tracker/MessageSpec.hs14
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
43baseURI :: URI
44baseURI = fromJust $ parseURI "http://a"
45
46parseUriQuery :: URI -> SimpleQuery
47parseUriQuery = 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
55spec :: Spec 43spec :: Spec
56spec = do 44spec = 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