Le 2015-12-03 14:54, Jan Synáček a écrit :
Hello,

does a unit test framework for GNU Guile exist? Something like
"unittest" for Python for example.

The unit test framework is srfi-64 [0]. You can find an example use in 8sync [1]. Mind the fact that it doesn't use `test-group` which can be required in complex settings.

For no good reason that I can remember, I use my own testing forms that looks like the following:

```
(define-syntax test-check
  (syntax-rules ()
    ((_ title tested-expression expected-result)
     (begin
       (format #true "* Checking ~s" (list title))
       (let* ((expected expected-result)
              (produced tested-expression))
         (if (not (equal? expected produced))
             (begin (format #true "Expected: ~a" (list expected))
                    (format #true "Computed: ~a" (list produced)))))))))


(when (or (getenv "CHECK") (getenv "CHECK_MARKDOWN"))

  (test-check "parse simple paragraph"
              (markdown "something")
              '((p "something"))))

```

HTH



[0] http://srfi.schemers.org/srfi-64/srfi-64.html
[1] https://notabug.org/cwebber/8sync/src/master/tests/test-agenda.scm

Reply via email to