QuickCheck exit status on failures, and cabal integration

前端 未结 2 1844
[愿得一人]
[愿得一人] 2021-01-11 17:29

I\'m trying to understand how to integrate some quickcheck tests with cabal. This gist suggests that the quickCheck function returns non-zero status on failure,

相关标签:
2条回答
  • 2021-01-11 17:56

    Looking at quickCheck's implementation, it indeed never exits the program. However, you can easily implement this behaviour using quickCheckResult:

    import Control.Monad
    import Test.QuickCheck
    import Test.QuickCheck.Test
    import System.Exit
    
    main :: IO ()
    main = do
      result <- quickCheckResult prop
      unless (isSuccess result) exitFailure
    

    My understanding is that detailed-1.0 is not considered ready for general use yet, and that exitcode-stdio-1.0 is still the recommended testing solution for now.

    0 讨论(0)
  • 2021-01-11 18:13

    I used test-framework in the latest version of my Decimal package. It was not overkill; it did just what was wanted. Take a look at the complete source code if you want an example of how to use it.

    0 讨论(0)
提交回复
热议问题