From: Ramakrishnan Muthukrishnan Date: Wed, 26 Jul 2017 11:53:49 +0000 (+0530) Subject: add a very simple Metainfo test X-Git-Url: https://git.rkrishnan.org/about.html?a=commitdiff_plain;h=1001ed08048be077081aa6829186e0b35bd69193;p=functorrent.git add a very simple Metainfo test --- diff --git a/test/Main.hs b/test/Main.hs index 974ec54..2d8cf8c 100644 --- a/test/Main.hs +++ b/test/Main.hs @@ -4,9 +4,11 @@ module Main where import qualified MagneturiTests as Muri import qualified BencodeTests as Benc +import qualified MetainfoTests as Minfo main :: IO () main = do Muri.tests + Minfo.tests Benc.tests diff --git a/test/MetainfoTests.hs b/test/MetainfoTests.hs new file mode 100644 index 0000000..86ecf48 --- /dev/null +++ b/test/MetainfoTests.hs @@ -0,0 +1,17 @@ +-- | Tests for Metainfo module + +module MetainfoTests where + +import Prelude hiding (readFile) + +import FuncTorrent.Metainfo +import Test.Hspec +import Data.ByteString (readFile) + +tests :: IO () +tests = hspec $ do + describe "read and interpret a torrent file 1" $ do + it "valid announceList" $ do + fc <- readFile "data/debian-7.8.0-amd64-CD-1.iso.torrent" + (torrentToMetainfo fc) `shouldNotBe` (Left "parse error") +