add a very simple Metainfo test
authorRamakrishnan Muthukrishnan <ram@rkrishnan.org>
Wed, 26 Jul 2017 11:53:49 +0000 (17:23 +0530)
committerRamakrishnan Muthukrishnan <ram@rkrishnan.org>
Wed, 26 Jul 2017 11:53:49 +0000 (17:23 +0530)
test/Main.hs
test/MetainfoTests.hs [new file with mode: 0644]

index 974ec54443638dde5572817eee2e90794afc3318..2d8cf8ca2f7b06986c5aee8d443625ac89d844aa 100644 (file)
@@ -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 (file)
index 0000000..86ecf48
--- /dev/null
@@ -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")
+