Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

More test output tweaks

  • Loading branch information...
commit 5aadbbbf773a1a52dc2d536c0a04a19d88672a9b 1 parent 2c842a0
Johan Tibell tibbe authored
3  Cabal/tests/PackageTests/BenchmarkExeV10/Check.hs
View
@@ -17,5 +17,4 @@ checkBenchmark :: Version -> Test
checkBenchmark cabalVersion = TestCase $ do
let spec = PackageSpec dir ["--enable-benchmarks"]
buildResult <- cabal_build spec
- let buildMessage = "\'setup build\' should succeed"
- assertEqual buildMessage True $ successful buildResult
+ assertBuildSucceeded buildResult
18 Cabal/tests/PackageTests/PackageTester.hs
View
@@ -8,7 +8,9 @@ module PackageTests.PackageTester (
cabal_bench,
cabal_install,
unregister,
- run
+ run,
+ assertBuildSucceeded,
+ assertTestSucceeded
) where
import qualified Control.Exception.Extensible as E
@@ -25,6 +27,7 @@ import Control.Monad
import Data.List
import Data.Maybe
import qualified Data.ByteString.Char8 as C
+import Test.HUnit
data PackageSpec =
@@ -177,3 +180,16 @@ record :: PackageSpec -> Result -> IO ()
record spec res = do
C.writeFile (directory spec </> "test-log.txt") (C.pack $ outputText res)
+-- Test helpers:
+
+assertBuildSucceeded :: Result -> Assertion
+assertBuildSucceeded result = unless (successful result) $
+ assertFailure $
+ "expected: \'setup build\' should succeed\n" ++
+ " output: " ++ outputText result
+
+assertTestSucceeded :: Result -> Assertion
+assertTestSucceeded result = unless (successful result) $
+ assertFailure $
+ "expected: \'setup test\' should succeed\n" ++
+ " output: " ++ outputText result
18 Cabal/tests/PackageTests/TestSuiteExeV10/Check.hs
View
@@ -14,23 +14,13 @@ 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
- assertBuildSucceeds buildResult
+ assertBuildSucceeded buildResult
testResult <- cabal_test spec []
- assertTestSucceeds testResult
+ assertTestSucceeded testResult
checkTestWithHpc :: Version -> Test
checkTestWithHpc cabalVersion = TestCase $ do
@@ -38,9 +28,9 @@ checkTestWithHpc cabalVersion = TestCase $ do
, "--enable-library-coverage"
]
buildResult <- cabal_build spec
- assertBuildSucceeds buildResult
+ assertBuildSucceeded buildResult
testResult <- cabal_test spec []
- assertTestSucceeds testResult
+ assertTestSucceeded testResult
let dummy = emptyTestSuite { testName = "test-Foo" }
tixFile = tixFilePath (dir </> "dist") $ testName dummy
tixFileMessage = ".tix file should exist"
Please sign in to comment.
Something went wrong with that request. Please try again.