git.iko.soy/typeable/pandoc
on master help sign in
Powerpoint writer tests: simplify updating function

We had previously re-read the native file and converted it to Powerpoint. But we have already done that in constructing the test archive. So now we just convert the archive back to a bytestring and write it to disk.

commit5cdac2607dcb2ad66e7e9aba3521948669724cda authorJesse Rosenthal <jrosenthal@jhu.edu> dateMon 22 Jan 2018, 09:55 (9 years ago) parent0e48c21
1 file changed+1−7
test/Tests/Writers/Powerpoint.hs+1−7
test/Tests/Writers/Powerpoint.hs+1−7
@@ -58,12 +58,6 @@ testArchive opts fp = do
5858 bs <- runIOorExplode $ readNative def txt >>= writePowerpoint opts
5959 return $ toArchive bs
6060
61−updateGoldenFile :: WriterOptions -> FilePath -> FilePath -> IO ()
62−updateGoldenFile opts nativeFP goldenFP = do
63− txt <- T.readFile nativeFP
64− bs <- runIOorExplode $ readNative def txt >>= writePowerpoint opts
65− BL.writeFile goldenFP bs
66−
6761compareFileList :: FilePath -> Archive -> Archive -> Maybe String
6862compareFileList goldenFP goldenArch testArch =
6963 let testFiles = filesInArchive testArch
@@ -184,7 +178,7 @@ pptxTest testName opts nativeFP goldenFP =
184178 , compareAllMediaFiles goldenArch testArch
185179 ]
186180 in return $ if null res then Nothing else Just $ unlines res)
187− (\_ -> updateGoldenFile opts nativeFP goldenFP)
181+ (\a -> BL.writeFile goldenFP $ fromArchive a)
188182
189183--------------------------------------------------------------
190184