]> git.rkrishnan.org Git - functorrent.git/blobdiff - test/MetainfoTests.hs
metainfotests: refactor
[functorrent.git] / test / MetainfoTests.hs
index 9f1a2e23b19d7dec2f58765030221df6e73dff44..a9043db8ec70eea5ae94c1905c76c878fa2d1454 100644 (file)
@@ -33,28 +33,27 @@ tests :: IO ()
 tests = do
   fc <- readFile "data/debian-7.8.0-amd64-CD-1.iso.torrent"
   let minfo = torrentToMetainfo fc
-  putStrLn $ show minfo
   hspec $ do
     describe "read and interpret a torrent file 1" $ do
       it "valid torrent file" $ do
-        (torrentToMetainfo fc) `shouldNotBe` (Left "parse error")
+        minfo `shouldNotBe` (Left "parse error")
       it "valid announce list" $ do
-        case torrentToMetainfo fc of
+        case minfo of
           Left _ -> pending
           Right metainfo -> do
             announceList metainfo `shouldSatisfy` (not . null)
       it "valid piece length" $ do
-        case torrentToMetainfo fc of
+        case minfo of
           Left _ -> pending
           Right metainfo -> do
             let (Just info') = info metainfo
             pieceLength info' `shouldBe` (524288 :: Integer)
       it "Not a multifile torrent" $ do
-        case torrentToMetainfo fc of
+        case minfo of
           Left _ -> pending
           Right metainfo -> do 
             let (Just i) = info metainfo
-            (length (filemeta i)) `shouldSatisfy` (== 0)
+            (length (filemeta i)) `shouldSatisfy` (== 1)
 
     describe "read and interpret a multifile torrent file" $ do
       it "valid multifile torrent file" $ do