]> git.rkrishnan.org Git - functorrent.git/blob - test/MetainfoTests.hs
727de500e705981e0bb3c6acbd9c972a88def022
[functorrent.git] / test / MetainfoTests.hs
1 -- | Tests for Metainfo module
2
3 module MetainfoTests where
4
5 import Prelude hiding (readFile)
6
7 import FuncTorrent.Metainfo
8 import Test.Hspec
9 import Data.ByteString (readFile)
10
11 tests :: IO ()
12 tests = hspec $ do
13   describe "read and interpret a torrent file 1" $ do
14     it "valid torrent file" $ do
15       fc <- readFile "data/debian-7.8.0-amd64-CD-1.iso.torrent"
16       (torrentToMetainfo fc) `shouldNotBe` (Left "parse error")
17     it "valid announce list" $ do
18       fc <- readFile "data/debian-7.8.0-amd64-CD-1.iso.torrent"
19       case torrentToMetainfo fc of
20         Left _ -> pending
21         Right metainfo -> do
22             announceList metainfo `shouldSatisfy` (not . null)
23