git.iko.soy/typeable/pandoc
on master help sign in
FB2 reader test: filter CRs.
e35147dJohn MacFarlane
test/Tests/Readers/FB2.hs+2−2
@@ -20,14 +20,14 @@ import qualified Data.ByteString as BS
20import Text.Pandoc
20import Text.Pandoc
21import Text.Pandoc.UTF8 (toText, fromTextLazy)
21import Text.Pandoc.UTF8 (toText, fromTextLazy)
22import Data.Text (Text)
22import Data.Text (Text)
23−import Data.Text.Lazy (fromStrict)
23+import qualified Data.Text.Lazy as TL
24import System.FilePath (replaceExtension)
24import System.FilePath (replaceExtension)
25
25
26fb2ToNative :: Text -> Text
26fb2ToNative :: Text -> Text
27fb2ToNative = purely (writeNative def{ writerTemplate = Just mempty }) . purely (readFB2 def)
27fb2ToNative = purely (writeNative def{ writerTemplate = Just mempty }) . purely (readFB2 def)
28
28
29fb2Test :: TestName -> FilePath -> TestTree
29fb2Test :: TestName -> FilePath -> TestTree
30−fb2Test name path = goldenVsString name native (fromTextLazy . fromStrict . fb2ToNative . toText <$> BS.readFile path)
30+fb2Test name path = goldenVsString name native (fromTextLazy . TL.filter (/= '\r') . TL.fromStrict . fb2ToNative . toText <$> BS.readFile path)
31 where native = replaceExtension path ".native"
31 where native = replaceExtension path ".native"
32
32
33tests :: [TestTree]
33tests :: [TestTree]