git.iko.soy/typeable/pandoc
on master help sign in
FB2 reader test: Another attempt to fix test failure on GitHub CI.
88a0327John MacFarlane
test/Tests/Readers/FB2.hs+5−4
@@ -18,16 +18,17 @@ import Tests.Helpers
18import Test.Tasty.Golden (goldenVsString)
18import Test.Tasty.Golden (goldenVsString)
19import qualified Data.ByteString as BS
19import qualified Data.ByteString as BS
20import Text.Pandoc
20import Text.Pandoc
21−import Text.Pandoc.UTF8 (toText, fromTextLazy)
21+import Text.Pandoc.UTF8 (toText, fromStringLazy)
22−import Data.Text (Text)
22+import Data.Text (Text, unpack)
23−import Data.Text.Lazy (fromStrict)
24import System.FilePath (replaceExtension)
23import System.FilePath (replaceExtension)
25
24
26fb2ToNative :: Text -> Text
25fb2ToNative :: Text -> Text
27fb2ToNative = purely (writeNative def{ writerTemplate = Just mempty }) . purely (readFB2 def)
26fb2ToNative = purely (writeNative def{ writerTemplate = Just mempty }) . purely (readFB2 def)
28
27
29fb2Test :: TestName -> FilePath -> TestTree
28fb2Test :: TestName -> FilePath -> TestTree
30−fb2Test name path = goldenVsString name native (fromTextLazy . fromStrict . fb2ToNative . toText <$> BS.readFile path)
29+fb2Test name path = goldenVsString name native
30+ (fromStringLazy . filter (/='\r') . unpack . fb2ToNative . toText
31+ <$> BS.readFile path)
31 where native = replaceExtension path ".native"
32 where native = replaceExtension path ".native"
32
33
33tests :: [TestTree]
34tests :: [TestTree]