Boost logo

Boost :

Subject: Re: [boost] [BoostBook] how to automatically test code examples?
From: Paul A. Bristow (pbristow_at_[hidden])
Date: 2017-10-19 08:59:36


> -----Original Message-----
> From: Boost [mailto:boost-bounces_at_[hidden]] On Behalf Of Hans Dembinski via Boost
> Sent: 19 October 2017 09:01
> To: boost_at_[hidden]
> Cc: Hans Dembinski
> Subject: Re: [boost] [BoostBook] how to automatically test code examples?
>
> Hello again,
>
> > It says in the BoostBook documentation http://www.boost.org/doc/libs/1_65_1/doc/html/boostbook.html
> > "The BoostBook format allows testcases to be generated by weaving together program fragments from example programs
> in the documentation. This capability is integrated with testsuite generation so that example programs are normal tests in
> BoostBook."
> >
> > That's awesome, I would love to use this feature, but the documentation is not explaining how to actually do that. I found
> the element "testsuite" which probably does what I want. I went on to scan the Boost repository for this BoostBook element,
> but couldn't find an example to copy from.
> >
> > Could someone help me out? How do I modify my BoostBook and Jam files to generate tests out of the code examples in
> the documentation?
>
> I didn't get any reply so far… was my question stupid? Or is it simply that no one knows? Is the author of BoostBook, Douglas
> Gregor, not around anymore?

Sadly not - moved to higher things some years ago.
 
> Since I couldn't figure out how to do it with BoostBook, I wrote a Python script which is run by CMake. It parses the
> documentation for code snippets and writes those to the examples directory, so that the examples are compiled along with
> the tests. It is not perfect, but it works at least.

I think that the reason is that almost everyone else is using Quickbook to generate the Boostbook, so that it is entirely transparent to them. Snippets of examples and tests are sucked in by lines of Quickbook, but the docs, examples and tests, and the jamfiles to run them otherwise entirely separate.

Sorry.

Paul

---
Paul A. Bristow
Prizet Farmhouse
Kendal UK LA8 8AB
+44 (0) 1539 561830

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk