octave-maintainers
[Top][All Lists]
Advanced

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

Re: doctest-for-matlab: looks good


From: Carnë Draug
Subject: Re: doctest-for-matlab: looks good
Date: Fri, 20 Feb 2015 22:54:01 +0000

On 19 February 2015 at 23:21, Colin Macdonald <address@hidden> wrote:
> I've taken a look at:
>
> https://github.com/catch22/doctest-for-matlab/
>
> to run tests on my m-file documentation.  Basically, I do "doctest sym"
> to test a whole class or "doctest @sym/plus" for a method.
>
> I think I will start using this for my documentation.  I did a
> half-dozen m-files and found an copy-paste error already.
>
> Here's an example (as a diff) of the minimal changes I needed for one of
> the Symbolic pkg's m-files:
>
> - - - - - - - - - - - - - - - - - - - - - - - - -
>
>  %% Example:
>  %% @example
>  %% @group
> -%% syms x
> -%% p = poly2sym ([2 4 6 8], x)
> -%%    @result{}
> +%% >> syms x
> +%% >> p = poly2sym ([2 4 6 8], x)
> +%% p = (sym)
>  %%          3      2
>  %%       2⋅x  + 4⋅x  + 6⋅x + 8
> -%% horner (p)
> -%%    @result{} x⋅(x⋅(2⋅x + 4) + 6) + 8
> +%% >> horner (p)
> +%% ans = (sym) x⋅(x⋅(2⋅x + 4) + 6) + 8
> +%%
> +%%
>  %% @end group
>  %% @end example
>
> - - - - - - - - - - - - - - - - - - - - - - - - -
>
> Notes:
>
> 1.  Use ">>" to indicate commands to be run.  And it needs two blank
> lines before regular paragraphs start again (I've just been using two
> blank lines within the @example).  There are various wildcard options
> and its fairly flexible wrt whitespace.
>
> 2.  It runs on the output of `__makeinfo__(docstring, "plain text")` so
> it has/requires no texinfo knowledge.
>
> 3.  Only downside I see so far is the two blank lines can be a bit too
> "open" in the "help @sym/horner" output.

Couldn't instead use "@end group" to signal this?



reply via email to

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