From 1001ed08048be077081aa6829186e0b35bd69193 Mon Sep 17 00:00:00 2001 From: Ramakrishnan Muthukrishnan Date: Wed, 26 Jul 2017 17:23:49 +0530 Subject: [PATCH] add a very simple Metainfo test --- test/Main.hs | 2 ++ test/MetainfoTests.hs | 17 +++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 test/MetainfoTests.hs 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") + -- 2.37.2