catchorg / catchorg/Catch2

Feature request: HIDE_SECTION() macro

Open
#235 3 comments 0 reactions 0 assignees View on GitHub
Feature Request
Dominant language
C++
Stars
21.5k
Forks
3.5k
Avg merge
3d 16h
Merged PRs (30d)
2

Description

I've been following through the first part of Jeff Langr's book "Modern C++ Programming with Test-Driver Development" but converting the tests to use Catch as I go.

In chapter 2 he writes a test that doesn't work, then 'realises' that some other code needs to get changed before the test makes sense, so 'disables' the test; in Google Mock that looks like this:

``` c++
TEST_F(SoundexEncoding, DISABLED_ReplaceBlah) {
}
```

In Catch I'm using SECTIONs for each 'test' with a single test case, so I have:

``` c++
TEST_CASE("SoundexEncoding") {
SECTION("ReplaceBlah") {
}
}
```

The problem is that I can't disable the SECTION. I know that I can 'disable' an entire TEST_CASE using the '[hide]' tag but I can see that it would be useful to be able to disable a section in cases like this. So I think we could have:

``` c++
TEST_CASE("SoundexEncoding") {
HIDE_SECTION("ReplaceBlah") {
}
}
```

This would extract the name (and optional description) like a section does, but skip the section (maybe SKIP_SECTION would be a better name...). Thoughts?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.