mity / acutest

Simple header-only C/C++ unit testing facility.
MIT License
347 stars 96 forks source link

TEST_CASE should evaluate as a statement (no trailing semicolon) #29

Closed gdamore closed 4 years ago

gdamore commented 4 years ago

Clang-Tidy found this.

TEST_CASE(name) ends with a semicolon, which means that if you use it like this:

TEST_CASE(x == 1);

The compiler complains about an empty statement (caused by the redundant semicolon). This can also lead to surprises if this is used in contexts without enclosing braces, so it's not recommended.

Simple solution is just to elide the trailing semicolon.

PR with this is on the way.