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:
Jesse Rosenthal
2018-01-22 09:55:41 -05:00
parent 0e48c216bc
commit 5cdac2607d
+1 -7
View File
@@ -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)
--------------------------------------------------------------