From 4e9e1bae7cdd3d5317ac4d57346215c34dfc7358 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Fri, 14 Jul 2017 23:39:33 +0200 Subject: Refactored compareOutput in docx writer test --- test/Tests/Writers/Docx.hs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'test/Tests') diff --git a/test/Tests/Writers/Docx.hs b/test/Tests/Writers/Docx.hs index 215952893..fae41e9d4 100644 --- a/test/Tests/Writers/Docx.hs +++ b/test/Tests/Writers/Docx.hs @@ -19,16 +19,15 @@ compareOutput :: Options -> FilePath -> FilePath -> IO (Pandoc, Pandoc) -compareOutput opts nativeFileIn nativeFileOut = do +compareOutput (wopts, ropts) nativeFileIn nativeFileOut = do nf <- UTF8.toText <$> BS.readFile nativeFileIn nf' <- UTF8.toText <$> BS.readFile nativeFileOut - let wopts = fst opts - df <- runIOorExplode $ do - d <- readNative def nf - writeDocx wopts{writerUserDataDir = Just (".." "data")} d + df <- runIOorExplode $ + readNative def nf >>= + writeDocx wopts{writerUserDataDir = Just (".." "data")} >>= + readDocx ropts df' <- runIOorExplode (readNative def nf') - p <- runIOorExplode $ readDocx (snd opts) df - return (p, df') + return (df, df') testCompareWithOptsIO :: Options -> String -> FilePath -> FilePath -> IO TestTree testCompareWithOptsIO opts name nativeFileIn nativeFileOut = do -- cgit v1.2.3