module Main where import Test.HUnit import Test.HUnit.Text import Data.Text.IO as TI import Data.Text (pack) import Text.Subtitles.SRT main :: IO () main = runTestTT (TestList [test srtAssert]) >> return () srtAssert :: Assertion srtAssert = do srtContents <- TI.readFile "./test/example.srt" case parseOnly' parseSRT srtContents of Left _ -> assertFailure "Error while parsing the example .srt" Right r -> assertEqual "Parser didn't produce the expected value" expectedValue r {- I wanted the parser to produce this output, when it accomplish it, it will be - complete -} expectedValue :: Subtitles expectedValue = [ Line 1 (Range (Time 0 2 26 407) (Time 0 2 31 356)) (Just (R 100 100 100 100)) (pack "Detta handlar om min storebrors \nkriminella beteende och foersvinnade."), Line 2 (Range (Time 0 2 31 567) (Time 0 2 37 164)) Nothing (pack "Vi talar inte laengre om Wade. Det aer \nsom om han aldrig hade existerat.")]