Current state of integrating unit tests with Haskell's Cabal?

ぃ、小莉子 提交于 2019-12-03 03:45:33

问题


When i google for how to integrate unit tests with cabal files, i either find

  • http://www.haskell.org/haskellwiki/How_to_write_a_Haskell_program which does not seem to describe the integration of HUnit/QuickCheck with the Cabal file
  • or i see messages like "wait for Cabal x.y which will support cabal test" but i can not find any documentation for this either

How would you run all unit test using cabal (for example everytime i do a "cabal build") today?


回答1:


  1. Make sure you have the latest version of Cabal and cabal-install installed.

  2. Have a test-suite section in your .cabal file. See this section of cabal's documentation for an explanation of how to write a test-suite section in your Cabal file and this section for instructions on how to run it.

I've been using the built-in test support for some time and it has saved me from having to maintain fragile Makefiles just for my tests. There are still some rough edges in the command line output of cabal test, but they have been fixed in HEAD so in the next Cabal/cabal-install release everything should be very smooth.



来源:https://stackoverflow.com/questions/6787231/current-state-of-integrating-unit-tests-with-haskells-cabal

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