guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Doctest for guile


From: Dmitry Bogatov
Subject: Doctest for guile
Date: Wed, 11 Sep 2013 19:03:53 +0400

Hello!
I am glad to offer implementation of doctest in Guile --- way to declare
and check tests in function docstring. In most simple way, if in
docstring you write following:

    +++ (foo 1 2 3)
    --- 6

doctests will check if it is really so. I belive it encourage writing
more modular, generic and pure function. Also, such tests helps to
understand function behavior on corner cases.

This is just proof-of-concept, that offer following:

+ test of multiple values
+ testing of not-exported functions.

You can just download attached archive(I belive it small enough to not
bother with ftp) and do following:
$ tar xf doctest.tar.gz
$ cd doctest
$ export GUILE_LOAD_PATH=$PWD
$ guile doctest.scm '(foo)'
## Two successful tests, one failure
## If no modules specified, doctest tests itself
$ guile doctest.scm

But much more is todo:

+ contollable verbosity
+ exit status on failed tests
+ shortcut for predicates
+ it crashes on input like this:

    +++ (foo 1 2 3
    --- 6
+ there is no way to say that test should throw
+ Your ideas?

I it will be found useful enough, I will gladly work on patch to integrate
doctest in Guile guild script.

Attachment: doctest.tar.gz
Description: Tarball of doctest sources

--
Best regards, Dmitry Bogatov <address@hidden>,
Free Software supporter and netiquette guardian.
        git clone git://kaction.name/rc-files.git --depth 1
        GPG: 54B7F00D
Html mail and proprietary format attachments are forwarded to /dev/null.

Attachment: pgpZQTkC6LsAs.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]