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
Although the dedicated macros look nice, they may provide a false sense of security. There is no check done in case you forget to write a GIVEN(), a WHEN(), or a THEN(), or if they are specified in the wrong order. Both Catch2 and doctest have the same issue. It might be possible to implement such checks at compile-time (run-time would be easy), but this would be a fair bit of work. I won't feel comfortable adding them to snitch until such checks are in place.
There's also some more more minor issues:
SCENARIO() would need separate macros to support template test case, etc., which means more macros to maintain.
GIVEN, WHEN, and THEN are fairly common words; I would be a bit wary of adding them to the global namespace. The prefixed version (SNITCH_GIVEN(), etc.) would be far less readable, which defeats the purpose.
Given that the exact same behavior can be obtained with plain sections, at the expense of typing a few extra characters, I'm not sure this is worth it. My recommendation would be to stick to simple sections, as in the first example, and arrange them in a BDD-style if you like.
They are not on the roadmap, but they are important. https://github.com/doctest/doctest/blob/master/doc/markdown/testcases.md#bdd-style-test-cases
The tests written in BDD are a lot more readable. https://github.com/zhihaoy/nontype_functional/blob/main/tests/function_ref/test_return_reference.cpp
The text was updated successfully, but these errors were encountered: