|
From: | Oliver Heimlich |
Subject: | Re: @example's as doctests |
Date: | Sat, 28 Mar 2015 19:01:04 +0100 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.5.0 |
Am 28.03.2015 um 17:39 schrieb Colin Macdonald:
On 28/03/15 16:07, Oliver Heimlich wrote:Thus, only support for @group blocks in doctest is missing. doctest could use @end group as a separator between expected output and the next commands. However, this would be a little bit of a hack, because @group could also be used within expected output if it is very long. Any better ideas?I see, I had not thought of that. Maybe need to implement stepping through the code, checking one command at time. This should be straightforward but will take me some time... And I'm not hugely motivated as I personally prefer ">>" to mark each command. Alternatively (or perhaps additionally), any thoughts about adding a @prompt{} command? Colin
I personally do not prefer the “>>” marker, because it makes copying the code difficult.
The recent changes in generate_html make my first solution possible again: The three blocks can be separated into three @example blocks, which format well in console (help command) and in HTML now.
The doctest does not reset local variables between @example blocks, so they can simply be used to group each pair of input and output.
## @example ## @group ## x = infsup (1 + eps); ## intervaltotext (x) ## @result{} [1.0000000000000002, 1.0000000000000003] ## @end group ## @end example ## @example ## @group ## y = nextout (x); ## intervaltotext (y) ## @result{} [1, 1.0000000000000005] ## @end group ## @end example ## @example ## @group ## z = infsup (1); ## intervaltotext (z) ## @result{} [1] ## @end group ## @end example Oliver
[Prev in Thread] | Current Thread | [Next in Thread] |