on master help sign in
Merge pull request #1048 from laszlopandy/test-fix-empty-expected-files
9af9dcbEvan Czaplicki
tests/Test/Compiler.hs+3
@@ -121,6 +121,9 @@ doWriteNewExpectedTest expectedJsDir filePath =
121 case formattedResult of
121 case formattedResult of
122 Right (Compiler.Result _ _ js) ->
122 Right (Compiler.Result _ _ js) ->
123 do createDirectoryIfMissing True (dropFileName expectedFilePath)
123 do createDirectoryIfMissing True (dropFileName expectedFilePath)
124+ -- Force the evaluation of "js" before "writeFile"
125+ -- so that if an error is raised we do not write an empty file.
126+ assertBool "Error: no content generated" (length js > 0)
124 writeFile expectedFilePath js
127 writeFile expectedFilePath js
125 assertFailure ("Wrote new expected js: " ++ expectedFilePath)
128 assertFailure ("Wrote new expected js: " ++ expectedFilePath)
126
129