You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It's convenient to decide to skip some tests in run time. In (pseudo) code below test won't be skipped. doctest::skip() called after global variables initialization, but before main(). It seems, the most convenient moment to call skip is inside doctest::Context::applyCommandLine () or doctest::Context::run()
I don't believe that's going to work, since TEST_CASE will expand to a static variable declaration that uses your needToSkip variable. When the global ctor's are run, your test case will read the value of needToSkip at that point. Since those ctor's are run prior to the main method being entered, it would always observe needToSkip as false, so your test would never be disabled AFAIK.
I could see your need here being resolved by #822 instead, although it lifts the burden of disabling your tests to the command-line invocation.
It's convenient to decide to skip some tests in run time. In (pseudo) code below test won't be skipped.
doctest::skip()
called after global variables initialization, but beforemain()
. It seems, the most convenient moment to callskip
is insidedoctest::Context::applyCommandLine ()
ordoctest::Context::run()
tests_main.cpp:
static bool needToSkip = false;
TEST_CASE("test name" * doctest::skip (needToSkip)) {...}
int main (int argc, char** argv)
{
needToSkip = true;
doctest::Context context;
context.applyCommandLine (argc, argv);
return context.run ();
}
The text was updated successfully, but these errors were encountered: