On 14.09.18 20:12, Stefan Seefeld via Boost wrote:
On 2018-09-13 02:53 PM, Raffi Enficiaud via Boost wrote:
On 13.09.18 00:50, Stefan Seefeld via Boost wrote:
On 09/12/18 14:28, Raffi Enficiaud wrote:
On 12.09.18 00:21, Stefan Seefeld via Boost wrote:
* What (non-deprecated) API can I use to access command-line arguments during test initialization ?
By "test initialization", do you mean before the first test starts?
Yes.
The argc/argv are available to the master test suite:
https://www.boost.org/doc/libs/1_68_0/libs/test/doc/html/boost_test/tests_or...
I see. That code could use a bit of an explanation. You present a function that takes "argc" and "argv" as input, but rather than using those variables themselves, you access the argument vector via "framework::master_test_suite().argc" etc.. I find that a bit...em... counter-intuitive. What's the rationale for that ? Is the function argument the full argument vector, including the ones already consumed by Boost.Test itself ?
Apart from the historical side of this design, this has two benefits IMO: 1- the argc/argv passed to the rest of the test module at runtime may have been altered, either by the test module itself (dropping some params in a global fixture), or by the boost.test framework. The argc/argv seen by the test module are the ones that appear after the -- 2- the master test suite is a singleton, so you do not need to pass around argc/argv
And what about the return value ? What does it mean to return 0, or something else ?
I updated the documentation with a new section about runtime parameters (in master), with a few examples. It should appear in the 1.70 release or in the next cycle of doc update for the beta. Raffi