Re: Python-style doctests in Guile (implemented, please comment)

2017-10-14 Thread Arne Babenhauserheide
Vítor De Araújo writes: > On 10/10/2017 15:21, Arne Babenhauserheide wrote: >> I’m sorry for answering so late; your suggestion stuck to my mind as a >> clean and schemish solution for my usecase (thank you!) but it took me >> quite a while to realize it. > > I'm glad you liked it. :) I do, very

Re: Python-style doctests in Guile (implemented, please comment)

2017-10-10 Thread Vítor De Araújo
On 10/10/2017 15:21, Arne Babenhauserheide wrote: > Hi Vitor, > > I’m sorry for answering so late; your suggestion stuck to my mind as a > clean and schemish solution for my usecase (thank you!) but it took me > quite a while to realize it. I'm glad you liked it. :) [snip] > Now there’s one fir

Re: Python-style doctests in Guile (implemented, please comment)

2017-10-10 Thread Arne Babenhauserheide
Hi Vitor, I’m sorry for answering so late; your suggestion stuck to my mind as a clean and schemish solution for my usecase (thank you!) but it took me quite a while to realize it. Vítor De Araújo writes: > (define (double x) > "Returns twice the value of a given number." > #((examples [(dou

Re: Python-style doctests in Guile (implemented, please comment)

2017-08-01 Thread Vítor De Araújo
Another possibility beside docstrings would be to add it as a property to the function. I'm not sure if this is a documented feature, but if the first form in a function is a literal vector rather than a string (or in addition to a string, I've just found out!), it will be interpreted as a sequence

Re: Python-style doctests in Guile (implemented, please comment)

2017-07-31 Thread Chaos Eternal
No, I don't think so. First, s-exp itself can be very literal written just like the srfi-64: #+begin_src (test 'foo (test-equal 1 (one))) #+end_src the meanning of this code is very straightforward: do a test whether result of (one) equals to 1. and now with my

Re: Python-style doctests in Guile (implemented, please comment)

2017-07-31 Thread Arne Babenhauserheide
Chaos Eternal writes: > Great job! > > I have a new idea using s-exps to define tests: > simple way: > (define-syntax define-examples > (syntax-rules () ((_ e ...) (quote (e ...) > > then we can simply (read the-file) then (match e ((define-examples e ...)) > (do-test e)) So you’d write so

Re: Python-style doctests in Guile (implemented, please comment)

2017-07-31 Thread Arne Babenhauserheide
Hi Mark, String-literals are a problem I did hit, and I’d be happy to lose that problem without losing the ease of starting a procedure with tests which double as automatically verified documentation. Mark H Weaver writes: >> (import (examples doctests)) >> >> (define (one) >>

Re: Python-style doctests in Guile (implemented, please comment)

2017-07-31 Thread Panicz Maciej Godek
2017-07-31 14:51 GMT+02:00 Mark H Weaver : > Hi Arne, > > Arne Babenhauserheide writes: > > > I implemented doctests in Guile which allow writing SRFI-64 tests > > directly in the docstring. Here’s a minimal example: > > > > > > (import (examples doctests)) > > > > (define (one) > >

Re: Python-style doctests in Guile (implemented, please comment)

2017-07-31 Thread Mark H Weaver
Hi Arne, Arne Babenhauserheide writes: > I implemented doctests in Guile which allow writing SRFI-64 tests > directly in the docstring. Here’s a minimal example: > > > (import (examples doctests)) > > (define (one) > "(test 'foo > (test-equal 1 (one)))" > 1) I

Re: Python-style doctests in Guile (implemented, please comment)

2017-07-31 Thread Chaos Eternal
Great job! I have a new idea using s-exps to define tests: simple way: (define-syntax define-examples (syntax-rules () ((_ e ...) (quote (e ...) then we can simply (read the-file) then (match e ((define-examples e ...)) (do-test e)) On Mon, Jul 31, 2017 at 3:35 AM Arne Babenhauserheide wr

Python-style doctests in Guile (implemented, please comment)

2017-07-30 Thread Arne Babenhauserheide
Hi, I implemented doctests in Guile which allow writing SRFI-64 tests directly in the docstring. Here’s a minimal example: (import (examples doctests)) (define (one) "(test 'foo (test-equal 1 (one)))" 1) (doctests-testmod (current-module)) Writing si