From h.wickham at gmail.com  Sat Jan 18 16:43:07 2014
From: h.wickham at gmail.com (Hadley Wickham)
Date: Sat, 18 Jan 2014 09:43:07 -0600
Subject: [Rd] Using unit-tests as examples
In-Reply-To: <CAMGHQ97ct+FQc361micsLrx8CYnFE8WHvCBtVLvWL82bdpDFhA@mail.gmail.com>
References: <CAMGHQ97ct+FQc361micsLrx8CYnFE8WHvCBtVLvWL82bdpDFhA@mail.gmail.com>
Message-ID: <CABdHhvFbSqmyE6zYWvXw5NKJ1NXq4e2aFc8WzPqkiM2d4U445A@mail.gmail.com>

If you're using roxygen2, you can use @example tag to include an
external file into the examples.

Hadley

On Sat, Jan 18, 2014 at 7:18 AM, Alexey Sergushichev
<alsergbox at gmail.com> wrote:
> Hi,
>
> Which is the best way to use unit tests as examples for documentation?
> I use testthat, but if there is a good way to do this, for example,
> only with RUnit, it'd still be good to know.
>
> Unit-tests are usually simple and concise, so they are good candidates
> for example code, but I don't want to copy them into documentation and
> maintain by hands. I tried to google how people handle this, but
> didn't find anything.
>
> ---
> Best regards,
> Alexey
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



-- 
http://had.co.nz/



[Rd] Using unit-tests as examples
Hadley Wickham