aboutsummaryrefslogtreecommitdiff
path: root/test/Tests/Readers/FB2.hs
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2019-09-15 10:27:19 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2019-09-15 10:27:19 -0700
commit45b763630720b046c344e46534170cebb472936d (patch)
treee7b549220905cde4e9a0ffdd80ebc48b8cd93443 /test/Tests/Readers/FB2.hs
parentc65af7d1a2f35cbfd1235df2960f7156d38e8f92 (diff)
downloadpandoc-45b763630720b046c344e46534170cebb472936d.tar.gz
Revert "FB2 reader test: better diagnostics on failure."
This reverts commit c65af7d1a2f35cbfd1235df2960f7156d38e8f92.
Diffstat (limited to 'test/Tests/Readers/FB2.hs')
-rw-r--r--test/Tests/Readers/FB2.hs29
1 files changed, 1 insertions, 28 deletions
diff --git a/test/Tests/Readers/FB2.hs b/test/Tests/Readers/FB2.hs
index 2eb713de7..4198b9b53 100644
--- a/test/Tests/Readers/FB2.hs
+++ b/test/Tests/Readers/FB2.hs
@@ -15,40 +15,13 @@ module Tests.Readers.FB2 (tests) where
import Prelude
import Test.Tasty
import Tests.Helpers
--- import Test.Tasty.Golden (goldenVsString)
-import Test.Tasty.Golden.Advanced (goldenTest)
-import Text.Printf
-import qualified Data.ByteString.Lazy as LBS
-
+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)
-simpleCmp :: Eq a => String -> a -> a -> IO (Maybe String)
-simpleCmp e x y =
- return $ if x == y then Nothing else Just e
-
-
-goldenVsString
- :: TestName -- ^ test name
- -> FilePath -- ^ path to the «golden» file (the file that contains correct output)
- -> IO LBS.ByteString -- ^ action that returns a string
- -> TestTree -- ^ the test verifies that the returned string is the same as the golden file contents
-goldenVsString name ref act =
- goldenTest
- name
- (BS.readFile ref)
- (LBS.toStrict <$> act)
- cmp
- upd
- where
- cmp x y = simpleCmp msg x y
- where
- msg = printf "Test output from %s was different from %s. It was: %s" ref (show x) (show y)
- upd = BS.writeFile ref
-
fb2ToNative :: Text -> Text
fb2ToNative = purely (writeNative def{ writerTemplate = Just mempty }) . purely (readFB2 def)