doctest / doctest

The fastest feature-rich C++11/14/17/20/23 single-header testing framework

Home Page:https://bit.ly/doctest-docs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Allow setting (at least some) command-line options with `DOCTEST_...` macros

xparq opened this issue · comments

commented

Description

It would be super useful if we could bake option defaults (different from the shipped ones) into the executables.

For example: now that e.g. --no-intro has been implemented (#181, #245, #342), we can nicely disable it, but only by adding the relevant command-line option at run-time.

During the set-up period of projects (or indefinitely, for smaller ones), when there are no (stable) automation scripts, or in case of every random, ad-hoc manual run of executables directly (which happens a lot, actually), typing extra command-line options to change options is tedious, especially repetitively. (You know there's this uncanny-valley-like gap for this, when a command is repetitive enough to be frustrating, but not repetitive enough to actually write a script for it. :) )

If the options could also be controlled by #defines (e.g. DOCTEST_SET_<option-name>, matching the command-line option names), you could simply set them once and for all right in the source, e.g. where you also set DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN etc. anyway, and be done with it for any given module or project.

No need to support each, all at once, but at least some, gradually. For me (and I think others), the most important would be (unsurprisingly) DOCTEST_SET_NO_INTRO, to always save those extra lines of the output (as we typically only need it when encountering doctest the first time, and then not ever after).