[Haskell-cafe] ANNOUNCE: doctest-0.3.0
Simon Hengel
simon.hengel at wiktory.org
Thu Jun 16 20:22:16 CEST 2011
I just uploaded a new version of doctest[1] to Hackage.
WHAT IS doctest?
================
doctest is a port of Python's doctest[2] to Haskell. It can be used to
verify, that examples in Haddock comments[3] do still work. This also
provides you with a simple mechanism to write unit test, without the
burden of maintaining a dedicated test suite.
A basic example of usage is at [4].
WHAT'S NEW IN THIS VERSION?
===========================
It is now possible to intersperse comments between a longer, continuing
example. All examples within the same comment now share a namespace.
The following now works :
-- | Calculate Fibonacci number of given 'Num'.
--
-- First let's set `n` to ten:
--
-- >>> let n = 10
--
-- And now calculate the 10th Fibonacci number:
--
-- >>> fib n
-- 55
fib :: Integer -> Integer
fib 0 = 0
fib 1 = 1
fib n = fib (n - 1) + fib (n - 2)
Thanks to Sakari Jokinen for this contribution!
In addition I changed the name from DocTest to doctest. I think using
all lower-case package names is a good thing. And as we will use
doctest as a library in the near future, this was the last chance for
this change.
Cheers,
Simon
[1] http://hackage.haskell.org/cgi-bin/hackage-scripts/package/doctest
[2] http://docs.python.org/library/doctest.html
[3] http://www.haskell.org/haddock/doc/html/ch03s08.html#id566093
[4] http://haskell.org/haskellwiki/DocTest
More information about the Haskell-Cafe
mailing list