How to use detailed-0.9 in cabal testing

六月ゝ 毕业季﹏ 提交于 2019-12-01 18:19:46

But for what it's worth, here is some code that works:

module Main (tests) where

import Distribution.TestSuite

tests :: IO [Test]
tests = do
  return [   
      test "foo" Pass
    , test "bar" (Fail "It did not work out!")
    ]

test :: String -> Result -> Test
test name r = Test t
  where          
    t = TestInstance {
        run = return (Finished r)
      , name = name
      , tags = []
      , options = []
      , setOption = \_ _ -> Right t
      }

There is not much support for detailed-0.9 out there. It's possible to hook up existing testing libraries to use it, but even then you will not get progress information as tests pass.

I recommend to use the exitcode-stdio-1.0 interface together with an existing testing framework + use GHCi during development.

A full example for Hspec is here https://github.com/sol/hspec-example.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!