问题描述
当我谷歌如何整合与cabal文件的单元测试时,我要么找到
- ,它似乎没有描述HUnit / QuickCheck与Cabal文件的集成。
- 或者我看到诸如等待Cabal xy将支持cabal测试的消息,但是我找不到任何这样的文档
如何使用cabal运行所有单元测试(例如,每次我做cabal build)? ol>
请确保您安装了最新版本的Cabal和cabal-install。
.cabal
文件中。请参阅cabal文档的,了解如何编写在您的Cabal文件中 test-suite
部分和,了解如何运行它。 内置的测试支持已经有一段时间了,它使我不必为维护测试而维护脆弱的Makefiles。在 cabal test
的命令行输出中仍然存在一些粗糙的边缘,但是它们已经在HEAD中修复,因此在下一个Cabal / cabal-install版本中,一切都应该非常流畅。 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?
Make sure you have the latest version of Cabal and cabal-install installed.
Have a
test-suite
section in your.cabal
file. See this section of cabal's documentation for an explanation of how to write atest-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.
这篇关于与Haskell's Cabal整合单元测试的当前状态?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!