on master help sign in
Merge pull request #1052 from laszlopandy/test-fix-empty-expected-files-2

Expected tests: don't fail on empty output if there is no error

commit96316ef61a74ee3285dafcce68a6aff69b10c598 authorEvan Czaplicki <info@elm-lang.org> dateThu 10 Sep 2015, 12:52 (11 years ago) parent563d322144a15a
1 file changed+4−3
tests/Test/Compiler.hs+4−3
tests/Test/Compiler.hs+4−3
@@ -121,9 +121,10 @@ doWriteNewExpectedTest expectedJsDir filePath =
121121 case formattedResult of
122122 Right (Compiler.Result _ _ js) ->
123123 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+ -- Force the evaluation of `js` before `writeFile`
125+ -- so that if an error is raised we do not unintentionally write an empty file.
126+ -- NB: `js` can be an empty string in the case of NoExpressions.elm
127+ assertBool "" (length js >= 0)
127128 writeFile expectedFilePath js
128129 assertFailure ("Wrote new expected js: " ++ expectedFilePath)
129130