Boost logo

Boost :

Subject: Re: [boost] [test] unit test command-line handling
From: Raffi Enficiaud (raffi.enficiaud_at_[hidden])
Date: 2018-09-13 17:56:24


On 13.09.18 03:21, Stefan Seefeld via Boost wrote:
> On 09/12/18 18:50, Stefan Seefeld wrote:
>> On 09/12/18 14:28, Raffi Enficiaud wrote:
>>
>>> 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_organization/test_suite/master_test_suite.html#boost_test.tests_organization.test_suite.master_test_suite.command_line_arguments_access_in
>>>
>>
>> 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 ?
>
> ...and what is the appropriate way to signal an error, such as a missing
> or unsupported command-line argument ? (All the examples in the docs I
> could find return '0', so another related question is: what is the
> meaning of the return value ?)
>

There is this exception you may throw:

https://www.boost.org/doc/libs/1_68_0/libs/test/doc/html/boost/unit_test/framework/setup_error.html

Again, this is not so well documented here:

https://www.boost.org/doc/libs/1_68_0/libs/test/doc/html/boost_test/adv_scenarios/obsolete_init_func.html

Raffi


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