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 ?
In 1.68, it is also possible to use this for data driven test cases, using the make_delayed (if you need a test generator that is dependent on your argc/argv).
https://www.boost.org/doc/libs/1_68_0/libs/test/doc/html/boost_test/change_l...
* How does my own handling of command-line arguments interact with Boost.Test's own command-line argument handling ?
I am surprised I did not create a doc entry about this. The way it works is indicated in the change logs of boost.test:
https://www.boost.org/doc/libs/1_68_0/libs/test/doc/html/boost_test/change_l...
Anything after -- is passed to the master test suite argc/argv and is available to your test module.
That makes sense.
I will update the doc on the two points above to make it clearer.
Thank you. Please consider adding a top-level section on passing command-line arguments, perhaps under "Runtime parameters". I believe that's a common enough use-case that it might be worthwhile for this not to be hidden in a (seemingly unrelated) section about the master test suite. Thanks for your help ! Stefan -- ...ich hab' noch einen Koffer in Berlin...