* GNU Guile unit test framework
@ 2015-12-03 13:54 Jan Synáček
2015-12-03 14:12 ` Thompson, David
2015-12-03 14:30 ` Amirouche Boubekki
0 siblings, 2 replies; 7+ messages in thread
From: Jan Synáček @ 2015-12-03 13:54 UTC (permalink / raw)
To: guile-user
Hello,
does a unit test framework for GNU Guile exist? Something like
"unittest" for Python for example.
Cheers,
--
Jan Synáček
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: GNU Guile unit test framework
2015-12-03 13:54 GNU Guile unit test framework Jan Synáček
@ 2015-12-03 14:12 ` Thompson, David
2015-12-03 14:24 ` Jan Synáček
2015-12-03 14:30 ` Amirouche Boubekki
1 sibling, 1 reply; 7+ messages in thread
From: Thompson, David @ 2015-12-03 14:12 UTC (permalink / raw)
To: Jan Synáček; +Cc: Guile User
On Thu, Dec 3, 2015 at 8:54 AM, Jan Synáček <jan.synacek@gmail.com> wrote:
>
> does a unit test framework for GNU Guile exist? Something like
> "unittest" for Python for example.
Guile comes with SRFI-64, a unit testing specification. See:
http://srfi.schemers.org/srfi-64/srfi-64.html
Here's a "real world" example of its use from the Guix project:
http://git.savannah.gnu.org/cgit/guix.git/tree/tests/packages.scm
- Dave
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: GNU Guile unit test framework
2015-12-03 14:12 ` Thompson, David
@ 2015-12-03 14:24 ` Jan Synáček
2015-12-03 23:17 ` Jan Wedekind
0 siblings, 1 reply; 7+ messages in thread
From: Jan Synáček @ 2015-12-03 14:24 UTC (permalink / raw)
To: Thompson, David; +Cc: Guile User
On Thu, Dec 3, 2015 at 3:12 PM, Thompson, David
<dthompson2@worcester.edu> wrote:
> On Thu, Dec 3, 2015 at 8:54 AM, Jan Synáček <jan.synacek@gmail.com> wrote:
>>
>> does a unit test framework for GNU Guile exist? Something like
>> "unittest" for Python for example.
>
> Guile comes with SRFI-64, a unit testing specification. See:
> http://srfi.schemers.org/srfi-64/srfi-64.html
>
> Here's a "real world" example of its use from the Guix project:
> http://git.savannah.gnu.org/cgit/guix.git/tree/tests/packages.scm
I *knew* I saw it somewhere:)
Thank you!
--
Jan Synáček
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: GNU Guile unit test framework
2015-12-03 14:24 ` Jan Synáček
@ 2015-12-03 23:17 ` Jan Wedekind
0 siblings, 0 replies; 7+ messages in thread
From: Jan Wedekind @ 2015-12-03 23:17 UTC (permalink / raw)
To: Jan Synáček, Thompson, David; +Cc: Guile User
I am currently using guile-tap [1] which generates output for Automake TAP (Test Anything Protocol). It does not provide mocking though. One could have a look at how Clojure/Midje for that.
[1] https://github.com/wedesoft/guile-tap/blob/master/README.md
On December 3, 2015 2:24:51 PM GMT, "Jan Synáček" <jan.synacek@gmail.com> wrote:
>On Thu, Dec 3, 2015 at 3:12 PM, Thompson, David
><dthompson2@worcester.edu> wrote:
>> On Thu, Dec 3, 2015 at 8:54 AM, Jan Synáček <jan.synacek@gmail.com>
>wrote:
>>>
>>> does a unit test framework for GNU Guile exist? Something like
>>> "unittest" for Python for example.
>>
>> Guile comes with SRFI-64, a unit testing specification. See:
>> http://srfi.schemers.org/srfi-64/srfi-64.html
>>
>> Here's a "real world" example of its use from the Guix project:
>> http://git.savannah.gnu.org/cgit/guix.git/tree/tests/packages.scm
>
>I *knew* I saw it somewhere:)
>
>Thank you!
--
Jan Wedekind
http://www.wedesoft.de/
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: GNU Guile unit test framework
2015-12-03 13:54 GNU Guile unit test framework Jan Synáček
2015-12-03 14:12 ` Thompson, David
@ 2015-12-03 14:30 ` Amirouche Boubekki
2015-12-03 15:42 ` Christopher Allan Webber
1 sibling, 1 reply; 7+ messages in thread
From: Amirouche Boubekki @ 2015-12-03 14:30 UTC (permalink / raw)
To: Jan Synáček
Cc: guile-user, guile-user-bounces+amirouche=hypermove.net
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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: GNU Guile unit test framework
2015-12-03 14:30 ` Amirouche Boubekki
@ 2015-12-03 15:42 ` Christopher Allan Webber
2015-12-03 16:02 ` Amirouche Boubekki
0 siblings, 1 reply; 7+ messages in thread
From: Christopher Allan Webber @ 2015-12-03 15:42 UTC (permalink / raw)
To: Amirouche Boubekki; +Cc: guile-user, guile-user-bounces+amirouche=hypermove.net
Amirouche Boubekki writes:
> 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.
>
> [...]
>
> [0] http://srfi.schemers.org/srfi-64/srfi-64.html
> [1] https://notabug.org/cwebber/8sync/src/master/tests/test-agenda.scm
Yes, I borrowed that pattern from David Thompson (thanks Dave!).
It's a quick and dirty way to do tests. Things could be better
though... 8sync does not report each individual test's success/failure
count in the final result, just the whole module.
I think we could probably improve upon things.
However, I *do* recommend setting up something like this as early as
absolutely possible. Moving REPL experiments you hack on into tests as
soon as you verify that they work is a great way to build up tests
without hating doing it.
- Chris
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: GNU Guile unit test framework
2015-12-03 15:42 ` Christopher Allan Webber
@ 2015-12-03 16:02 ` Amirouche Boubekki
0 siblings, 0 replies; 7+ messages in thread
From: Amirouche Boubekki @ 2015-12-03 16:02 UTC (permalink / raw)
To: Christopher Allan Webber
Cc: guile-user, guile-user-bounces+amirouche=hypermove.net
Le 2015-12-03 16:42, Christopher Allan Webber a écrit :
> Amirouche Boubekki writes:
>
>> 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.
>>
>> [...]
>>
>> [0] http://srfi.schemers.org/srfi-64/srfi-64.html
>> [1] https://notabug.org/cwebber/8sync/src/master/tests/test-agenda.scm
>
> However, I *do* recommend setting up something like this as early as
> absolutely possible. Moving REPL experiments you hack on into tests as
> soon as you verify that they work is a great way to build up tests
> without hating doing it.
Exactly my thought!
Even tho I don't practice TDD (test before coding) I really value tests
as
maintainer in the sens that they help moving forward in serenity and as
a
code reader for instance in 8sync, they are narrow examples of how
things
works which help to understand the overall program.
Happy hacking!
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2015-12-03 23:17 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-03 13:54 GNU Guile unit test framework Jan Synáček
2015-12-03 14:12 ` Thompson, David
2015-12-03 14:24 ` Jan Synáček
2015-12-03 23:17 ` Jan Wedekind
2015-12-03 14:30 ` Amirouche Boubekki
2015-12-03 15:42 ` Christopher Allan Webber
2015-12-03 16:02 ` Amirouche Boubekki
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).