From 4e8f7a179677601eb39f8fdd1b0074d24229b7a5 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sat, 15 Jul 2017 11:39:01 +0200 Subject: Fix docx writer test for ghc 8.2.1. Workaround for different behavior of Data.Unique in different ghc versions. --- test/Tests/Writers/Docx.hs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'test') 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 -- cgit v1.2.3