diff options
author | John MacFarlane <jgm@berkeley.edu> | 2021-08-10 22:07:48 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2021-08-10 22:07:48 -0700 |
commit | 06d97131e530d2ee9b14617290a157dd42c0db30 (patch) | |
tree | fba6417b573299b1662e737cbd10470be80e7d48 /test/Tests/Readers | |
parent | 3a924d8f96a336f6adcee5dd4c924c14a92a5bf7 (diff) | |
download | pandoc-06d97131e530d2ee9b14617290a157dd42c0db30.tar.gz |
Tests.Helpers: export testGolden and use it in RTF reader.
This gives a diff output on failure.
Diffstat (limited to 'test/Tests/Readers')
-rw-r--r-- | test/Tests/Readers/RTF.hs | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/test/Tests/Readers/RTF.hs b/test/Tests/Readers/RTF.hs index da0ddfc93..1b335274b 100644 --- a/test/Tests/Readers/RTF.hs +++ b/test/Tests/Readers/RTF.hs @@ -13,25 +13,18 @@ module Tests.Readers.RTF (tests) where import Test.Tasty import Tests.Helpers -import Test.Tasty.Golden (goldenVsString) -import qualified Data.ByteString as BS import Text.Pandoc -import Text.Pandoc.UTF8 (toText, fromStringLazy) -import Data.Text (Text, unpack) import System.FilePath (replaceExtension, (</>), (<.>)) -rtfToNative :: Text -> Text -rtfToNative = - purely (writeNative def{ writerTemplate = Just mempty }) . - purely (readRTF def) - rtfTest :: TestName -> TestTree -rtfTest name = goldenVsString name native - (fromStringLazy . filter (/='\r') . unpack . rtfToNative . toText - <$> BS.readFile path) +rtfTest name = testGolden name native path + (\t -> runIOorExplode + (readRTF def t >>= + writeNative def{ writerTemplate = Just mempty })) where native = replaceExtension path ".native" path = "rtf" </> name <.> "rtf" + tests :: [TestTree] tests = map rtfTest [ "footnote" , "accent" |