mirror of
https://github.com/jgm/pandoc.git
synced 2026-09-19 02:22:09 +08:00
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.
This commit is contained in:
@@ -58,12 +58,6 @@ testArchive opts fp = do
|
||||
bs <- runIOorExplode $ readNative def txt >>= writePowerpoint opts
|
||||
return $ toArchive bs
|
||||
|
||||
updateGoldenFile :: WriterOptions -> FilePath -> FilePath -> IO ()
|
||||
updateGoldenFile opts nativeFP goldenFP = do
|
||||
txt <- T.readFile nativeFP
|
||||
bs <- runIOorExplode $ readNative def txt >>= writePowerpoint opts
|
||||
BL.writeFile goldenFP bs
|
||||
|
||||
compareFileList :: FilePath -> Archive -> Archive -> Maybe String
|
||||
compareFileList goldenFP goldenArch testArch =
|
||||
let testFiles = filesInArchive testArch
|
||||
@@ -184,7 +178,7 @@ pptxTest testName opts nativeFP goldenFP =
|
||||
, compareAllMediaFiles goldenArch testArch
|
||||
]
|
||||
in return $ if null res then Nothing else Just $ unlines res)
|
||||
(\_ -> updateGoldenFile opts nativeFP goldenFP)
|
||||
(\a -> BL.writeFile goldenFP $ fromArchive a)
|
||||
|
||||
--------------------------------------------------------------
|
||||
|
||||
|
||||
Reference in New Issue
Block a user