summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2017-07-15 11:39:01 +0200
committerJohn MacFarlane <jgm@berkeley.edu>2017-07-15 11:39:01 +0200
commit4e8f7a179677601eb39f8fdd1b0074d24229b7a5 (patch)
tree72b93ab6271d8098971c789bc161bcf64ba97e32
parentdcf79c418801a823f917a97ab1e8461959f0189a (diff)
Fix docx writer test for ghc 8.2.1.
Workaround for different behavior of Data.Unique in different ghc versions.
-rw-r--r--test/Tests/Writers/Docx.hs10
1 files changed, 9 insertions, 1 deletions
diff --git a/test/Tests/Writers/Docx.hs b/test/Tests/Writers/Docx.hs
index a3e73b479..ec147604c 100644
--- a/test/Tests/Writers/Docx.hs
+++ b/test/Tests/Writers/Docx.hs
@@ -6,6 +6,7 @@ import Tests.Helpers
import Text.Pandoc.Class (runIOorExplode)
import Text.Pandoc.Definition
import Text.Pandoc.Options
+import Text.Pandoc.Walk
import Text.Pandoc.Readers.Docx
import Text.Pandoc.Readers.Native
import Text.Pandoc.Writers.Docx
@@ -27,7 +28,14 @@ compareOutput (wopts, ropts) nativeFileIn nativeFileOut = do
writeDocx wopts{writerUserDataDir = Just (".." </> "data")} >>=
readDocx ropts
orig <- readNative def nf'
- return (roundtripped, orig)
+ return (walk fixImages roundtripped, walk fixImages orig)
+
+-- make all image filenames "image", since otherwise round-trip
+-- tests fail because of different behavior of Data.Unique in
+-- different ghc versions...
+fixImages :: Inline -> Inline
+fixImages (Image attr alt (_,tit)) = Image attr alt ("image",tit)
+fixImages x = x
testCompareWithOptsIO :: Options -> String -> FilePath -> FilePath -> IO TestTree
testCompareWithOptsIO opts name nativeFileIn nativeFileOut = do