Permalink
Browse files

Make test failure reason more clear in output

  • Loading branch information...
1 parent 0e0fa75 commit 2c842a01371b19cea1c685f193da71670b7d77e2 @tibbe tibbe committed Sep 26, 2012
Showing with 14 additions and 8 deletions.
  1. +14 −8 Cabal/tests/PackageTests/TestSuiteExeV10/Check.hs
@@ -14,27 +14,33 @@ import PackageTests.PackageTester
dir :: FilePath
dir = "PackageTests" </> "TestSuiteExeV10"
+assertBuildSucceeds result =
+ assertBool (msg ++ " (output: " ++ show result ++ ")") $
+ successful result
+ where msg = "\'setup build\' should succeed"
+
+assertTestSucceeds result =
+ assertBool (msg ++ " (output: " ++ show result ++ ")") $
+ successful result
+ where msg = "\'cabal test\' should succeed"
+
checkTest :: Version -> Test
checkTest cabalVersion = TestCase $ do
let spec = PackageSpec dir ["--enable-tests"]
buildResult <- cabal_build spec
- let buildMessage = "\'setup build\' should succeed"
- assertEqual buildMessage True $ successful buildResult
+ assertBuildSucceeds buildResult
testResult <- cabal_test spec []
- let testMessage = "\'setup test\' should succeed"
- assertEqual testMessage True $ successful testResult
+ assertTestSucceeds testResult
checkTestWithHpc :: Version -> Test
checkTestWithHpc cabalVersion = TestCase $ do
let spec = PackageSpec dir [ "--enable-tests"
, "--enable-library-coverage"
]
buildResult <- cabal_build spec
- let buildMessage = "\'setup build\' should succeed"
- assertEqual buildMessage True $ successful buildResult
+ assertBuildSucceeds buildResult
testResult <- cabal_test spec []
- let testMessage = "\'setup test\' should succeed"
- assertEqual testMessage True $ successful testResult
+ assertTestSucceeds testResult
let dummy = emptyTestSuite { testName = "test-Foo" }
tixFile = tixFilePath (dir </> "dist") $ testName dummy
tixFileMessage = ".tix file should exist"

0 comments on commit 2c842a0

Please sign in to comment.